[Top][All Lists]

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

[Tinycc-devel] [RFC|PATCH] Add -soname linker option

From: Marc Andre Tanner
Subject: [Tinycc-devel] [RFC|PATCH] Add -soname linker option
Date: Sat, 24 Nov 2007 00:05:09 +0100
User-agent: Mutt/1.5.17 (2007-11-01)


I recently tried to build a few debian packages with tinycc, during this
i came across a shared library which is normally compiled as follows: 

  gcc -Wl,-soname,libfoobar.so.1 -o libfoobar.so.1.0.1 *.o

So i tried to implement an -soname option for tcc, the result is
attached. As can be seen below the soname seems to be correctly stored
in the ELF file.

$> cat foo.c
int foo(int a,int b){
        return a + b;

$> cat bar.c
int bar(int a, int b){
        return a * b;

$> tcc -fPIC -c foo.c
$> tcc -fPIC -c bar.c
$> tcc -shared -soname libfoobar.so.1 -o libfoobar.so.1.0.1 foo.o bar.o
$> objdump -p libfoobar.so.1.0.1 | grep SONAME
  SONAME      libfoobar.so.1

However when i try to link something with my shared library, it

$> cat main.c
int foo(int a,int b);
int bar(int a,int b);

int main(){
$> ln -s libfoobar.so.1.0.1 libfoobar.so.1
$> ln -s libfoobar.so.1 libfoobar.so
$> tcc -L. -lfoobar main.c -o test
$> /lib/ld-linux.so.2 --library-path . ./test
Segmentation fault.

If i create the shared library with gcc as shown in the beginning of my
mail it works as expected. This issue is unrelated to my patch, it also
segfaults with current mercurial tip. Is this because tcc doesn't
currently generate position independent code? But the documentation
states that tcc is able to generate dynamic librarys, so what i am doing


 Marc Andre Tanner >< http://www.brain-dump.org/ >< GPG key: CF7D56C0

Attachment: soname.patch
Description: Text Data

reply via email to

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