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]

Re: collect2 "-o" argument position problem


Ops sorry to hear that.
Actually it's a new backend I'm working on the responsible for that
bug, so I guess it's relevant to post it here.

So I run this:

 /home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/collect2
--sysroot=/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot
--eh-frame-hdr -m elf_i386 -dynamic-linker -o conftest
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crt1.o
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crti.o
/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/crtbegin.o
-L/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/bin
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/lib
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/lib
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib
/tmp/cckKKF1z.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/crtend.o
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crtn.o

Which results in many commands (like cc1 and such) and the last one is
the mentioned before:

 /home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/collect2
--sysroot=/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot
--eh-frame-hdr -m elf_i386 -dynamic-linker -o conftest
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crt1.o
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crti.o
/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/crtbegin.o
-L/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/bin
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/lib
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/lib
-L/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib
/tmp/cckKKF1z.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc
--as-needed -lgcc_s --no-as-needed
/home/david/uclibc/uclibc-buildroot-custom/output/build/host-gcc-final-gcc-4_7_3-release/build/./gcc/crtend.o
/home/david/uclibc/uclibc-buildroot-custom/output/host/usr/i686-buildroot-linux-gnu/sysroot/usr/lib/crtn.o

The thing is that I had a similar problem before with the "-m"
parameter, which didn't had any parameter, therefore I used to had -m
-dynamic-linker (which is wrong) and I fixed it by adding:

-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define LINK_SPEC "-m elf_i386 %{shared:-shared} \

in the i386/gnu-user.h file.

Now taking a look at it I just realized a dirty way to fix it, it is:

#undef  LINK_SPEC
#define LINK_SPEC "-m elf_i386  %{shared:-shared} \
  %{!shared: \
    %{!static: \
      %{rdynamic:-export-dynamic} \
      -dynamic-linker /lib/ld-linux.so.2} \     // Hardcoding here the argument
      %{static:-static}}"

I do not know why it doesn't read the values of parameters such as
%(dynamic_linker) although they are defined:

#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKE
#define SUBTARGET_EXTRA_SPECS \
  { "link_emulation", GNU_USER_LINK_EMULATION },\
  { "dynamic_linker", GNU_USER_DYNAMIC_LINKER }

Any ideas?

Thank you!


2014-04-03 1:17 GMT+02:00 Jonathan Wakely <jwakely.gcc@gmail.com>:
> On 2 April 2014 23:26, David Guillen wrote:
>> Hello guys,
>>
>> I don't know whether this is the best place to ask for this,
>
> gcc-help@gcc.gnu.org would have been better :-)


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