diff mbox

[build] Restore arm-eabi bootstrap (PR target/50978)

Message ID yddlirx2lrr.fsf@manam.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Nov. 3, 2011, 4:50 p.m. UTC
This patch restores arm-none-eabi bootstrap, which had been broken by my
libgcc patches.  They accidentally removed arm/t-bpabi in gcc/config.gcc
while the file is still needed for its addition to EXTRA_HEADERS.

Matt confirmed in the PR that it restored bootstrap for him.

Ok for mainline?

	Rainer


2011-11-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	PR target/50978
	* config/arm/t-bpabi: New file.
	* config.gcc (arm*-*-linux*): Add arm/t-bpabi to tmake_file for
	arm*-*-linux-*eabi.
	(arm*-*-uclinux*): Add arm/t-bpabi to tmake_file for
	arm*-*-uclinux*eabi.
	(arm*-*-eabi*, arm*-*-symbianelf*): Add arm/t-bpabi to tmake_file
	for arm*-*-eabi*.

Comments

Ramana Radhakrishnan Nov. 3, 2011, 6:12 p.m. UTC | #1
.
>
> Ok for mainline?

This is OK.

Ramana
Paolo Bonzini Nov. 3, 2011, 6:15 p.m. UTC | #2
On 11/03/2011 05:50 PM, Rainer Orth wrote:
> This patch restores arm-none-eabi bootstrap, which had been broken by my
> libgcc patches.  They accidentally removed arm/t-bpabi in gcc/config.gcc
> while the file is still needed for its addition to EXTRA_HEADERS.
>
> Matt confirmed in the PR that it restored bootstrap for him.
>
> Ok for mainline?

Ok.

Paolo
Matthias Klose Nov. 4, 2011, 1:58 p.m. UTC | #3
On 11/03/2011 12:50 PM, Rainer Orth wrote:
> This patch restores arm-none-eabi bootstrap, which had been broken by my
> libgcc patches.  They accidentally removed arm/t-bpabi in gcc/config.gcc
> while the file is still needed for its addition to EXTRA_HEADERS.
> 
> Matt confirmed in the PR that it restored bootstrap for him.
> 
> Ok for mainline?
> 
> 	Rainer
> 
> 
> 2011-11-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
> 
> 	PR target/50978
> 	* config/arm/t-bpabi: New file.
> 	* config.gcc (arm*-*-linux*): Add arm/t-bpabi to tmake_file for
> 	arm*-*-linux-*eabi.
> 	(arm*-*-uclinux*): Add arm/t-bpabi to tmake_file for
> 	arm*-*-uclinux*eabi.
> 	(arm*-*-eabi*, arm*-*-symbianelf*): Add arm/t-bpabi to tmake_file
> 	for arm*-*-eabi*.

still fails to build on arm-linux-gnueabi, configured with
         --with-arch=armv7-a
         --with-float=hard
         --with-fpu=vfpv3-d16
         --with-mode=thumb

/usr/bin/ld: emutls_s.o: relocation R_ARM_THM_MOVW_ABS_NC against
`pthread_cancel' can not be used when making a shared object; recompile with -fPIC
emutls_s.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make[5]: *** [libgcc_s.so] Error 1
make[5]: *** Waiting for unfinished jobs....
ranlib libgcc.a
make[5]: Leaving directory
`/home/doko/gcc-snapshot-20111103/build/arm-linux-gnueabihf/libgcc'
make[4]: *** [all-stage1-target-libgcc] Error 2

emutls_s.o indeed isn't built with -fPIC (it is on the 4.6 branch); PICFLAG in
libgcc/Makefile is set but apparently not used.

  Matthias
Rainer Orth Nov. 4, 2011, 2:52 p.m. UTC | #4
Matthias Klose <doko@ubuntu.com> writes:

