public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 971225: bootstrap fails on powerpc-unknown-linux-gnu*
@ 1998-01-03 10:30 Franz Sirl
  1998-01-29 14:41 ` PATCH: " Franz Sirl
  0 siblings, 1 reply; 7+ messages in thread
From: Franz Sirl @ 1998-01-03 10:30 UTC (permalink / raw)
  To: egcs

Hi,

bootstrapping 971225 on powerpc-unknown-linux-gnu and
powerpc-unknown-linux-gnulibc1 with binutils-2.8.1.0.18 results in the
following assembler faults:

make[2]: [objc.stage1] Error 1 (ignored)
make[2]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
make CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -g -O2" LDFLAGS=""
libdir=/usr/lib STAGE_PREFIX=stage1/ LANGUAGES="c c++ objc"
make[2]: Entering directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
stage1/xgcc -Bstage1/  -DIN_GCC    -O2 -g -O2  -DHAVE_CONFIG_H     -I.
-I../../gcc -I../../gcc/config \

-DGCC_INCLUDE_DIR=\"/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.03/incl
ude\" \
  -DGPLUSPLUS_INCLUDE_DIR=\"/usr/include/g++\" \
  -DOLD_GPLUSPLUS_INCLUDE_DIR=\"/usr/lib/g++-include\" \
  -DLOCAL_INCLUDE_DIR=\"/usr/local/include\" \

-DCROSS_INCLUDE_DIR=\"/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.03/sy
s-include\" \
  -DTOOL_INCLUDE_DIR=\"/usr/powerpc-unknown-linux-gnu/include\" \
  -c `echo ../../gcc/cccp.c | sed 's,^\./,,'`
/tmp/cca11119.s: Assembler messages:
/tmp/cca11119.s:17477: Error: Can't emit reloc {- .rodata-seg symbol
".L3580"} @ file address 31162.
/tmp/cca11119.s:17478: Error: Can't emit reloc {- .rodata-seg symbol
".L3580"} @ file address 31166.
make[2]: *** [cccp.o] Error 1
make[2]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
make: *** [bootstrap] Error 2

The corresponding section of the .s file says:

.LM2350:
	bc 12,2,.L3563
	mr 20,11
	addis 11,0,.L3573-.L3580@ha
	addi 11,11,.L3573-.L3580@l
	addis 9,0,.L3580@ha
	addi 9,9,.L3580@l
	add 19,9,11
	li 25,0
	li 22,10
	li 23,0
	addis 24,0,.LC85+2@ha
	addi 27,24,.LC85+2@l
	addis 21,0,stdout@ha

You can find the full cccp.[is] files at
< http://homepages.munich.netsurf.de/Franz.Sirl/misc >.

Bye,
Franz.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu*
  1998-01-03 10:30 971225: bootstrap fails on powerpc-unknown-linux-gnu* Franz Sirl
@ 1998-01-29 14:41 ` Franz Sirl
  1998-01-29 19:57   ` Geoffrey KEATING
  1998-02-01 13:18   ` Jeffrey A Law
  0 siblings, 2 replies; 7+ messages in thread
From: Franz Sirl @ 1998-01-29 14:41 UTC (permalink / raw)
  To: egcs; +Cc: Geoffrey KEATING, Michael Meissner

Hi,

the reported bootstrap fail on Linux/PPC was introduced in rev. 1.3 of
rs6000/sysv4.h by a #undef JUMP_TABLES_IN_TEXT_SECTION. linux.h includes
sysv4.h but didn't override the change.
Eventually this hides a bug in binutils?

Bye,
Franz.


Tue Jan 29 22:44:00 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
	* rs6000/linux.h: define JUMP_TABLES_IN_TEXT_SECTION

--- linux.h-org	Tue Jan 27 23:46:50 1998
+++ linux.h	Thu Jan 29 15:35:21 1998
@@ -65,3 +65,6 @@

 #undef DEFAULT_VTABLE_THUNKS
 #define DEFAULT_VTABLE_THUNKS 1
+
+#undef JUMP_TABLES_IN_TEXT_SECTION
+#define JUMP_TABLES_IN_TEXT_SECTION


