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

2011-11-07 Thread Rainer Orth
Hi Paolo,

 ./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.

As mentioned, I've added a common *-*-rtems* case and made sure to add
to tmake_file for all individual RTEMS ports.

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

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

Indeed, done.

 ./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've explicitly added the file and removed the misleading part of the comment.

 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.

Here are the two patches I came up with.  The were included in an
i386-pc-solaris2.11 bootstrap to check for syntactic correctness, but
otherwise only checked by visual inspection.

Ok for mainline?

Rainer


2011-11-06  Rainer Orth  r...@cebitec.uni-bielefeld.de

* config.host (*-*-rtems*): Add t-rtems to tmake_file.
(i[34567]86-*-rtems*): Remove t-rtems from tmake_file.
(lm32-*-elf*, lm32-*-rtems*): Split into ...
(lm32-*-elf*): ... this.
(lm32-*-rtems*): ... and this.
Add to tmake_file.
(m32r-*-rtems*): Add to tmake_file.
(moxie-*-rtems*): Likewise.
(sparc-*-rtems*): Likewise.
Remove t-rtems from tmake_file.
(sparc64-*-rtems*): Likewise.
* config/t-rtems (HOST_LIBGCC2_CFLAGS): Use LIBGCC2_INCLUDES
instead.

# HG changeset patch
# Parent f15c5acafbb06d7abc79d34f19f60da6db164e65
Consistently use t-rtems in libgcc

diff --git a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -229,6 +229,7 @@ case ${host} in
   esac
   ;;
 *-*-rtems*)
+  tmake_file=$tmake_file t-rtems
   extra_parts=crtbegin.o crtend.o
   ;;
 *-*-solaris2*)
@@ -564,8 +565,8 @@ i[34567]86-*-nto-qnx*)
 	extra_parts=crtbegin.o
 	;;
 i[34567]86-*-rtems*)
+	tmake_file=$tmake_file i386/t-softfp i386/t-crtstuff
 	extra_parts=$extra_parts crti.o crtn.o
-	tmake_file=${tmake_file} i386/t-softfp i386/t-crtstuff t-rtems
 	;;
 i[34567]86-*-solaris2* | x86_64-*-solaris2.1[0-9]*)
 	tmake_file=$tmake_file i386/t-crtpc i386/t-crtfm
@@ -671,10 +672,14 @@ iq2000*-*-elf*)
 	# Don't use default.
 	extra_parts=
 ;;
-lm32-*-elf*|lm32-*-rtems*)
+lm32-*-elf*)
 extra_parts=$extra_parts crti.o crtn.o
 tmake_file=lm32/t-lm32 lm32/t-elf t-softfp-sfdf t-softfp
 	;;
+lm32-*-rtems*)
+tmake_file=$tmake_file lm32/t-lm32 lm32/t-elf t-softfp-sfdf t-softfp
+extra_parts=$extra_parts crti.o crtn.o
+	;;
 lm32-*-uclinux*)
 extra_parts=$extra_parts crtbegin.o crtendS.o crtbeginT.o
 tmake_file=lm32/t-lm32 lm32/t-uclinux t-libgcc-pic t-softfp-sfdf t-softfp
@@ -683,7 +688,7 @@ m32r-*-elf*)
 	tmake_file=t-fdpbit
  	;;
 m32r-*-rtems*)
-	tmake_file=m32r/t-m32r t-fdpbit
+	tmake_file=$tmake_file m32r/t-m32r t-fdpbit
 	;;
 m32rle-*-elf*)
 	tmake_file=t-fdpbit
@@ -815,7 +820,7 @@ moxie-*-elf | moxie-*-uclinux*)
 	extra_parts=$extra_parts crti.o crtn.o
 	;;
 moxie-*-rtems*)
-	tmake_file=moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp
+	tmake_file=$tmake_file moxie/t-moxie t-softfp-sfdf t-softfp-excl t-softfp
 	# Don't use default.
 	extra_parts=
 	;;
@@ -1025,7 +1030,7 @@ sparc-*-linux*)		# SPARC's running GNU/L
 	md_unwind_header=sparc/linux-unwind.h
 	;;
 sparc-*-rtems*)
-	tmake_file=sparc/t-elf sparc/t-softmul t-crtfm t-rtems t-fdpbit
+	tmake_file=$tmake_file sparc/t-elf sparc/t-softmul t-crtfm t-fdpbit
 	extra_parts=$extra_parts crti.o crtn.o crtfastmath.o
 	;;
 sparc*-*-solaris2*)
@@ -1038,7 +1043,7 @@ sparc64-*-elf*)
 	extra_parts=$extra_parts crti.o crtn.o crtfastmath.o
 	;;
 sparc64-*-rtems*)
-	tmake_file=sparc/t-elf t-crtfm t-rtems
+	tmake_file=$tmake_file sparc/t-elf t-crtfm
 	extra_parts=$extra_parts crti.o crtn.o crtfastmath.o
 	;;
 sparc-wrs-vxworks)
diff --git a/libgcc/config/t-rtems b/libgcc/config/t-rtems
--- a/libgcc/config/t-rtems
+++ b/libgcc/config/t-rtems
@@ -1,4 +1,4 @@
 # If we are building next to newlib, this will let us find the RTEMS
 # limits.h when building libgcc2.  Otherwise, newlib must be installed
 # first.
-HOST_LIBGCC2_CFLAGS = -I$(srcdir)/../newlib/libc/sys/rtems/include
+LIBGCC2_INCLUDES = -I$(srcdir)/../newlib/libc/sys/rtems/include

2011-11-06  Rainer Orth  r...@cebitec.uni-bielefeld.de

libgcc:
* config.host (tmake_file): 

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

2011-11-07 Thread Paolo Bonzini

On 11/07/2011 06:01 PM, Rainer Orth wrote:

Ok for mainline?


Ok, thanks.

Paolo


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

2011-11-04 Thread Rainer Orth
Matthias Klose d...@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-2003/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, Center for Biotechnology, Bielefeld University


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

2011-11-04 Thread Rainer Orth
Matthias Klose d...@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

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


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

2011-11-04 Thread Matthias Klose
On 11/04/2011 10:58 AM, Rainer Orth wrote:
 Matthias Klose d...@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


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

2011-11-04 Thread Paolo Bonzini
On 11/04/2011 04:59 PM, Matthias Klose wrote:
 On 11/04/2011 10:58 AM, Rainer Orth wrote:
 Matthias Klosed...@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


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

2011-11-04 Thread Rainer Orth
Paolo Bonzini bonz...@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

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


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

2011-11-04 Thread Paolo Bonzini
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


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

2011-11-04 Thread Rainer Orth
Paolo Bonzini bonz...@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

-- 
-
Rainer Orth, Center for Biotechnology, Bielefeld University


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

2011-11-04 Thread Paolo Bonzini

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


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

2011-11-03 Thread Ramana Radhakrishnan
.

 Ok for mainline?

This is OK.

Ramana


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

2011-11-03 Thread Paolo Bonzini

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