> still fails to build on arm-linux-gnueabi, configured with
>          --with-arch=armv7-a
>          --with-float=hard
>          --with-fpu=vfpv3-d16
>          --with-mode=thumb
>
> /usr/bin/ld: emutls_s.o: relocation R_ARM_THM_MOVW_ABS_NC against
> `pthread_cancel' can not be used when making a shared object; recompile with -fPIC
> emutls_s.o: could not read symbols: Bad value
> collect2: error: ld returned 1 exit status
> make[5]: *** [libgcc_s.so] Error 1
> make[5]: *** Waiting for unfinished jobs....
> ranlib libgcc.a
> make[5]: Leaving directory
> `/home/doko/gcc-snapshot-20111103/build/arm-linux-gnueabihf/libgcc'
> make[4]: *** [all-stage1-target-libgcc] Error 2
>
> emutls_s.o indeed isn't built with -fPIC (it is on the 4.6 branch); PICFLAG in
> libgcc/Makefile is set but apparently not used.

Could you provide the exact command line (and perhaps an earlier 4.7
one, if that fails one from 4.6)?

Thanks.
        Rainer
Rainer Orth Nov. 4, 2011, 2:58 p.m. UTC | #5
Matthias Klose <doko@ubuntu.com> writes:

> emutls_s.o indeed isn't built with -fPIC (it is on the 4.6 branch); PICFLAG in
> libgcc/Makefile is set but apparently not used.

I think I see what's going on: config/arm/t-elf (and
config/arm/t-strongarm-elf) override HOST_LIBGCC2_CFLAGS instead of
appending to it.  This way, we loose PICFLAG from config/t-libgcc-pic.

Could you try that change?

Thanks.
        Rainer
Matthias Klose Nov. 4, 2011, 3:59 p.m. UTC | #6
On 11/04/2011 10:58 AM, Rainer Orth wrote:
> Matthias Klose <doko@ubuntu.com> writes:
> 
>> emutls_s.o indeed isn't built with -fPIC (it is on the 4.6 branch); PICFLAG in
>> libgcc/Makefile is set but apparently not used.
> 
> I think I see what's going on: config/arm/t-elf (and
> config/arm/t-strongarm-elf) override HOST_LIBGCC2_CFLAGS instead of
> appending to it.  This way, we loose PICFLAG from config/t-libgcc-pic.
> 
> Could you try that change?

yes, using += gets my behind this point, now in stage2.

thanks, Matthias
Paolo Bonzini Nov. 4, 2011, 4:34 p.m. UTC | #7
On 11/04/2011 04:59 PM, Matthias Klose wrote:
> On 11/04/2011 10:58 AM, Rainer Orth wrote:
>> Matthias Klose<doko@ubuntu.com>  writes:
>>
>>> emutls_s.o indeed isn't built with -fPIC (it is on the 4.6 branch); PICFLAG in
>>> libgcc/Makefile is set but apparently not used.
>>
>> I think I see what's going on: config/arm/t-elf (and
>> config/arm/t-strongarm-elf) override HOST_LIBGCC2_CFLAGS instead of
>> appending to it.  This way, we loose PICFLAG from config/t-libgcc-pic.
>>
>> Could you try that change?
> 
> yes, using += gets my behind this point, now in stage2.

Grep finds:

./config/mcore/t-mcore:HOST_LIBGCC2_CFLAGS = -O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter
./config/m32r/t-m32r:HOST_LIBGCC2_CFLAGS = -G 0
./config/t-rtems:HOST_LIBGCC2_CFLAGS = -I$(srcdir)/../newlib/libc/sys/rtems/include
./config/avr/t-avr:HOST_LIBGCC2_CFLAGS = -DDF=SF -Dinhibit_libc -mcall-prologues -Os
./config/h8300/t-h8300:HOST_LIBGCC2_CFLAGS = -DDF=SF
./config/lm32/t-elf:HOST_LIBGCC2_CFLAGS = -G 0 -msign-extend-enabled
./config/mmix/t-mmix:HOST_LIBGCC2_CFLAGS = -mlibfuncs -O2
./config/mips/t-elf:HOST_LIBGCC2_CFLAGS = -G 0
./config/picochip/t-picochip:HOST_LIBGCC2_CFLAGS = -DDF=SF -I../../includes/
./config/sh/t-sh:HOST_LIBGCC2_CFLAGS = -mieee
./config/c6x/t-elf:HOST_LIBGCC2_CFLAGS = -msdata=none
./config/t-openbsd-thread:HOST_LIBGCC2_CFLAGS=-pthread
./config/bfin/t-elf:HOST_LIBGCC2_CFLAGS = $(PICFLAG)
./config/stormy16/t-stormy16:HOST_LIBGCC2_CFLAGS = -O2
./config/t-vxworks:HOST_LIBGCC2_CFLAGS =
./config/arm/t-strongarm-elf:HOST_LIBGCC2_CFLAGS = -fno-inline
./config/arm/t-elf:HOST_LIBGCC2_CFLAGS = -fno-inline
./config/pdp11/t-pdp11:HOST_LIBGCC2_CFLAGS = -O2 -mfloat32

