Skip to content

Commit

Permalink
Test FatELF .o files.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 2, 2009
1 parent dff6931 commit 3768613
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions test/test.sh
Expand Up @@ -20,22 +20,26 @@ make -j2
# Build some test programs (hello world, hello world with shared library,
# hello world that uses dlopen() on shared library).
gcc -O0 -ggdb3 -o hello.so ../hello-lib.c -shared -fPIC -m32
gcc -O0 -ggdb3 -o hello-x86 ../hello.c hello.so -m32 -Wl,-rpath,.
gcc -O0 -ggdb3 -c -o hello-x86.o ../hello.c hello.so -m32 -Wl,-rpath,.
gcc -O0 -ggdb3 -o hello-x86 hello-x86.o hello.so -m32 -Wl,-rpath,.
gcc -O0 -ggdb3 -o hello-dlopen-x86 ../hello-dlopen.c -ldl -m32
mv hello.so hello-x86.so

gcc -O0 -ggdb3 -o hello.so ../hello-lib.c -shared -fPIC -m64
gcc -O0 -ggdb3 -o hello-amd64 ../hello.c hello.so -m64 -Wl,-rpath,.
gcc -O0 -ggdb3 -c -o hello-amd64.o ../hello.c hello.so -m64 -Wl,-rpath,.
gcc -O0 -ggdb3 -o hello-amd64 hello-amd64.o hello.so -m64 -Wl,-rpath,.
gcc -O0 -ggdb3 -o hello-dlopen-amd64 ../hello-dlopen.c -ldl -m64
mv hello.so hello-amd64.so

# Glue them into FatELF binaries.
./fatelf-glue hello hello-x86 hello-amd64
./fatelf-glue hello.o hello-x86.o hello-amd64.o
./fatelf-glue hello.so hello-amd64.so hello-x86.so
./fatelf-glue hello-dlopen hello-dlopen-x86 hello-dlopen-amd64

# fatelf-info tests.
./fatelf-info ./hello
./fatelf-info ./hello.o
./fatelf-info ./hello.so
./fatelf-info ./hello-dlopen

Expand All @@ -47,6 +51,7 @@ diff --brief ./hello-amd64 ./extract-amd64

# file(1) tests.
file ./hello
file ./hello.o
file ./hello.so
file ./hello-dlopen

Expand All @@ -57,18 +62,25 @@ ldd ./hello-dlopen

# binutils tests.
size ./hello
size ./hello.o
size ./hello.so
size ./hello-dlopen
nm ./hello
nm ./hello.o
nm ./hello.so
nm ./hello-dlopen
objdump -x ./hello
objdump -x ./hello.o
objdump -x ./hello.so
objdump -x ./hello-dlopen

# Test gdb.
gdb -x ../test.gdb ./hello

# Link directly against a FatELF object file (binutils test).
gcc -m64 -O0 -ggdb3 -o hello-fatlink-obj-amd64 hello.o hello.so -Wl,-rpath,.
gcc -m32 -O0 -ggdb3 -o hello-fatlink-obj-x86 hello.o hello.so -Wl,-rpath,.

# Link directly against a FatELF shared library (binutils test).
gcc -m64 -O0 -ggdb3 -o hello-fatlink-amd64 ../hello.c hello.so -Wl,-rpath,.
gcc -m32 -O0 -ggdb3 -o hello-fatlink-x86 ../hello.c hello.so -Wl,-rpath,.
Expand All @@ -77,7 +89,9 @@ gcc -m32 -O0 -ggdb3 -o hello-fatlink-x86 ../hello.c hello.so -Wl,-rpath,.
./hello
./hello-dlopen
[ "x$AMD64" = "1" ] && ./hello-fatlink-amd64
[ "x$AMD64" = "1" ] && ./hello-fatlink-obj-amd64
./hello-fatlink-x86
./hello-fatlink-obj-x86

# end of test.sh ...

0 comments on commit 3768613

Please sign in to comment.