This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Executable shared object


Hi Pradyuman,

The resulting file is not runnable.  Segv.

The resulting file is not usable as a shared library.

Or I could be doing something wrong.

--Eljay

- - - -

> ld -o libfoo.so foo.o -dy -ldl -lc
ld: warning: cannot find entry symbol _start; defaulting to 0000000000010250

> ./libfoo.so
Segmentation Fault (core dumped)

> gcc bar.c -L. -lfoo
./libfoo.so: In function `main':
./libfoo.so(.text+0x38): multiple definition of `main'
/var/tmp//cc0OamYZ.o(.text+0x0): first defined here
/gcc-3.2/sparc-sun-solaris2.8/bin/ld: Warning: size of symbol `main' changed from 28 to 52 in ./libfoo.so
./libfoo.so: In function `*ABS*':
foo.c(*ABS*+0x203e0): multiple definition of `_GLOBAL_OFFSET_TABLE_'
/net/mn-spam/export/share/gcc-3.2/bin/../lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtbegin.o(.got+0x0): first defined here
/net/mn-spam/export/share/gcc-3.2/bin/../lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtbegin.o(.dynamic+0x0): multiple definition of `_DYNAMIC'
/net/mn-spam/export/share/gcc-3.2/bin/../lib/gcc-lib/sparc-sun-solaris2.8/3.2/crtbegin.o(.plt+0x0): multiple definition of `_PROCEDURE_LINKAGE_TABLE_'
collect2: ld returned 1 exit status

> cat foo.c
#include <stdio.h>
void Kickme() {
    printf("Kickme.\n");
    }
int main() {
    printf("MAIN: Kick me.\n");
    }

> cat bar.c
extern void Kickme();
int main() {
    Kickme();
    } 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]