-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selection of the linker executable #1067
Comments
How should the compiler handle -l and -L args as they may be different in these linkers? |
I would pass them along to the linker. |
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
…rides the need for `@` in macro names. Fixes to macro context evaluation. Updated allocator api. Removed install_win_reqs.bat. Deterministic @init for MacOS. Fixed temp memory issue with formatter. Support LLVM 19. Add support to compare bitstructs using == and !=. Support Windows `.def` files. Removed invalid grammar from grammar.y. Support compile time folding of &|^~ for bitstructs. `output` project setting now respected. Fix issue where constants were not properly constant folded. Add temp_push/pop. Aliased declarations caused errors when used in initializers. Fix export output. Fix of const ternary #1118. Fix of $$MODULE in nested macros #1117. Fix debug info on globals. `out` now correctly detects subscript[] use #1116. Lateral implicit imports removed. Default to '.' if no libdir is specified. Improved error messages for `--lib`. Fix raylib snake example. Overzealous local escape check corrected #1127. Improved yacc grammar #1128. `--linker` argument #1067. Fixes to the matrix operations #1130. Added GenericList.
This should now work in 0.5.4, try it out. |
Selection of the linker workers in 0.5.4, but the example in this issue fails to compile because of the added You can consider this issue solved, though, as linker selection does indeed work. |
@pinicarus is that still added now? |
Linker selection works |
New feature
Some build environments may require the use of a particular linker.
As per https://github.com/c3lang/c3c/blob/master/wrapper/src/wrapper.cpp#L73, the choice currently only depends on the target format.
A new compiler flag (e.g.
--linker=FILE
) would allow to override the default choice in the switch.Example usage
Cosmopolitan libc is an example of such build environment.
Simple C3 source:
Build command:
c3c compile --target elf-x64 --single-module=yes -o hello.com.dbg -z -static -z -nostdlib -z -no-pie -z -T -z ape.lds -z --gc-sections -z -z -z common-page-size=0x1000 -z -z -z max-page-size=0x1000 -z -z -z noexecstack -z crt.o -z ape-no-modify-self.o -z cosmopolitan.a hello.c3
ape.lds
,crt.o
,ape-no-modify-self.o
andcosmopolitan.a
files to be taken from the latest (3.0.2 at writing time) cosmopolitan amalgamation release.Version used:
Error produced:
Example of different outcome based on the chosen linker:
ld.gold (from binutils 2.40)
ld.bfd (from binutils 2.40)
ld.lld (from lld 16.0.6)
ld.mold (from mold 2.1.0)
The text was updated successfully, but these errors were encountered: