On Fri, Dec 7, 2012 at 5:15 AM, H.J. Lu <hjl.to...@gmail.com> wrote: > On Wed, Nov 28, 2012 at 8:18 PM, H.J. Lu <hjl.to...@gmail.com> wrote: >> >> Binutils supports 2 linkers, ld.gold and ld.bfd. One of them is >> configured as the default linker, ld, which is used by GCC. Sometimes, >> we want to use the alternate linker with GCC at run-time. This patch >> adds -fuse-ld=bfd and -fuse-ld=gold options to GCC driver. It changes >> collect2.c to pick either ld.bfd or ld.gold. It also adds >> ORIGINAL_LD_BFD_FOR_TARGET and ORIGINAL_LD_GOLD_FOR_TARGET to >> exec-tool.in to add -fuse-ld=bfd and -fuse-ld=gold support to >> collect-ld. Since ld.bfd nor ld.gold know the new options, you >> will get >> >> # ./xgcc -B./ /tmp/x.c -fuse-ld=gold -v >> ... >> ./collect-ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker >> /lib64/ld-linux-x86-64.so.2 -fuse-ld=gold /lib/../lib64/crt1.o >> /lib/../lib64/crti.o ./crtbegin.o -L. -L/lib/../lib64 -L/usr/lib/../lib64 >> /tmp/cclVWcGz.o -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc >> --as-needed -lgcc_s --no-as-needed ./crtend.o /lib/../lib64/crtn.o >> GNU gold (Linux/GNU Binutils 2.23.51.0.7.20121127) 1.11 >> /usr/local/bin/ld.gold: fatal error: -f/--auxiliary may not be used without >> -shared >> collect2: error: ld returned 1 exit status >> >> This is because we pass everything to ld and ld.bfd/ld.gold doesn't >> understand -fuse-ld=bfd/-fuse-ld=gold. It isn't a problem for collect2 >> since it will filter-out -fuse-ld=bfd/-fuse-ld=gold. I will submit a >> binutils patch to ignore -fuse-ld=bfd/-fuse-ld=gold, similar to -flto >> options. >> >> OK to install? >> >> Thanks. >> >> >> H.J. >> --- >> 2012-11-28 Nick Clifton <ni...@redhat.com> >> Matthias Klose <d...@debian.org> >> Doug Kwan <dougk...@google.com> >> H.J. Lu <hongjiu...@intel.com> >> >> PR driver/55470 >> * collect2.c (main): Support -fuse-ld=bfd and -fuse-ld=gold. >> >> * common.opt: Add fuse-ld=bfd and fuse-ld=gold. >> >> * gcc.c (LINK_COMMAND_SPEC): Pass -fuse-ld=* to collect2. >> >> * opts.c (comman_handle_option): Ignore -fuse-ld=bfd and >> -fuse-ld=gold. >> >> * doc/invoke.texi: Document -fuse-ld=bfd and -fuse-ld=gold. > > Here is the minimum patch for 4.8. OK to install? > >
Hi Joseph, Can you review this? Thanks. H.J.