This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

Mixing libraries for different architectures into a shared lib


L.S.

I'd like to understand what happens when I (inadvertently) link object files for different architectures like this (all build commands being done on linux for linux target):

# two source files:
lib1.c
lib2.c

# compiling one for i386 and the other for i686
gcc -march=i386 -o lib1.o -c lib1.c
gcc -march=i686 -o lib2.o -c lib2.c

# linking the both into a shared lib
gcc -shared -o myshlib.so lib1.o lib2.o

I can imagine that things go wrong at load time or run time when launching a program (on a i686 machine) that uses myshlib.so:
- does it run?
- will it even load myshlib.so at runtime?


Does it make a difference if the binaries are produced for windows (using a cross-toolchain and adjusting file names properly, of course)?


Thanks in advance for any insight,


Erik Leunissen.


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