PATCH: --sysroot-suffix
Richard Sandiford
rsandifo@redhat.com
Mon Jan 17 10:54:00 GMT 2005
Mark Mitchell <mark@codesourcery.com> writes:
> Daniel Jacobowitz wrote:
>> Would a --sysroot option work for you instead? I can't think of any
>> realistic configurations where GCC and LD would have different
>> sysroots, so passing it down from gcc makes some sense.
Sounds like this changeable sysroot thing is a hotter topic than
I'd realised. As mentioned on gcc@:
http://gcc.gnu.org/ml/gcc/2004-12/msg00099.html
I've got some patches to add the --sysroot option that Daniel suggests,
but I've been sitting on them waiting for gcc to enter stage 1 (or for
the 2.16 release process to kick off, whichever was sooner).
FWIW, the patches are attached. They were developed against slightly
older versions of the tools and I haven't tested whether they still
work. There are no docs yet either. Still, I thought it might be
worth throw ingthem into this thread to see what you folks think.
I can update them, test them, and document them if it's thought
to be way to go.
The patches were originally tested on a mips64-linux-gnu cross.
Due to the wonders of gcc's option mangling, the gcc part will
accept both --sysroot=/path and -fsysroot=/path.
> To do what you suggest, I would have to make more invasive changes to
> the GCC driver. Because the driver can't assume that binutils supports
> the new option, I was just modifying the linker spec for the target in
> question.
Might be missing the point here, but in the patches below, gcc will only
handle --sysroot=/-fsysroot= correctly if the linker also understands
--sysroot=. It seemed like a reasonable restriction at the time
but I'd be interested to know what others think.
Richard
ld/
* ldmain.h (ld_sysroot): Change type to a constant string.
* ldmain.c (ld_sysroot): Likewise.
(get_relative_sysroot, get_sysroot): New functions, adding command-line
support for changing the sysroot.
(main): Call the new functions.
* lexsup.c (OPTION_SYSROOT): New.
(ld_options): Add --sysroot.
(parse_args): Add a dummy handler for it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ld-sysroot.diff
Type: text/x-patch
Size: 5891 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050117/abb06e6c/attachment.bin>
-------------- next part --------------
gcc/
* gcc.c (process_command): Handle -fsysroot=. Bypass relocatable
sysroot handling if the sysroot has been set on the command line.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-sysroot.diff
Type: text/x-patch
Size: 2141 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20050117/abb06e6c/attachment-0001.bin>
More information about the Binutils
mailing list