libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static lib with libtool 1.5


From: Jeremie LE HEN
Subject: Re: static lib with libtool 1.5
Date: Thu, 11 Aug 2005 16:10:41 +0200
User-agent: Mutt/1.5.9i

Hi Patrick,

> Just to check, I just tried this:
> 
> quartz% uname -s
> NetBSD
> quartz% libtool compile gcc -g -O -c foo.c
> libtool: compile:  gcc -g -O -c foo.c  -fPIC -DPIC -o .libs/foo.o
> libtool: compile:  gcc -g -O -c foo.c -o foo.o >/dev/null 2>&1
> quartz% ls -laR
> total 16
> drwxr-xr-x  3 prlw1  wheel   512 Aug 11 14:02 .
> drwxrwxrwt  5 root   wheel   512 Aug 11 14:02 ..
> drwxr-xr-x  2 prlw1  wheel   512 Aug 11 14:02 .libs
> -rw-r--r--  1 prlw1  wheel    53 Aug 11 14:02 foo.c
> -rw-r--r--  1 prlw1  wheel   290 Aug 11 14:02 foo.lo
> -rw-r--r--  1 prlw1  wheel  2116 Aug 11 14:02 foo.o
> 
> ./.libs:
> total 10
> drwxr-xr-x  2 prlw1  wheel   512 Aug 11 14:02 .
> drwxr-xr-x  3 prlw1  wheel   512 Aug 11 14:02 ..
> -rw-r--r--  1 prlw1  wheel  2116 Aug 11 14:02 foo.o
> quartz% file foo.lo foo.o .libs/foo.o
> foo.lo:      ASCII English text
> foo.o:       ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not 
> stripped
> .libs/foo.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not 
> stripped
> quartz% libtool --version
> ltmain.sh (GNU libtool 1.1984 2005/07/11 12:11:25) 2.1a
> ...
> quartz% diff -s foo.o .libs/foo.o
> Files foo.o and .libs/foo.o are identical
> 
> 
> So your comment is correct. I just wonder why there are two foo.o files.

I'm not a compiler guru, but as far as I can tell cutting-edge Unices
like Linux and *BSD used to always build PIC objects, little does it
matter you asked for it or not.  Object files compiled with -fPIC have
however some additional symbols such as ``_GLOBAL_OFFSET_TABLE_''.
You can check this with nm(1) (this is a NetBSD box too) :
%%%
    donald:libtool.tests$ nm -a foo.o  > nm.foo.1
    donald:libtool.tests$ nm -a .libs/foo.o  > nm.foo.2
    donald:libtool.tests$ diff -u nm.foo.*
    --- nm.foo.1    2005-08-11 16:05:22.000000000 +0200
    +++ nm.foo.2    2005-08-11 16:05:27.000000000 +0200
    @@ -2,9 +2,13 @@
     00000000 d 
     00000000 b 
     00000000 r 
    +00000000 r 
     00000000 N 
     00000000 N 
     00000000 n 
    +00000000 r .LC0
    +00000000 r .LC1
    +         U _GLOBAL_OFFSET_TABLE_
              U cos
     00000000 T foo
     00000000 a foo.c
%%%

This is a Linux box :
%%%
    droopy:demo$ diff -u nm.foo.*
    --- nm.foo.1    2005-08-11 16:09:22.000000000 +0200
    +++ nm.foo.2    2005-08-11 16:09:26.000000000 +0200
    @@ -5,12 +5,18 @@
     00000000 N 
     00000000 N 
     00000000 r 
    +00000000 r 
     00000000 N 
     00000000 N 
     00000000 N 
     00000000 N 
    +00000000 t 
     00000000 n 
     00000000 n 
    +00000000 r .LC0
    +00000000 r .LC1
    +         U _GLOBAL_OFFSET_TABLE_
    +00000000 T __i686.get_pc_thunk.bx
              U cos
     00000000 T foo
     00000000 a foo.c
%%%

Regards,
-- 
Jeremie LE HEN aka TtZ/TataZ                      address@hidden
                                                             address@hidden
Q: Because it reverses the logical flow of conversation.
A: Why is putting a reply at the top of the message frowned upon?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]