Do you think all of them should be changed?

Paolo
Rainer Orth Nov. 4, 2011, 4:39 p.m. UTC | #8
Paolo Bonzini <bonzini@gnu.org> writes:

>> yes, using += gets my behind this point, now in stage2.
>
> Grep finds:
>
> ./config/mcore/t-mcore:HOST_LIBGCC2_CFLAGS = -O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter
> ./config/m32r/t-m32r:HOST_LIBGCC2_CFLAGS = -G 0
> ./config/t-rtems:HOST_LIBGCC2_CFLAGS = -I$(srcdir)/../newlib/libc/sys/rtems/include
> ./config/avr/t-avr:HOST_LIBGCC2_CFLAGS = -DDF=SF -Dinhibit_libc -mcall-prologues -Os
> ./config/h8300/t-h8300:HOST_LIBGCC2_CFLAGS = -DDF=SF
> ./config/lm32/t-elf:HOST_LIBGCC2_CFLAGS = -G 0 -msign-extend-enabled
> ./config/mmix/t-mmix:HOST_LIBGCC2_CFLAGS = -mlibfuncs -O2
> ./config/mips/t-elf:HOST_LIBGCC2_CFLAGS = -G 0
> ./config/picochip/t-picochip:HOST_LIBGCC2_CFLAGS = -DDF=SF -I../../includes/
> ./config/sh/t-sh:HOST_LIBGCC2_CFLAGS = -mieee
> ./config/c6x/t-elf:HOST_LIBGCC2_CFLAGS = -msdata=none
> ./config/t-openbsd-thread:HOST_LIBGCC2_CFLAGS=-pthread
> ./config/bfin/t-elf:HOST_LIBGCC2_CFLAGS = $(PICFLAG)
> ./config/stormy16/t-stormy16:HOST_LIBGCC2_CFLAGS = -O2
> ./config/t-vxworks:HOST_LIBGCC2_CFLAGS =
> ./config/arm/t-strongarm-elf:HOST_LIBGCC2_CFLAGS = -fno-inline
> ./config/arm/t-elf:HOST_LIBGCC2_CFLAGS = -fno-inline
> ./config/pdp11/t-pdp11:HOST_LIBGCC2_CFLAGS = -O2 -mfloat32
>
> Do you think all of them should be changed?

Not without detailed analysis: they were moved over from gcc/config this
way, but I seem to have made an ordering mistake.

Several of them are for embedded targets without PIC support, but others
might need to be changed.  I'm undecided what's more risky:

* leave them as moved over, wait what breaks, and then change them,

* change them all now, and if something breaks, change them back with an
  explanation why an override is necessary.

	Rainer
Paolo Bonzini Nov. 4, 2011, 5:04 p.m. UTC | #9
Ok, so let's do the analysis.  Looks like there are problems in t-rtems 
and sh/t-sh, in addition to ARM.  But I think all of them can be changed.

>> ./config/mcore/t-mcore:HOST_LIBGCC2_CFLAGS = -O3 -DNO_FLOATLIB_FIXUNSDFSI #-msifilter

Used as

         tmake_file="mcore/t-mcore t-fdpbit"

