[Bug target/14813] The wrong init order

hjl at lucon dot org gcc-bugzilla@gcc.gnu.org
Thu Apr 1 20:00:00 GMT 2004


------- Additional Comments From hjl at lucon dot org  2004-04-01 20:00 -------
Created an attachment (id=6025)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6025&action=view)
A testcase

# make
/usr/gcc-3.4/bin/gcc -O -g   -c -o bar.o bar.c
/usr/gcc-3.4/bin/gcc -static  bar.o   -o bar
./bar
preinit array 0
preinit array 1
preinit array 2
init array 0
init array 1
init array 2
init
fini array 2
fini array 1
fini array 0
fini

The right one should be

[hjl@gnu-4 init]$ make CC=gcc
gcc -O -g   -c -o bar.o bar.c
/tmp/ccyDlcv7.s: Assembler messages:
/tmp/ccyDlcv7.s:184: Warning: ignoring incorrect section type for
.preinit_array/tmp/ccyDlcv7.s:292: Warning: ignoring incorrect section type for
.init_array
/tmp/ccyDlcv7.s:400: Warning: ignoring incorrect section type for .fini_array
gcc -static  bar.o   -o bar
./bar
preinit array 0
preinit array 1
preinit array 2
init
init array 0
init array 1
init array 2
fini array 2
fini array 1
fini array 0
fini


-- 


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



More information about the Gcc-bugs mailing list