At 18:30 Uhr -0000 03.01.1998, Franz Sirl wrote:
>Hi,
>
>bootstrapping 971225 on powerpc-unknown-linux-gnu and
>powerpc-unknown-linux-gnulibc1 with binutils-2.8.1.0.18 results in the
>following assembler faults:
>
>make[2]: [objc.stage1] Error 1 (ignored)
>make[2]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
>make CC="stage1/xgcc -Bstage1/" CFLAGS="-O2 -g -O2" LDFLAGS=""
>libdir=/usr/lib STAGE_PREFIX=stage1/ LANGUAGES="c c++ objc"
>make[2]: Entering directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
>stage1/xgcc -Bstage1/  -DIN_GCC    -O2 -g -O2  -DHAVE_CONFIG_H     -I.
>-I../../gcc -I../../gcc/config \
>
>-DGCC_INCLUDE_DIR=\"/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.03/inc
>l
>ude\" \
>  -DGPLUSPLUS_INCLUDE_DIR=\"/usr/include/g++\" \
>  -DOLD_GPLUSPLUS_INCLUDE_DIR=\"/usr/lib/g++-include\" \
>  -DLOCAL_INCLUDE_DIR=\"/usr/local/include\" \
>
>-DCROSS_INCLUDE_DIR=\"/usr/lib/gcc-lib/powerpc-unknown-linux-gnu/egcs-2.91.03/s
>y
>s-include\" \
>  -DTOOL_INCLUDE_DIR=\"/usr/powerpc-unknown-linux-gnu/include\" \
>  -c `echo ../../gcc/cccp.c | sed 's,^\./,,'`
>/tmp/cca11119.s: Assembler messages:
>/tmp/cca11119.s:17477: Error: Can't emit reloc {- .rodata-seg symbol
>".L3580"} @ file address 31162.
>/tmp/cca11119.s:17478: Error: Can't emit reloc {- .rodata-seg symbol
>".L3580"} @ file address 31166.
>make[2]: *** [cccp.o] Error 1
>make[2]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
>make[1]: *** [bootstrap] Error 2
>make[1]: Leaving directory `/sda9/src/e/egcs-971207/b-971225-2/gcc'
>make: *** [bootstrap] Error 2
>
>The corresponding section of the .s file says:
>
>.LM2350:
>	bc 12,2,.L3563
>	mr 20,11
>	addis 11,0,.L3573-.L3580@ha
>	addi 11,11,.L3573-.L3580@l
>	addis 9,0,.L3580@ha
>	addi 9,9,.L3580@l
>	add 19,9,11
>	li 25,0
>	li 22,10
>	li 23,0
>	addis 24,0,.LC85+2@ha
>	addi 27,24,.LC85+2@l
>	addis 21,0,stdout@ha
>
>You can find the full cccp.[is] files at
>< http://homepages.munich.netsurf.de/Franz.Sirl/misc >.
>
>Bye,
>Franz.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu*
  1998-01-29 14:41 ` PATCH: " Franz Sirl
@ 1998-01-29 19:57   ` Geoffrey KEATING
  1998-02-01 13:18   ` Jeffrey A Law
  1 sibling, 0 replies; 7+ messages in thread
From: Geoffrey KEATING @ 1998-01-29 19:57 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs, Geoffrey KEATING, Michael Meissner

> Date: Fri, 30 Jan 1998 09:23:30 +1100 (EST)
> From: Franz Sirl <Franz.Sirl-kernel@lauterbach.com>

> the reported bootstrap fail on Linux/PPC was introduced in rev. 1.3 of
> rs6000/sysv4.h by a #undef JUMP_TABLES_IN_TEXT_SECTION. linux.h includes
> sysv4.h but didn't override the change.
> Eventually this hides a bug in binutils?

OK.  I see what has happened.

The problem is the ever-popular 'switch folding' problem.  At present,
egcs doesn't properly fold switch statements on powerpc.  Normally
[ie. in egcs 1.0.1], switch statements look like this:

# load the address of the jump table
	addis 9,0,.L3580@ha
	addi 9,9,.L3580@l
# add an offset (calculated earlier from the index to the 'switch'),
# load it into the count register & jump.
	lwzx 9,11,9
	mtctr  9
	bctr
# the actual table (in .text section, yuk!)
.L3580:
	.long .Lsomething
	.long .Lsomethingelse
	.long .L3573
	...

.L3573:	some code

The JUMP_TABLES_IN_TEXT_SECTION change put the table in .rodata.

Now, when the 'offset' is constant, egcs partially folds the switch
statement, like this:

# load offset (not the offset of the offset :-)
	addis 11,0,.L3573-.L3580@ha
	addi 11,11,.L3573-.L3580@l
	addis 9,0,.L3580@ha
	addi 9,9,.L3580@l
	addi 11,9,11
	mtctr 9
	bctr

# ... and generates a superfluous table, because it uses the label at
# the start :-(
.L3580:
	.long .Lsomething
	.long .Lsomethingelse
	.long L3573
	...

.L3573:	some code


That used to be fine; the assembler knows where everything is, and can
calculate '.L3573-.L3580' at assembly time.  But if the table is in
.rodata, the assembler doesn't know where .rodata is in relation to
the code, and ELF can't express the difference of two arbitrary
symbols; so the assembler complains, with possibly one of its less
clear error messages :-).

Certainly, egcs should put the jump tables in .rodata; this bit is
correct.