would not be a problem to change to +=

>> ./config/m32r/t-m32r:HOST_LIBGCC2_CFLAGS = -G 0

Same:

         tmake_file="m32r/t-m32r t-fdpbit"

>> ./config/t-rtems:HOST_LIBGCC2_CFLAGS = -I$(srcdir)/../newlib/libc/sys/rtems/include

This was LIBGCC2_INCLUDES before your patches.

You're also missing it in many cases: arm, avr, bfin, moxie, h8300, 
lm32, m32r, m68k, mips, powerpc, sh, m32c.

>> ./config/avr/t-avr:HOST_LIBGCC2_CFLAGS = -DDF=SF -Dinhibit_libc -mcall-prologues -Os

avr-*-rtems*)
         tmake_file="$tmake_file avr/t-avr t-fpbit"
         tm_file="$tm_file avr/avr-lib.h"
         # Don't use default.
         extra_parts=
         ;;

tmake_file seems to be empty at this point, but let's change it to +=

>> ./config/h8300/t-h8300:HOST_LIBGCC2_CFLAGS = -DDF=SF

Same, safe to change.

>> ./config/lm32/t-elf:HOST_LIBGCC2_CFLAGS = -G 0 -msign-extend-enabled

lm32-*-elf*|lm32-*-rtems*)
         extra_parts="$extra_parts crti.o crtn.o"
         tmake_file="lm32/t-lm32 lm32/t-elf t-softfp-sfdf t-softfp"
         ;;

Safe to change.

>> ./config/mmix/t-mmix:HOST_LIBGCC2_CFLAGS = -mlibfuncs -O2

mmix-knuth-mmixware)
         extra_parts="crti.o crtn.o crtbegin.o crtend.o"
         tmake_file="${tmake_file} ${cpu_type}/t-${cpu_type}"
         ;;

Safe to change.

>> ./config/mips/t-elf:HOST_LIBGCC2_CFLAGS = -G 0

Only comes after mips/t-mips, safe to change.

>> ./config/picochip/t-picochip:HOST_LIBGCC2_CFLAGS = -DDF=SF -I../../includes/

picochip-*-*)
         tmake_file="picochip/t-picochip t-fpbit"
         ;;

Safe to change.

>> ./config/sh/t-sh:HOST_LIBGCC2_CFLAGS = -mieee

Wrong, sh/t-sh comes after t-libgcc-pic for sh*-*-linux*
.
>> ./config/c6x/t-elf:HOST_LIBGCC2_CFLAGS = -msdata=none

Safe to change.

>> ./config/t-openbsd-thread:HOST_LIBGCC2_CFLAGS=-pthread

Wrong, overrides t-libgcc-pic.

>> ./config/bfin/t-elf:HOST_LIBGCC2_CFLAGS = $(PICFLAG)

Safe to change.  Can be removed altogether and replaced with t-libgcc-pic.

>> ./config/stormy16/t-stormy16:HOST_LIBGCC2_CFLAGS = -O2

Seems unused to me, because this is not true anymore:

  tmake_file
        A list of machine-description-specific makefile-fragments,
        if different from "$cpu_type/t-$cpu_type".
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>> ./config/t-vxworks:HOST_LIBGCC2_CFLAGS =

Can be zapped.  But LIBGCC2_DEBUG_CFLAGS cannot, the default is "-g"

>> ./config/arm/t-strongarm-elf:HOST_LIBGCC2_CFLAGS = -fno-inline

Wrong, as you found it should be changed to += because it comes after 
t-libgcc-pic for arm*-*-freebsd*.

>> ./config/arm/t-elf:HOST_LIBGCC2_CFLAGS = -fno-inline

Wrong, topic of this thread.

>> ./config/pdp11/t-pdp11:HOST_LIBGCC2_CFLAGS = -O2 -mfloat32

Safe to change.

Overall I suggest:

* change t-rtems back to LIBGCC2_INCLUDES and add it for the missing 
targets;

* change all to += except when a better course of action is suggested above.

