Hi,
for a while now I've had problems using buildgcc on my Debian system, which runs Debian testing (aka. stretch or version 9) and GCC 6.2. When it fails, there is the following error in util/crossgcc/build-*-elf-GCC/config.log:
/usr/bin/ld: /home/jn/dev/coreboot/util/crossgcc/xgcc/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC
This error only happens when buildgcc uses gcc 6.2. When I select gcc 4.9, gcc 5.3, clang 3.8, or clang 3.9, like this, buildgcc succeeds[1]:
CC=gcc-5 CXX=g++-5 make CPUS=3 crossgcc
Regards, Jonathan Neuschäfer
[1]: You a little patch for buildgcc to accept $CC: https://review.coreboot.org/#/c/17931/
On 21.12.2016 02:53, Jonathan Neuschäfer wrote:
Hi,
for a while now I've had problems using buildgcc on my Debian system, which runs Debian testing (aka. stretch or version 9) and GCC 6.2. When it fails, there is the following error in util/crossgcc/build-*-elf-GCC/config.log:
/usr/bin/ld: /home/jn/dev/coreboot/util/crossgcc/xgcc/lib/libgmp.a(fat_entry.o): relocation R_X86_64_32S against symbol `__gmpn_cpuvec' can not be used when making a shared object; recompile with -fPIC
That's known trouble due to their GCC using `-fpie/-pie` by default now. One way to work around is adding `-with-pic` to the configure step when building GMP.
We could do that automatically. I guess, there is something in `gcc -dumpspecs` that could be used. Can you provide that output for the failing GCC, please.
Nico
This error only happens when buildgcc uses gcc 6.2. When I select gcc 4.9, gcc 5.3, clang 3.8, or clang 3.9, like this, buildgcc succeeds[1]:
CC=gcc-5 CXX=g++-5 make CPUS=3 crossgcc
Regards, Jonathan Neuschäfer
[1]: You a little patch for buildgcc to accept $CC: https://review.coreboot.org/#/c/17931/
On Wed, Dec 21, 2016 at 08:05:28PM +0100, Nico Huber wrote:
On 21.12.2016 02:53, Jonathan Neuschäfer wrote:
[...]
That's known trouble due to their GCC using `-fpie/-pie` by default now. One way to work around is adding `-with-pic` to the configure step when building GMP.
We could do that automatically. I guess, there is something in `gcc -dumpspecs` that could be used. Can you provide that output for the failing GCC, please.
Nico
$ gcc --version gcc (Debian 6.2.1-5) 6.2.1 20161124 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -dumpspecs <see attachment>
Regards, Jonathan
On 22.12.2016 04:13, Jonathan Neuschäfer wrote:
On Wed, Dec 21, 2016 at 08:05:28PM +0100, Nico Huber wrote:
On 21.12.2016 02:53, Jonathan Neuschäfer wrote:
[...]
That's known trouble due to their GCC using `-fpie/-pie` by default now. One way to work around is adding `-with-pic` to the configure step when building GMP.
We could do that automatically. I guess, there is something in `gcc -dumpspecs` that could be used. Can you provide that output for the failing GCC, please.
Nico
$ gcc --version gcc (Debian 6.2.1-5) 6.2.1 20161124 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -dumpspecs
<see attachment>
Thanks.
I've found two working (i386-elf tested only yet) alternatives and pushed them to gerrit:
https://review.coreboot.org/#/c/17936/ https://review.coreboot.org/#/c/17938/
I prefer the latter for treating all GCCs the same way, without changing anything obvious for compilers that don't default to `-pie`.
Nico
On 22.12.2016 19:09, Nico Huber wrote:
On 22.12.2016 04:13, Jonathan Neuschäfer wrote:
On Wed, Dec 21, 2016 at 08:05:28PM +0100, Nico Huber wrote:
On 21.12.2016 02:53, Jonathan Neuschäfer wrote:
[...]
That's known trouble due to their GCC using `-fpie/-pie` by default now. One way to work around is adding `-with-pic` to the configure step when building GMP.
We could do that automatically. I guess, there is something in `gcc -dumpspecs` that could be used. Can you provide that output for the failing GCC, please.
Nico
$ gcc --version gcc (Debian 6.2.1-5) 6.2.1 20161124 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gcc -dumpspecs
<see attachment>
Thanks.
I've found two working (i386-elf tested only yet) alternatives and pushed them to gerrit:
https://review.coreboot.org/#/c/17936/ https://review.coreboot.org/#/c/17938/
I prefer the latter for treating all GCCs the same way, without changing anything obvious for compilers that don't default to `-pie`.
After some more testing the latter turned out to become quite fragile, since older versions of GCC don't know the `-pie` flag. Which also breaks the bootstrapping option.
I've build tested 17936 on Stretch now for all target architectures without bootstrapping and for i386 with bootstrapping.
Nico