Bug 67788 - [6 Regression] bootstrap failure in libgfortran on powerpc-linux-gnu
Summary: [6 Regression] bootstrap failure in libgfortran on powerpc-linux-gnu
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Segher Boessenkool
URL:
Keywords:
Depends on:
Blocks: 67789
  Show dependency treegraph
 
Reported: 2015-09-30 17:53 UTC by Matthias Klose
Modified: 2015-10-02 06:00 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-09-30 00:00:00


Attachments
preprocessed source (16.20 KB, application/gzip)
2015-09-30 17:53 UTC, Matthias Klose
Details
preprocessed source (8.42 KB, application/gzip)
2015-09-30 17:53 UTC, Matthias Klose
Details
rtl dumps (773.28 KB, application/gzip)
2015-09-30 19:15 UTC, Matthias Klose
Details
preprocessed source (10.48 KB, application/gzip)
2015-09-30 21:17 UTC, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2015-09-30 17:53:00 UTC
Created attachment 36424 [details]
preprocessed source

seen with trunk 20150930, 

/home/doko/gcc/gcc-snapshot-20150930/build/./gcc/xgcc -B/home/doko/gcc/gcc-snapshot-20150930/build/./gcc/ -B/usr/lib/gcc-snapshot/powerpc-linux-gnu/bin/ -B/usr/lib/gcc-snapshot/powerpc-linux-gnu/lib/ -isystem /usr/lib/gcc-snapshot/powerpc-linux-gnu/include -isystem /usr/lib/gcc-snapshot/powerpc-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I../../../src/libgfortran -iquote../../../src/libgfortran/io -I../../../src/libgfortran/../gcc -I../../../src/libgfortran/../gcc/config -I../.././gcc -I../../../src/libgfortran/../libgcc -I../libgcc -I../../../src/libgfortran/../libbacktrace -I../libbacktrace -I../libbacktrace -std=gnu11 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -Werror=implicit-function-declaration -Werror=vla -fcx-fortran-rules -ffunction-sections -fdata-sections -g -O2 -MT fpu.lo -MD -MP -MF .deps/fpu.Tpo -c ../../../src/libgfortran/runtime/fpu.c  -fPIC -DPIC -o .libs/fpu.o -save-temps
fpu.s: Assembler messages:
fpu.s:736: Error: symbol `.L148' is already defined
fpu.s:781: Error: symbol `.L148' is already defined

I Also saw this building gzlib.so in zlib.

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 20150930-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-snap-powerpc --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-snap-powerpc --with-arch-directory=ppc --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-secureplt --disable-softfloat --with-cpu=default32 --disable-softfloat --enable-targets=powerpc-linux,powerpc64-linux --enable-multiarch --disable-werror --with-long-double-128 --enable-multilib --enable-checking=yes --build=powerpc-linux-gnu --host=powerpc-linux-gnu --target=powerpc-linux-gnu

binutils version is 2.25.1
Comment 1 Matthias Klose 2015-09-30 17:53:23 UTC
Created attachment 36425 [details]
preprocessed source
Comment 2 Segher Boessenkool 2015-09-30 19:01:53 UTC
Hi!

I cannot reproduce the problem; could you email me the relevant
dump files?  Or just everything -da produces.
Comment 3 Matthias Klose 2015-09-30 19:15:46 UTC
Created attachment 36426 [details]
rtl dumps
Comment 4 Matthias Klose 2015-09-30 21:17:22 UTC
Created attachment 36429 [details]
preprocessed source
Comment 5 Segher Boessenkool 2015-09-30 21:30:49 UTC
Okay, I can reproduce the problem now (-m32 -fPIC -msecure-plt).

The problem is that load_toc_v4_PIC_1_normal (and friends)
create the asm label manually.
Comment 6 Segher Boessenkool 2015-10-02 01:29:58 UTC
Author: segher
Date: Fri Oct  2 01:29:26 2015
New Revision: 228366

URL: https://gcc.gnu.org/viewcvs?rev=228366&root=gcc&view=rev
Log:
rs6000: Add "cannot_copy" attribute, use it (PR67788, PR67789)

After the shrink-wrapping patches the prologue will often be pushed
"deeper" into the function, which in turn means the software trace cache
pass will more often want to duplicate the basic block containing the
prologue.  This caused failures for 32-bit SVR4 with -msecure-plt PIC.

This configuration uses the load_toc_v4_PIC_1 instruction, which creates
assembler labels without using the normal machinery for that.  If now
the compiler decides to duplicate the insn, it will emit the same label
twice.  Boom.

It isn't so easy to fix this to use labels the compiler knows about (let
alone test that properly).  Instead, this patch wires up a "cannot_copy"
attribute to be used by TARGET_CANNOT_COPY_P, and sets that attribute on
these insns we do not want copied.


2015-10-01  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/67788
	PR target/67789
	* config/rs6000/rs6000.c (TARGET_CANNOT_COPY_INSN_P): New.
	(rs6000_cannot_copy_insn_p): New function.
	* config/rs6000/rs6000.md (cannot_copy): New attribute.
	(load_toc_v4_PIC_1_normal): Set cannot_copy.
	(load_toc_v4_PIC_1_476): Ditto.

gcc/testsuite/
	PR target/67788
	PR target/67789
	* gcc.target/powerpc/pr67789.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/powerpc/pr67789.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/rs6000/rs6000.md
    trunk/gcc/testsuite/ChangeLog
Comment 7 Segher Boessenkool 2015-10-02 06:00:02 UTC
Fixed.