The general solution to this is to fix the switch folding.  I don't
know enough about that part of gcc to do it.  Any ideas?


If someone wants a shorter test case, you can see it in this:

void foo (char *s)
{
  for (;;)
    {
      int t = 6;
      switch (t)
        {
        case 2:
          *s = '2';
        case 6: case 4: case 3: case 1:
          break;
        }
    }
}

which is the all-purpose test case for switch statement folding :-).

--
Geoff Keating <Geoff.Keating@anu.edu.au>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu*
  1998-01-29 14:41 ` PATCH: " Franz Sirl
  1998-01-29 19:57   ` Geoffrey KEATING
@ 1998-02-01 13:18   ` Jeffrey A Law
  1998-02-01 15:35     ` PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu* Franz Sirl
  1 sibling, 1 reply; 7+ messages in thread
From: Jeffrey A Law @ 1998-02-01 13:18 UTC (permalink / raw)
  To: Franz Sirl; +Cc: egcs, Geoffrey KEATING, Michael Meissner

  In message <v03130302b0f6b969485c@[195.180.235.165]>you write:
  > Hi,
  > 
  > the reported bootstrap fail on Linux/PPC was introduced in rev. 1.3 of
  > rs6000/sysv4.h by a #undef JUMP_TABLES_IN_TEXT_SECTION. linux.h includes
  > sysv4.h but didn't override the change.
  > Eventually this hides a bug in binutils?
  > 
  > Bye,
  > Franz.
  > 
  > 
  > Tue Jan 29 22:44:00 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
  > 	* rs6000/linux.h: define JUMP_TABLES_IN_TEXT_SECTION
Thanks.  I installed this patch.

As Geoffrey noted, the real problem is how we handle switch tables
in general.  I ran into the same group of problems when trying to
change the PA port from using an indexed jump into jumps to case
labels.  We had something like this:

start of tablejump insn
	blr
	nop
start of ADDR_VEC insn
	jmp case1
	nop
	jmp case2
	nop
	jmp case3



What I wanted to do was a more traditional scheme where either offsets 
or actual locations are kept as a table (it's the first step towards
a much more branch prediction friendly tablejump on the PA).

On the PA it is absolutely necessary to never mix data into a code
section.  So these tables needed to go into readonly data...  And
bang I ran into the same problems y'all are running into.

I banged my head on the wall for about an hour or so trying to find
an easy solution and just gave up when I realized that some fundamental
changes in our switch/tablejump code would be necessary to make it
work.

jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu*
  1998-02-01 13:18   ` Jeffrey A Law
@ 1998-02-01 15:35     ` Franz Sirl
  1998-02-01 16:05       ` PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu* David Edelsohn
  0 siblings, 1 reply; 7+ messages in thread
From: Franz Sirl @ 1998-02-01 15:35 UTC (permalink / raw)
  To: law; +Cc: egcs, Geoffrey KEATING, Michael Meissner

At 21:20 Uhr -0000 01.02.1998, Jeffrey A Law wrote:
>  In message <v03130302b0f6b969485c@[195.180.235.165]>you write:
>  > Hi,
>  >
>  > the reported bootstrap fail on Linux/PPC was introduced in rev. 1.3 of
>  > rs6000/sysv4.h by a #undef JUMP_TABLES_IN_TEXT_SECTION. linux.h includes
>  > sysv4.h but didn't override the change.
>  > Eventually this hides a bug in binutils?
>  >
>  > Bye,
>  > Franz.
>  >
>  >
>  > Tue Jan 29 22:44:00 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
>  > 	* rs6000/linux.h: define JUMP_TABLES_IN_TEXT_SECTION
>Thanks.  I installed this patch.
>
>As Geoffrey noted, the real problem is how we handle switch tables
>in general.  I ran into the same group of problems when trying to
>change the PA port from using an indexed jump into jumps to case
>labels.  We had something like this:
>
>start of tablejump insn
>	blr
>	nop
>start of ADDR_VEC insn
>	jmp case1
>	nop
>	jmp case2
>	nop
>	jmp case3
>
>
>
>What I wanted to do was a more traditional scheme where either offsets
>or actual locations are kept as a table (it's the first step towards
>a much more branch prediction friendly tablejump on the PA).
>
>On the PA it is absolutely necessary to never mix data into a code
>section.  So these tables needed to go into readonly data...  And
>bang I ran into the same problems y'all are running into.
>
>I banged my head on the wall for about an hour or so trying to find
>an easy solution and just gave up when I realized that some fundamental
>changes in our switch/tablejump code would be necessary to make it
>work.

So this probably means it will take a while til this is really fixed
(Please avoid further headbanging, we all need you ;-)).
Probably Geoff's example should be converted to a test case.

All-in-all egcs (both 1.0.1 and current cvs) seems to be very stable on
powerpc-unknown-linux-gnu.

The problems remaining AFAIK:
- spill register problems
- switch statement (partially fixed by Geoff's unofficial patch)
- out-of-memory while compiling lynx-2-7-2 on my 40MB+128MBswap machine
(haven't investigated that further yet)
- the optimizer problems mentioned by Gary Thomas
- a problem with inlining (eg. glibc/linuxthreads/condvar.c)

Bye,
Franz.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu*
  1998-02-01 15:35     ` PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu* Franz Sirl
