[Bug c++/56287] New: __do_global_ctors_aux() crashing when LTO enabled with flto-partition=none

honyakeprt at centrum dot cz gcc-bugzilla@gcc.gnu.org
Mon Feb 11 14:59:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56287

             Bug #: 56287
           Summary: __do_global_ctors_aux() crashing when LTO enabled with
                    flto-partition=none
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: honyakeprt@centrum.cz


Hi,

I am using gcc 4.7.2 under cygwin
Using built-in specs.
COLLECT_GCC=./powerpc-unknown-eabi-gcc-4.7.2
COLLECT_LTO_WRAPPER=/home/JKe/cross/libexec/gcc/powerpc-unknown-eabi/4.7.2/lto-w
rapper.exe
Target: powerpc-unknown-eabi
Configured with: .......
Tmp/cross-toolchain-mpc8xx-eabi-tmp/gcc-4.7.2/configure
--enable-languages=c,c++ --config-cache --prefix=/h
ome/JKe/cross --target=powerpc-unknown-eabi --with-cpu=860 --without-fp
--with-f
loat=soft --disable-nls --disable-shared --disable-libssp --disable-libgomp
--di
sable-libmudflap --disable-libquadmath --disable-multilib
--disable-decimal-floa
t --disable-fixed-point --enable-threads=posix --with-newlib --with-gnu-ld
--wit
h-gnu-as --enable-lto
Thread model: posix
gcc version 4.7.2 (GCC)


when I enable compilation/linking with LTO partitioning NONE, the .ctors
constructor table gets somehow damaged. The symbol __CTOR_END__ points before
the __CTOR_LIST__!!! Therefore the __do_global_ctors_aux() function is
crashing.

Here is an example:
Compiler flags : -O2 -flto -fdata-sections -ffunction-sections
-mno-strict-align -g3 -Wall -Wpointer-arith -Wwrite-strings -Wunused-parameter
-Wextra -DHAVE_SNPRINTF  -Wformat -Wformat-security -fcheck-new
-Wnon-virtual-dtor -Wctor-dtor-privacy -mno-relocatable -mno-relocatable-lib
-mcpu=860 -meabi -msdata=sysv -fno-exceptions

A) Crashing configuration

Linker flags: -Wl,--gc-sections -Wl,-flto=jobserver -flto-partition=none -O2 
-static

.ctor table from .map file
**************************
.ctors          0x00186950       0x14
 *crtbegin.o(.ctors)
 *crtbegin?.o(.ctors)
 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
 .ctors         0x00186950        0x0
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrti.o
                0x00186950                __CTOR_LIST__
 .ctors         0x00186950        0xc
/cygdrive/c/Users/JKe/AppData/Local/Temp/ccT7Msbu.lto.o
 .ctors         0x0018695c        0x4
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_alloc.o)
 .ctors         0x00186960        0x4
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_globals.o)
 .ctors         0x00186964        0x0
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrtn.o
                0x00186964                __CTOR_END__
 *(SORT(.ctors.*))
 *(.ctors)

__CTOR Symbols using objdump tool (note that local are used in reality)
*********************************
00186958 l     O .ctors    00000004 __CTOR_LIST__.1431
00186954 l     O .ctors    00000004 __CTOR_END__.585871
00186950 g     O .ctors    00000000 __CTOR_LIST__
00186964 g     O .ctors    00000000 __CTOR_END__



B) Not crashing configuration (using default LTO partitioning)

Linker flags: -Wl,--gc-sections -Wl,-flto=jobserver -O2  -static

.ctor table from .map file
**************************
.ctors          0x00187a70       0x14
 *crtbegin.o(.ctors)
 *crtbegin?.o(.ctors)
 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
 .ctors         0x00187a70        0x0
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrti.o
                0x00187a70                __CTOR_LIST__
 .ctors         0x00187a70        0x4
/cygdrive/c/Users/JKe/AppData/Local/Temp/ccYYi7V7.ltrans24.ltrans.o
 .ctors         0x00187a74        0x8
/cygdrive/c/Users/JKe/AppData/Local/Temp/ccYYi7V7.ltrans25.ltrans.o
 .ctors         0x00187a7c        0x4
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_alloc.o)
 .ctors         0x00187a80        0x4
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/../../../../powerpc-unknown-eabi/lib/libstdc++.a(eh_globals.o)
 .ctors         0x00187a84        0x0
/home/JKe/cross/lib/gcc/powerpc-unknown-eabi/4.7.2/ecrtn.o
                0x00187a84                __CTOR_END__
 *(SORT(.ctors.*))
 *(.ctors)

__CTOR Symbols using objdump tool (note that local are used in reality)
*********************************
00187a70 l     O .ctors    00000004 __CTOR_LIST__.1431.20271
00187a78 l     O .ctors    00000004 __CTOR_END__.603481.26462
00187a70 g     O .ctors    00000000 __CTOR_LIST__
00187a84 g     O .ctors    00000000 __CTOR_END__



More information about the Gcc-bugs mailing list