Of course unless you disagree with the analysis or had a reason for the 
t-rtems changes. :)  Let's commit the two as separate patches.

Paolo
Rainer Orth Nov. 4, 2011, 5:24 p.m. UTC | #10
Paolo Bonzini <bonzini@gnu.org> writes:

>>> ./config/t-rtems:HOST_LIBGCC2_CFLAGS = -I$(srcdir)/../newlib/libc/sys/rtems/include
>
> This was LIBGCC2_INCLUDES before your patches.
>
> You're also missing it in many cases: arm, avr, bfin, moxie, h8300, lm32,
> m32r, m68k, mips, powerpc, sh, m32c.

Right, no idea why.  I think it's best to set tmake_file=t-rtems for
*-*-rtems* and make sure all RTEMS targets only append to tmake_file.

>>> ./config/stormy16/t-stormy16:HOST_LIBGCC2_CFLAGS = -O2
>
> Seems unused to me, because this is not true anymore:
>
>  tmake_file
>        A list of machine-description-specific makefile-fragments,
>        if different from "$cpu_type/t-$cpu_type".
>        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I think this wan't true ever, but has just been copied from config.gcc.

> Overall I suggest:
>
> * change t-rtems back to LIBGCC2_INCLUDES and add it for the missing
> targets;

Agreed: if LIBGCC2_INCLUDES had been dropped completely, that would
justify moving the -I flags to HOST_LIBGCC2_CFLAGS, but since other
targets still use it, there's no reason not to use it here, too.

> * change all to += except when a better course of action is suggested above.
>
> Of course unless you disagree with the analysis or had a reason for the
> t-rtems changes. :)  Let's commit the two as separate patches.

Ok, but unless it's urgent, I'd like to go over it over the weekend and
commit on monday.  I'm about to leave relatively soon.

	Rainer
Paolo Bonzini Nov. 4, 2011, 5:30 p.m. UTC | #11
On 11/04/2011 06:24 PM, Rainer Orth wrote:
> Ok, but unless it's urgent, I'd like to go over it over the weekend and
> commit on monday.  I'm about to leave relatively soon.

Sure.  Let me know if you cannot fix arm and sh.

Paolo
diff mbox

Patch

# HG changeset patch
# Parent 842d03d7a925718952de26cdcec4f361e68b956e
Restore arm-eabi bootstrap (PR target/50978)

diff --git a/gcc/config.gcc b/gcc/config.gcc
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -824,7 +824,7 @@  arm*-*-linux*)			# ARM GNU/Linux with EL
 	case ${target} in
 	arm*-*-linux-*eabi)
 	    tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h"
-	    tmake_file="$tmake_file arm/t-arm-elf arm/t-linux-eabi"
+	    tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
 	    # Define multilib configuration for arm-linux-androideabi.
 	    case ${target} in
 	    *-androideabi)
@@ -851,6 +851,7 @@  arm*-*-uclinux*)		# ARM ucLinux
 	case ${target} in
 	arm*-*-uclinux*eabi)
 	    tm_file="$tm_file arm/bpabi.h arm/uclinux-eabi.h"
+	    tmake_file="$tmake_file arm/t-bpabi"
   	    # The BPABI long long divmod functions return a 128-bit value in
 	    # registers r0-r3.  Correctly modeling that requires the use of
 	    # TImode.
@@ -875,6 +876,7 @@  arm*-*-eabi* | arm*-*-symbianelf* )
 	case ${target} in
 	arm*-*-eabi*)
 	  tm_file="$tm_file newlib-stdint.h"
+	  tmake_file="${tmake_file} arm/t-bpabi"
 	  use_gcc_stdint=wrap
 	  ;;
 	arm*-*-symbianelf*)
diff --git a/gcc/config/arm/t-bpabi b/gcc/config/arm/t-bpabi
new file mode 100644
--- /dev/null
+++ b/gcc/config/arm/t-bpabi
@@ -0,0 +1,1 @@ 
+EXTRA_HEADERS += $(srcdir)/ginclude/unwind-arm-common.h