Repository navigation
gas64: darwin-x86_64: Mach-O assembly for the assembler of clang - #510
Open
XusinboyBekchanov wants to merge 1 commit into
Open
XusinboyBekchanov wants to merge 1 commit into
XusinboyBekchanov wants to merge 1 commit into
Conversation
…tem V UDT results, 8/16-bit arguments extended for clang's callees Extern variables are accessed through the GOT on darwin: Mach-O has no copy relocations, and ld rejected the RIP-relative access to a variable of a dylib (__stdoutp of libSystem in fbcunit) with "invalid use of rip-relative addressing".
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gas64 for darwin-x86_64: the assembly is written for the assembler of clang (Mach-O). On upstream master
-gen gas64on macOS fails at the first line (.section .text: "unexpected token in '.section' directive")..text,.data,__DATA,...for the others;__mod_init_func/__mod_term_funcfor the constructors/destructors (Mach-O has no priorities, they run in the order of the modules).balign, power-of-two alignment of.comm/.lcomm, the underscore prefix of the C functions, no@PLT[var]andoffset sym[rip]written so that clang accepts them__stdoutpof libSystem). The lines are rewritten at the end of each proc (after the peephole optimizer), only on darwin$mxcsr,$sse41and$sse41_testare namedfb_gas64_mxcsr,fb_gas64_sse41andfb_gas64_sse41_test($starts an immediate value for the assembler of clang)-gen gas64keeps the intel syntax on darwinNew test: tests/crt/darwin-extern-data.bas (darwin only) loads
__stdoutp/__stderrpof libSystem, takes their address and passes them tofileno().Tested on macOS 14.8 (x86_64, Xcode 16 clang), together with #507 and #508 (without them the rtlib does not build and programs don't link on current macOS):
acos( -1.0f )of SINGLE) and 2 in file/input.bas (wstringOverflowInput)fb_hGL_GetProcAddresson darwin without XQuartz, so for the unit tests I linked a stub that returns NULL (see fbc: darwin: link with the SDK of macOS, no crt objects, -dylib, #inclib "framework:Name" #508)On linux-x86_64 all unit tests pass with -gen gas64 and -gen gcc (the darwin changes are only for the darwin target).