This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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]

modifying ld options in the enviroment


I've often tried to do things like 
	make CC='gcc -Wl,-t'
to find out why builds were doing strange things -- in complicated
situations this doesn't work for a variety of reasons (depending
on how the system was architected).

Instead of rearchitecting the make architecture, or seeing the
failing the command line (which is sometimes not shown) and running it 
standalone,
I inserted a environemnt variable 
	LD_ENV_OPTIONS
which allows you to inject options into ld
(another approach is to write a script in front of the real ld which does
this, but this gets old fast)...

A simple case is:
: leisner@dell3;LD_ENV_OPTIONS=-t gcc foo.c
option is -t
/usr/gnu/binutils/bin/ld: mode elf_i386
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../crt1.o
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../crti.o
/usr/lib/gcc/i386-redhat-linux/3.4.2/crtbegin.o
/tmp/ccOGmbte.o
-lgcc_s (/usr/lib/gcc/i386-redhat-linux/3.4.2/libgcc_s.so)
/lib/libc.so.6
(/usr/lib/libc_nonshared.a)elf-init.oS
-lgcc_s (/usr/lib/gcc/i386-redhat-linux/3.4.2/libgcc_s.so)
/usr/lib/gcc/i386-redhat-linux/3.4.2/crtend.o
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../crtn.o

This is wrt 2.16 -- I've had this for a few years...I've found it 
very useful...I'm thinking of duplicating something like this for gcc...



Marty Leisner
leisner@rochester.rr.com

Attachment: ldmain.c.diff
Description: ldmain.c.diff


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