-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add defines for assembly build (#3528)
* Add defines for assembly build Fixes #1894 by adding GOOS_ GOARCH_ and GOOS_GOARCH_ defines for building assembly. * Return a copy of args * Use build.Default variables for os and arch Add a compilation test that uses another architecture with conditional inclusion of an assembly function. This mimics a real library that fails to build under rules_go. --------- Co-authored-by: Patrick Scott <patrick.scott@observeinc.com>
- Loading branch information
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Example assembly copied from https://github.com/rpccloud/goid | ||
|
||
#include "go_asm.h" | ||
#include "textflag.h" | ||
|
||
#ifdef GOARCH_386 | ||
#define get_tls(r) MOVL TLS, r | ||
#define g(r) 0(r)(TLS*1) | ||
#endif | ||
|
||
TEXT ·getg(SB), NOSPLIT, $0-4 | ||
get_tls(CX) | ||
MOVL g(CX), AX | ||
MOVL AX, ret+0(FP) | ||
RET |