@ 1998-02-01 16:05       ` David Edelsohn
  1998-02-08 15:56         ` PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu* Franz Sirl
  0 siblings, 1 reply; 7+ messages in thread
From: David Edelsohn @ 1998-02-01 16:05 UTC (permalink / raw)
  To: Franz Sirl; +Cc: law, egcs, Geoffrey KEATING, Michael Meissner

>>>>> Franz Sirl writes:

Franz> The problems remaining AFAIK:
Franz> - spill register problems

	If you mean mentioning clobbered registers by name sometimes
evoking a fatal error from reload about spilling a forbidden register,
that is a general problem.  I thought you and I and Joern all agreed that
providing an inline assembly equivalent of a scratch register for a
register class, as used in MD files, was the appropriate solution.  Simply
converting named clobbered registers who are lone members of a register
class into a scratch of that same class seems the most direct and
least-intrusive method.  I do not know enough about that aspect of GCC to
impliment such a solution.

Franz> - the optimizer problems mentioned by Gary Thomas

	Problems?  Plural?  I believe from Gary's messages referred to a
JUMP / CSE problem with respect to duplicate_loop_exit() code.  I do not
believe the problem is in jump.c itself but I have not had a chance to
track down why CSE is breaking.  If someone would help perform the
analysis of CSE to find the location of the bug -- even without providing
a patch -- that probably would help those who can fix it narrow down the
location and develop a proper patch.  Even the initial location may be
incorrect, but someone with knowledge of CSE could then track it back to
the true source of the mistaken assumption.

David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu*
  1998-02-01 16:05       ` PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu* David Edelsohn
@ 1998-02-08 15:56         ` Franz Sirl
  0 siblings, 0 replies; 7+ messages in thread
From: Franz Sirl @ 1998-02-08 15:56 UTC (permalink / raw)
  To: David Edelsohn; +Cc: law, egcs, Geoffrey KEATING, Michael Meissner

Hi David,

the problems I mentioned only presented my personal status for egcs and PPC
and I didn't meant to offend anyone. From my experience with other
mailinglists I found it quite handy if someone presented a short summary of
known problems or a TODO-list from time to time.

I really appreciate the work you all are doing.

Bye,
Franz.

At 0:05 Uhr -0000 02.02.1998, David Edelsohn wrote:
>>>>>> Franz Sirl writes:
>
>Franz> The problems remaining AFAIK:
>Franz> - spill register problems
>
>	If you mean mentioning clobbered registers by name sometimes
>evoking a fatal error from reload about spilling a forbidden register,
>that is a general problem.  I thought you and I and Joern all agreed that
>providing an inline assembly equivalent of a scratch register for a
>register class, as used in MD files, was the appropriate solution.  Simply
>converting named clobbered registers who are lone members of a register
>class into a scratch of that same class seems the most direct and
>least-intrusive method.  I do not know enough about that aspect of GCC to
>impliment such a solution.
>
>Franz> - the optimizer problems mentioned by Gary Thomas
>
>	Problems?  Plural?  I believe from Gary's messages referred to a
>JUMP / CSE problem with respect to duplicate_loop_exit() code.  I do not
>believe the problem is in jump.c itself but I have not had a chance to
>track down why CSE is breaking.  If someone would help perform the
>analysis of CSE to find the location of the bug -- even without providing
>a patch -- that probably would help those who can fix it narrow down the
>location and develop a proper patch.  Even the initial location may be
>incorrect, but someone with knowledge of CSE could then track it back to
>the true source of the mistaken assumption.
>
>David




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1998-02-08 15:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-01-03 10:30 971225: bootstrap fails on powerpc-unknown-linux-gnu* Franz Sirl
1998-01-29 14:41 ` PATCH: " Franz Sirl
1998-01-29 19:57   ` Geoffrey KEATING
1998-02-01 13:18   ` Jeffrey A Law
1998-02-01 15:35     ` PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu* Franz Sirl
1998-02-01 16:05       ` PATCH: Re: 971225: bootstrap fails on powerpc-unknown-linux-gnu* David Edelsohn
1998-02-08 15:56         ` PATCH: Re: 971225: bootstrap fails onpowerpc-unknown-linux-gnu* Franz Sirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).