diff options
author | 2012-07-28 20:26:33 -0400 | |
---|---|---|
committer | 2012-07-29 11:23:49 -0400 | |
commit | d61df6074dc99b361025bc3706d2841ce2f80cc2 (patch) | |
tree | f87d37c693485358287589883b0f37d5376cf0a2 | |
parent | configure.ac: remove unnecessary check for yasm (diff) | |
download | elfix-d61df6074dc99b361025bc3706d2841ce2f80cc2.tar.gz elfix-d61df6074dc99b361025bc3706d2841ce2f80cc2.tar.bz2 elfix-d61df6074dc99b361025bc3706d2841ce2f80cc2.zip |
tests/gnustack: make test machine independant
(cherry picked from commit f2a19530532ef81f404723a93932d30e04828a4c)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | tests/gnustack/Makefile.am | 10 | ||||
-rw-r--r-- | tests/gnustack/bad-gnustack.c | 2 | ||||
-rw-r--r-- | tests/gnustack/bad32.s | 29 | ||||
-rw-r--r-- | tests/gnustack/bad64.s | 37 |
6 files changed, 8 insertions, 72 deletions
@@ -6,6 +6,7 @@ stamp-h1 # .deps *.o +*.s *.swp fix-gnustack paxctl-ng diff --git a/configure.ac b/configure.ac index 6ae009a..23d9fd7 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,6 @@ AC_ARG_ENABLE( # Checks for programs. AC_PROG_AWK AC_PROG_CC -AM_PROG_AS # Checks for libraries. AC_CHECK_LIB([elf], [elf_begin],[],[AC_MSG_ERROR(["Missing necessary function elf_begin in libelf"])]) diff --git a/tests/gnustack/Makefile.am b/tests/gnustack/Makefile.am index 7a19c18..2915988 100644 --- a/tests/gnustack/Makefile.am +++ b/tests/gnustack/Makefile.am @@ -1,11 +1,11 @@ noinst_PROGRAMS = bad-gnustack -bad_gnustack_SOURCES = bad64.s bad32.s -ARCH = $(shell uname -m | sed -e 's/i./x/') +bad-gnustack.s: bad-gnustack.c + $(CC) -S $< + sed -i -e 's/GNU-stack,"",@progbits/GNU-stack,"x",@progbits/' $@ -bad-gnustack: bad64.s bad32.s - [[ "$(ARCH)" == "x86" ]] && $(CCAS) -m32 -o bad-gnustack bad32.s || true - [[ "$(ARCH)" == "x86_64" ]] && $(CCAS) -m64 -o bad-gnustack bad64.s || true +bad-gnustack: bad-gnustack.s + $(CC) -o $@ $< check_SCRIPTS = test.sh TEST = $(check_SCRIPTS) diff --git a/tests/gnustack/bad-gnustack.c b/tests/gnustack/bad-gnustack.c new file mode 100644 index 0000000..b6c1f55 --- /dev/null +++ b/tests/gnustack/bad-gnustack.c @@ -0,0 +1,2 @@ +// Any c will do here +int main() { return 0 ; } diff --git a/tests/gnustack/bad32.s b/tests/gnustack/bad32.s deleted file mode 100644 index 95441d8..0000000 --- a/tests/gnustack/bad32.s +++ /dev/null @@ -1,29 +0,0 @@ -/* - bad32.s: 32-bit asm source for sample elf with X on GNU_STACK - Copyright (C) 2012 Anthony G. Basile - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - .file "main.c" - .text - .globl main - .type main, @function -main: - pushl %ebp - movl %esp, %ebp - popl %ebp - ret - .size main, .-main - .section .note.GNU-stack,"x",@progbits diff --git a/tests/gnustack/bad64.s b/tests/gnustack/bad64.s deleted file mode 100644 index 0168921..0000000 --- a/tests/gnustack/bad64.s +++ /dev/null @@ -1,37 +0,0 @@ -/* - bad32.s: 32-bit asm source for sample elf with X on GNU_STACK - Copyright (C) 2012 Anthony G. Basile - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - - .file "main.c" - .text - .globl main - .type main, @function -main: -.LFB0: - .cfi_startproc - pushq %rbp - .cfi_def_cfa_offset 16 - movq %rsp, %rbp - .cfi_offset 6, -16 - .cfi_def_cfa_register 6 - leave - .cfi_def_cfa 7, 8 - ret - .cfi_endproc -.LFE0: - .size main, .-main - .section .note.GNU-stack,"x",@progbits |