[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2018-02-01 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35179

Eric Gallager  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #9 from Eric Gallager  ---
(In reply to Eric Gallager from comment #8)
> (In reply to Eric Gallager from comment #7)
> > (In reply to Radu Hociung from comment #6)
> > > Comment on attachment 17939 [details]
> > > Improved hello-test case showing working and failing command lines, with
> > > Makefile
> > > 
> > > Works as expected:
> > > gcc -g -o hello-exec hellomain.o -L. -lhello
> > > 
> > > Triggers the bug:
> > > gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L. -lhello 
> > > -v
> > 
> > Testcase fails to link for me on Darwin due to a difference in linkers:
> > 
> > $ make hello-exec-gccbug35179
> > /usr/local/bin/gcc -o hellomain.o -c -g hellomain.c 
> > hellomain.c: In function ‘main’:
> > hellomain.c:9:2: warning: implicit declaration of function ‘exit’
> > [-Wimplicit-function-declaration]
> >   exit(0);
> >   ^~~~
> > hellomain.c:9:2: warning: incompatible implicit declaration of built-in
> > function ‘exit’
> > hellomain.c:9:2: note: include ‘’ or provide a declaration of
> > ‘exit’
> > /usr/local/bin/gcc -o hello_.o -g -c -fpic -DPIC hello.c 
> > /usr/local/bin/gcc -o libhello.so -shared -g hello_.o 
> > echo Linking with both -static and -shared flags exposes the bug.
> > Linking with both -static and -shared flags exposes the bug.
> > /usr/local/bin/gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared
> > -L. -lhello -v 
> > Using built-in specs.
> > COLLECT_GCC=/usr/local/bin/gcc
> > COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/lto-
> > wrapper
> > Target: i386-apple-darwin9.8.0
> > Configured with: ../configure --disable-werror --disable-werror-always
> > --enable-languages=c,c++,lto,objc,obj-c++
> > --enable-stage1-checking=release,rtl -C --with-system-libunwind
> > --enable-secureplt --enable-frame-pointer --enable-debug --with-isl
> > --disable-host-shared --enable-maintainer-mode --disable-default-pie
> > --with-ld64 --without-pic --enable-target-optspace CC=/usr/local/bin/gcc
> > CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf
> > AUTOHEADER=/usr/local/bin/autoheader AUTORECONF=/usr/local/bin/autoreconf
> > AUTOM4TE=/usr/local/bin/autom4te AUTOSCAN=/usr/local/bin/autoscan
> > AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames
> > Thread model: posix
> > gcc version 8.0.0 20170702 (experimental) (GCC) 
> > COMPILER_PATH=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/
> > local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/libexec/gcc/i386-
> > apple-darwin9.8.0/:/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/
> > local/lib/gcc/i386-apple-darwin9.8.0/
> > LIBRARY_PATH=/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/lib/
> > gcc/i386-apple-darwin9.8.0/8.0.0/../../../
> > COLLECT_GCC_OPTIONS='-g' '-static' '-o' 'hello-exec-gccbug35179'  '-L.' '-v'
> > '-mmacosx-version-min=10.5.8' '-asm_macosx_version_min=10.5' '-mtune=core2'
> > '-Zdynamiclib'
> >  /usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/collect2 -static -dylib
> > -arch i386 -macosx_version_min 10.5.8 -weak_reference_mismatches non-weak -o
> > hello-exec-gccbug35179 -ldylib1.10.5.o -L.
> > -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
> > -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o
> > -lhello -lgcc_eh -lgcc -v -idsym
> > collect2 version 8.0.0 20170702 (experimental)
> > /usr/bin/ld -static -dylib -arch i386 -macosx_version_min 10.5.8
> > -weak_reference_mismatches non-weak -o hello-exec-gccbug35179
> > -ldylib1.10.5.o -L. -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
> > -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o
> > -lhello -lgcc_eh -lgcc -v
> > Apple Computer, Inc. version cctools-698.1~1
> > ld_classic: incompatible flag -dylib used (must specify "-dynamic" to be
> > used)
> > collect2: error: ld returned 1 exit status
> > make: *** [hello-exec-gccbug35179] Error 1
> > $
> > 
> > Someone running GNU/Linux will have to try the testcase to move this out of
> > WAITING.
> 
> Now that I have access to the GCC compile farm, the testcase still fails on
> me when I try it there:

"fails" as in "doesn't link" before it even gets to the crashes part. I guess
since it's been in WAITING with no response for so long I'll close this as
INVALID.

[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2017-11-01 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35179

--- Comment #8 from Eric Gallager  ---
(In reply to Eric Gallager from comment #7)
> (In reply to Radu Hociung from comment #6)
> > Comment on attachment 17939 [details]
> > Improved hello-test case showing working and failing command lines, with
> > Makefile
> > 
> > Works as expected:
> > gcc -g -o hello-exec hellomain.o -L. -lhello
> > 
> > Triggers the bug:
> > gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L. -lhello -v
> 
> Testcase fails to link for me on Darwin due to a difference in linkers:
> 
> $ make hello-exec-gccbug35179
> /usr/local/bin/gcc -o hellomain.o -c -g hellomain.c 
> hellomain.c: In function ‘main’:
> hellomain.c:9:2: warning: implicit declaration of function ‘exit’
> [-Wimplicit-function-declaration]
>   exit(0);
>   ^~~~
> hellomain.c:9:2: warning: incompatible implicit declaration of built-in
> function ‘exit’
> hellomain.c:9:2: note: include ‘’ or provide a declaration of
> ‘exit’
> /usr/local/bin/gcc -o hello_.o -g -c -fpic -DPIC hello.c 
> /usr/local/bin/gcc -o libhello.so -shared -g hello_.o 
> echo Linking with both -static and -shared flags exposes the bug.
> Linking with both -static and -shared flags exposes the bug.
> /usr/local/bin/gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared
> -L. -lhello -v 
> Using built-in specs.
> COLLECT_GCC=/usr/local/bin/gcc
> COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/lto-
> wrapper
> Target: i386-apple-darwin9.8.0
> Configured with: ../configure --disable-werror --disable-werror-always
> --enable-languages=c,c++,lto,objc,obj-c++
> --enable-stage1-checking=release,rtl -C --with-system-libunwind
> --enable-secureplt --enable-frame-pointer --enable-debug --with-isl
> --disable-host-shared --enable-maintainer-mode --disable-default-pie
> --with-ld64 --without-pic --enable-target-optspace CC=/usr/local/bin/gcc
> CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf
> AUTOHEADER=/usr/local/bin/autoheader AUTORECONF=/usr/local/bin/autoreconf
> AUTOM4TE=/usr/local/bin/autom4te AUTOSCAN=/usr/local/bin/autoscan
> AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames
> Thread model: posix
> gcc version 8.0.0 20170702 (experimental) (GCC) 
> COMPILER_PATH=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/
> local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/libexec/gcc/i386-
> apple-darwin9.8.0/:/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/
> local/lib/gcc/i386-apple-darwin9.8.0/
> LIBRARY_PATH=/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/lib/
> gcc/i386-apple-darwin9.8.0/8.0.0/../../../
> COLLECT_GCC_OPTIONS='-g' '-static' '-o' 'hello-exec-gccbug35179'  '-L.' '-v'
> '-mmacosx-version-min=10.5.8' '-asm_macosx_version_min=10.5' '-mtune=core2'
> '-Zdynamiclib'
>  /usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/collect2 -static -dylib
> -arch i386 -macosx_version_min 10.5.8 -weak_reference_mismatches non-weak -o
> hello-exec-gccbug35179 -ldylib1.10.5.o -L.
> -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
> -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o
> -lhello -lgcc_eh -lgcc -v -idsym
> collect2 version 8.0.0 20170702 (experimental)
> /usr/bin/ld -static -dylib -arch i386 -macosx_version_min 10.5.8
> -weak_reference_mismatches non-weak -o hello-exec-gccbug35179
> -ldylib1.10.5.o -L. -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
> -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o
> -lhello -lgcc_eh -lgcc -v
> Apple Computer, Inc. version cctools-698.1~1
> ld_classic: incompatible flag -dylib used (must specify "-dynamic" to be
> used)
> collect2: error: ld returned 1 exit status
> make: *** [hello-exec-gccbug35179] Error 1
> $
> 
> Someone running GNU/Linux will have to try the testcase to move this out of
> WAITING.

Now that I have access to the GCC compile farm, the testcase still fails on me
when I try it there:

egallager@gcc12:~/hello-test$ make hello-exec-gccbug35179
/opt/cfarm/gcc-latest/bin/gcc -o hellomain.o -c -g hellomain.c 
hellomain.c: In function 'main':
hellomain.c:9:2: warning: implicit declaration of function 'exit'
[-Wimplicit-function-declaration]
  exit(0);
  ^~~~
hellomain.c:9:2: warning: incompatible implicit declaration of built-in
function 'exit'
hellomain.c:9:2: note: include '' or provide a declaration of 'exit'
/opt/cfarm/gcc-latest/bin/gcc -o hello_.o -g -c -fpic -DPIC hello.c 
/opt/cfarm/gcc-latest/bin/gcc -o libhello.so -shared -g hello_.o 
echo Linking with both -static and -shared flags exposes the bug.
Linking with both -static and -shared flags exposes the bug.
/opt/cfarm/gcc-latest/bin/gcc -g -static -o hello-exec-gccbug35179 hellomain.o
-shared -L. -lhello -v 
Using built-in specs.
COLLECT_GCC=/opt/cfarm/gcc-latest/bin/gcc
COLLECT_LTO_WRAPPER=/home/iulius/autobuild/bin/gcc-7.1.0/libexec/gcc/x86_64-pc-linux-gnu/7.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-7.1.0-src/configure

[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2017-08-01 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35179

Eric Gallager  changed:

   What|Removed |Added

 Target|i386-pc-solaris2.10 |i386-pc-solaris2.10,
   ||i486-linux-gnu
 CC||egallager at gcc dot gnu.org

--- Comment #7 from Eric Gallager  ---
(In reply to Radu Hociung from comment #6)
> Comment on attachment 17939 [details]
> Improved hello-test case showing working and failing command lines, with
> Makefile
> 
> Works as expected:
> gcc -g -o hello-exec hellomain.o -L. -lhello
> 
> Triggers the bug:
> gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L. -lhello -v

Testcase fails to link for me on Darwin due to a difference in linkers:

$ make hello-exec-gccbug35179
/usr/local/bin/gcc -o hellomain.o -c -g hellomain.c 
hellomain.c: In function ‘main’:
hellomain.c:9:2: warning: implicit declaration of function ‘exit’
[-Wimplicit-function-declaration]
  exit(0);
  ^~~~
hellomain.c:9:2: warning: incompatible implicit declaration of built-in
function ‘exit’
hellomain.c:9:2: note: include ‘’ or provide a declaration of ‘exit’
/usr/local/bin/gcc -o hello_.o -g -c -fpic -DPIC hello.c 
/usr/local/bin/gcc -o libhello.so -shared -g hello_.o 
echo Linking with both -static and -shared flags exposes the bug.
Linking with both -static and -shared flags exposes the bug.
/usr/local/bin/gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L.
-lhello -v 
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/lto-wrapper
Target: i386-apple-darwin9.8.0
Configured with: ../configure --disable-werror --disable-werror-always
--enable-languages=c,c++,lto,objc,obj-c++ --enable-stage1-checking=release,rtl
-C --with-system-libunwind --enable-secureplt --enable-frame-pointer
--enable-debug --with-isl --disable-host-shared --enable-maintainer-mode
--disable-default-pie --with-ld64 --without-pic --enable-target-optspace
CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++ AUTOCONF=/usr/local/bin/autoconf
AUTOHEADER=/usr/local/bin/autoheader AUTORECONF=/usr/local/bin/autoreconf
AUTOM4TE=/usr/local/bin/autom4te AUTOSCAN=/usr/local/bin/autoscan
AUTOUPDATE=/usr/local/bin/autoupdate IFNAMES=/usr/local/bin/ifnames
Thread model: posix
gcc version 8.0.0 20170702 (experimental) (GCC) 
COMPILER_PATH=/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/libexec/gcc/i386-apple-darwin9.8.0/:/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/lib/gcc/i386-apple-darwin9.8.0/
LIBRARY_PATH=/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/:/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../../
COLLECT_GCC_OPTIONS='-g' '-static' '-o' 'hello-exec-gccbug35179'  '-L.' '-v'
'-mmacosx-version-min=10.5.8' '-asm_macosx_version_min=10.5' '-mtune=core2'
'-Zdynamiclib'
 /usr/local/libexec/gcc/i386-apple-darwin9.8.0/8.0.0/collect2 -static -dylib
-arch i386 -macosx_version_min 10.5.8 -weak_reference_mismatches non-weak -o
hello-exec-gccbug35179 -ldylib1.10.5.o -L.
-L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
-L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o -lhello
-lgcc_eh -lgcc -v -idsym
collect2 version 8.0.0 20170702 (experimental)
/usr/bin/ld -static -dylib -arch i386 -macosx_version_min 10.5.8
-weak_reference_mismatches non-weak -o hello-exec-gccbug35179 -ldylib1.10.5.o
-L. -L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0
-L/usr/local/lib/gcc/i386-apple-darwin9.8.0/8.0.0/../../.. hellomain.o -lhello
-lgcc_eh -lgcc -v
Apple Computer, Inc. version cctools-698.1~1
ld_classic: incompatible flag -dylib used (must specify "-dynamic" to be used)
collect2: error: ld returned 1 exit status
make: *** [hello-exec-gccbug35179] Error 1
$

Someone running GNU/Linux will have to try the testcase to move this out of
WAITING.

[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2009-05-30 Thread radu dot gcc at ohmi dot org


--- Comment #5 from radu dot gcc at ohmi dot org  2009-05-31 01:52 ---
Created an attachment (id=17939)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17939action=view)
Improved hello-test case showing working and failing command lines, with
Makefile

This behaviour exists on Linux beam 2.6.22-15-server #1 SMP Wed Aug 20
19:08:24 UTC 2008 i686 GNU/Linux, running gcc version 4.1.3 20080308
(prerelease) (Ubuntu 4.1.2-21ubuntu1)

In my case, I found it accidentally, as there was a stray '-static' on the
command line, even though I was compiling a shared build. Removing '-static'
fixes the problem, but I did bang by head against the wall a couple of times
while looking for the problem.

The attached testcase shows how this bug is duplicated. It is the same testcase
submitted previously, but I added the '-static -shared' combo, as on my system
the original testcase did not reproduce the bug. The output from my run is:

gcc -o hellomain.o -c -g hellomain.c
hellomain.c: In function 'main':
hellomain.c:9: warning: incompatible implicit declaration of built-in function
'exit'
gcc -o hello_.o -g -c -fpic -DPIC hello.c
gcc -o libhello.so -shared -g hello_.o
gcc -g -o hello-exec hellomain.o -L. -lhello
echo Linking with both -static and -shared flags exposes the bug.
Linking with both -static and -shared flags exposes the bug.
gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L. -lhello -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20080308 (prerelease) (Ubuntu 4.1.2-21ubuntu1)
 /usr/lib/gcc/i486-linux-gnu/4.1.3/collect2 -m elf_i386 --hash-style=both
-shared -o hello-exec-gccbug35179
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crti.o
/usr/lib/gcc/i486-linux-gnu/4.1.3/crtbeginT.o -L.
-L/usr/lib/gcc/i486-linux-gnu/4.1.3 -L/usr/lib/gcc/i486-linux-gnu/4.1.3
-L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib -L/lib/../lib
-L/usr/lib/../lib hellomain.o -lhello --start-group -lgcc -lgcc_eh -lc
--end-group /usr/lib/gcc/i486-linux-gnu/4.1.3/crtendS.o
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crtn.o
./hello-exec
About to call hello!

Hello, World!
gdb -x gdb.run ./hello-exec-gccbug35179
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type show copying
and show warranty for details.
This GDB was configured as i486-linux-gnu...

Program received signal SIGSEGV, Segmentation fault.
0x8426 in __do_global_dtors_aux ()
Current language:  auto; currently asm
The program is running.  Exit anyway? (y or n) [answered Y; input not from
terminal]


-- 


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



[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2009-05-30 Thread radu dot gcc at ohmi dot org


--- Comment #6 from radu dot gcc at ohmi dot org  2009-05-31 01:55 ---
(From update of attachment 17939)
Works as expected:
gcc -g -o hello-exec hellomain.o -L. -lhello

Triggers the bug:
gcc -g -static -o hello-exec-gccbug35179 hellomain.o -shared -L. -lhello -v


-- 


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



[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2008-02-18 Thread lakshmivaraganm at hcl dot in


--- Comment #4 from lakshmivaraganm at hcl dot in  2008-02-18 12:08 ---
This Crash on exit problem is there if we call exit(0) or call return 0.
If _exit(0) is used, there is no crash.


-- 


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



[Bug target/35179] execs crash in shared lib destructor = do_global_dtors_aux

2008-02-13 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|major   |normal
  Component|c++ |target
 GCC target triplet||i386-pc-solaris2.10


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