[Alexandre Oliva <oliva@dcc.unicamp.br>] Re: libtool doesn't work well on FreeBSD2

Date view Thread view Subject view Author view

From: Alexandre Oliva (oliva@dcc.unicamp.br)
Date: Sun Jan 17 1999 - 01:48:34 EST


Thought you might be interested in knowing why Kaffe hasn't worked on
FreeBSD during the last week...

-- 
Alexandre Oliva  http://www.dcc.unicamp.br/~oliva  aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil
------- Start of forwarded message -------
Resent-Date: Sun, 17 Jan 1999 01:48:13 -0500
To: Alex Zepeda <garbanzo@hooked.net>
Cc: bug-libtool@gnu.org
Subject: Re: libtool doesn't work well on FreeBSD2
From: Alexandre Oliva <oliva@dcc.unicamp.br>
Date: 17 Jan 1999 04:39:32 -0200
Message-ID: <or90f2flnf.fsf@araguaia.dcc.unicamp.br>
Mime-Version: 1.0
Resent-Message-ID: <"ruVFa.0._R6.wTOes"@mescaline.gnu.org>
Resent-From: bug-libtool@gnu.org
Resent-Sender: bug-libtool-request@gnu.org
Content-Type: text

There's a strange interaction of -fPIC with -lm, see:

bash$ gcc -v gcc version 2.7.2.1 bash$ uname -a FreeBSD marker.cs.utah.edu 2.2.6-BETA FreeBSD 2.2.6-BETA #0: Mon Aug 24 17:45:26 MDT 1998 sclawson@marker.cs.utah.edu:/usr/src/sys/compile/MARKER i386 bash$ cat t.c int i; main() { i = 1; } bash$ gcc t.c -lm bash$ ./a.out bash$ gcc -fPIC t.c bash$ ./a.out bash$ gcc -fPIC t.c -lm bash$ ./a.out bash$ gcc -fPIC t.c -lm -lm bash$ ./a.out bash$ gcc -lm t.c bash$ ./a.out bash$ gcc -fPIC -lm t.c ld: symbol __GLOBAL_OFFSET_TABLE_ remains undefined bash$ ./a.out Segmentation fault (core dumped) bash$ gcc -fPIC -lm t.c -lm ld: symbol __GLOBAL_OFFSET_TABLE_ remains undefined bash$ ./a.out Segmentation fault (core dumped)

Note that the program does not depend on `-lm' in anyway. Nevertheless, the presence of `-lm' flag affects the output of `ld', and also the result of the program.

The assembly output of gcc (not included) seems correct. Nevertheless, when the program that lacks the __GLOBAL_OFFSET_TABLE is run, it crashes in the instruction that tries to write to the global variable `i', which is expected given the linker error, because the base address in $ebx wasn't properly relocated.

Any suggestions on how to make linking PIC objects more reliable, for the benefit of GNU libtool?

Note that this program was reduced from a more complex test case of libtool, in which -lm appeared after all objects with non-PIC code, but before other libraries with PIC code.

-- Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org} oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org} Universidade Estadual de Campinas, SP, Brasil

------- End of forwarded message -------


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:44 EDT