[Bug other/12074] Block Data initialisation only from first shared library of a common block

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Aug 27 13:58:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|fortran                     |other
         Resolution|                            |INVALID


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-27 13:58 -------
The problem is ld.so (not a GCC problem) is not knowing that lib*init.so needs to run the inits in 
that library before print runs.
The fix is to add a reference to lib*init.so to lib*print.so:
all: test_block_data test_block_data2 test_block_data3

test_block_data : test_block_data.o libtest_block_data_print.so libtest_block_data_init.so
        gcc -o $@ $< -L. -ltest_block_data_init -ltest_block_data_print

test_block_data2 : test_block_data.o libtest_block_data_print.so libtest_block_data_init.so
        gcc -o $@ $< -L. -ltest_block_data_print -ltest_block_data_init

test_block_data3 : test_block_data.o test_block_data_init.o test_block_data_print.o
        gcc -o $@ $^ -lg2c

libtest_block_data_init.so : test_block_data_init.o
        gcc -shared -o $@ $^

libtest_block_data_print.so : test_block_data_print.o libtest_block_data_init.so
        gcc -shared -o $@ $^ -lg2c -L. -ltest_block_data_init

%.o : %.f
        g77 -c -o $@ -fpic $^

The code then works all the time, not this happens also for c++ and other languages, it is not a 
fortran specific problem.



More information about the Gcc-bugs mailing list