Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a Linker Script on Mac OS X

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.

like image 604
Andres Jaan Tack Avatar asked Jan 12 '10 19:01

Andres Jaan Tack


People also ask

How do you write a script linker?

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.

What does a linker script include?

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.

What is Ld Macos?

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".


1 Answers

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.

like image 89
benzado Avatar answered Sep 18 '22 13:09

benzado