This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Passing options through gcc to linker


Hi all,

I am writing a gcc port for a new machine. I need to pass various options
to the linker, through gcc. Up until now, I have done this using Xlinker:

gcc test.c -Xlinker --set-stack-offset -Xlinker 1024

This is not particularly neat, so I defined a -m option, which is ignored
by the compiler proper, but is passed through to the linker:

gcc test.c -mset-stack-offset=1024

This is much neater, easier to remember, and also shows up in the
targethelp output. However, the linker uses getopt to parse the command
line option, and the -mset-stack-offset=1024 switch is not a valid switch.
It would accept two dashes at the start of an = switch, but not one. Is
there any way that I can manipulate the options passed through gcc so that
I can massage them into a form acceptable to the linker? I thought that
the specs file would allow this, but it can either pass through all -m
options unaltered, or allow the last -m option to be altered and passed
through whilst ignoring the other options - neither of these allow me to
do what I want.

Thanks,

 Dan.

===============================================================================
Dan Towner
picoChip Designs Ltd.
dant@picochip.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]