aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnthony G. Basile <basile@opensource.dyc.edu>2011-04-13 22:27:40 -0400
committerAnthony G. Basile <basile@opensource.dyc.edu>2011-04-13 22:27:40 -0400
commitceb19bb70a081eb281dca22c87d62a8915f3eed3 (patch)
treeb7d9d4c2837427449e0cb377aa67552288ebf05f /tests
parentfix-gnustack.c: removed unnecessary and harmful elf_update() (diff)
downloadelfix-ceb19bb70a081eb281dca22c87d62a8915f3eed3.tar.gz
elfix-ceb19bb70a081eb281dca22c87d62a8915f3eed3.tar.bz2
elfix-ceb19bb70a081eb281dca22c87d62a8915f3eed3.zip
tests/Makefile.am: improved build of bad elf
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am26
-rw-r--r--tests/test-bad32.asm10
-rw-r--r--tests/test-bad64.asm (renamed from tests/test-bad.asm)4
3 files changed, 27 insertions, 13 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a997c8..1ac6e14 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,25 +1,31 @@
+noinst_PROGRAMS = good bad
+good_SOURCES = good.c
+bad_SOURCES = bad.c
+bad_DEPENDENCIES = test-bad.o
+bad_LDADD = test-bad.o
+
+ARCH = $(shell uname -m)
+
+test-bad.o: test-bad64.asm test-bad32.asm
+ [[ "$(ARCH)" == "x86" ]] && yasm -f elf -m x86 test-bad32.asm && mv test-bad32.o test-bad.o || true
+ [[ "$(ARCH)" == "x86_64" ]] && yasm -f elf -m amd64 test-bad64.asm && mv test-bad64.o test-bad.o || true
+
check_SCRIPTS = test.sh
TEST = $(check_SCRIPTS)
test.sh:
@echo "================================================================================"
@echo
-# @[[ -x ../get-gnustack ]] || echo "Run 'make' first" && exit
-# @[[ -x ../fix-gnustack ]] || echo "Run 'make' first" && exit
- @gcc -o good good.c
- @echo "Good result"
+ @echo "Good Elf"
@../get-gnustack good
@echo
- @yasm -f elf -m amd64 test-bad.asm
- @gcc -c bad.c
- @gcc -o bad bad.o test-bad.o
- @echo "Bad result"
+ @echo "Bad Elf"
@../get-gnustack bad
@echo
- @echo "Fixed results"
+ @echo "Fixing Bad Elf"
@../fix-gnustack bad
@../get-gnustack bad
@echo
@echo "================================================================================"
-CLEANFILES = good good.o bad bad.o test-bad.o test.sh
+CLEANFILES = test-bad.o test.sh
diff --git a/tests/test-bad32.asm b/tests/test-bad32.asm
new file mode 100644
index 0000000..3d23244
--- /dev/null
+++ b/tests/test-bad32.asm
@@ -0,0 +1,10 @@
+global badness
+
+SECTION .text
+badness:
+ push ebp
+ mov ebp,esp
+
+ mov esp,ebp
+ pop ebp
+ ret
diff --git a/tests/test-bad.asm b/tests/test-bad64.asm
index 8468062..ac31c04 100644
--- a/tests/test-bad.asm
+++ b/tests/test-bad64.asm
@@ -1,8 +1,6 @@
-global badness:function
+global badness
SECTION .text
-
-align 16
badness:
push rbp
mov rbp,rsp