Is there any way to use a linker script with ld
on Mac OS X?
The GNU ld
program on Linux accepts a -T <scriptname>
option, but on Mac OS -T is an unknown command option. Using an alternative installation of GCC is okay with me, if that solves the problem.
You write a linker script as a series of commands. Each command is either a keyword, possibly followed by arguments or an assignment to a symbol. You may separate commands using semicolons. Whitespace is generally ignored.
17.10. 2 The Linker Script. The Linker Script is a text file made up of a series of Linker directives which tell the Linker where the available memory is and how it should be used. Thus, they reflect exactly the memory resources and memory map of the target microcontroller.
The ld command combines several object files and libraries, resolves references, and produces an ouput file. ld can produce a final linked image (executable, dylib, or bundle), or with the -r option, produce another object file. If the -o option is not used, the output file pro- duced is named "a.out".
The Fink Project has a document on porting Unix software to Darwin / Mac OS X, it claims that the Darwin linker isn't even based on the GNU linker.
I think you will have to read the ld
man page to figure out how to do what you want with the native linker or install your own version of the GCC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With