[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] A bit more informed
From: |
Martin Kalbfuß |
Subject: |
[Gm2] A bit more informed |
Date: |
Fri, 02 Oct 2009 20:46:40 +0200 |
I tested some command lines and had a look at the results with "file"
and "ldd". Nice tools.
I created a shared object out of a relocatable with
gm2 -fPIC -c Library1.mod
gm2 -shared Library1.mod -o libtest.so
file gives me
Library1.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV),
not stripped
for the module and
libtest.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV),
dynamically linked, not stripped
for libtest.so
So this looks fine.
Then I compiled the program object file with
gm2 -c program.mod
file gives me
program.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV),
not stripped
Looks like this is a relocatable, too. But I didn't used -fPIC?
Then I linked the program with
gm2 program.mod -L. -ltest
file gives me
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not
stripped
and ldd
linux-gate.so.1 => (0xb805e000)
libtest.so => /home/martin/opt/projects/mod/libtest.so (0xb8031000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb800b000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7f19000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7eee000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7d8f000)
/lib/ld-linux.so.2 (0xb805f000)
All looks fine. And the program executes without any errors.
I'm still confused about the relocatables in the SO directory of pim
library. How this works? Is the shared object created on the fly? Or can
I link directly to relocatables?
What is -fshared good for?
Why do you used -fPIC -fshared for the creation of the shared object?
Why to use -fPIC if the object is a relocatable anyway?
I hope this looks a bit less lazy then the entry before.
- [Gm2] A bit more informed,
Martin Kalbfuß <=