Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/
Date: Sun, 29 Jul 2012 15:24:18
Message-Id: 1343575429.d61df6074dc99b361025bc3706d2841ce2f80cc2.blueness@gentoo
1 commit: d61df6074dc99b361025bc3706d2841ce2f80cc2
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 29 00:26:33 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 29 15:23:49 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=d61df607
7
8 tests/gnustack: make test machine independant
9 (cherry picked from commit f2a19530532ef81f404723a93932d30e04828a4c)
10
11 ---
12 .gitignore | 1 +
13 configure.ac | 1 -
14 tests/gnustack/Makefile.am | 10 +++++-----
15 tests/gnustack/bad-gnustack.c | 2 ++
16 tests/gnustack/bad32.s | 29 -----------------------------
17 tests/gnustack/bad64.s | 37 -------------------------------------
18 6 files changed, 8 insertions(+), 72 deletions(-)
19
20 diff --git a/.gitignore b/.gitignore
21 index 5bd120c..f18ff9d 100644
22 --- a/.gitignore
23 +++ b/.gitignore
24 @@ -6,6 +6,7 @@ stamp-h1
25 #
26 .deps
27 *.o
28 +*.s
29 *.swp
30 fix-gnustack
31 paxctl-ng
32
33 diff --git a/configure.ac b/configure.ac
34 index 6ae009a..23d9fd7 100644
35 --- a/configure.ac
36 +++ b/configure.ac
37 @@ -54,7 +54,6 @@ AC_ARG_ENABLE(
38 # Checks for programs.
39 AC_PROG_AWK
40 AC_PROG_CC
41 -AM_PROG_AS
42
43 # Checks for libraries.
44 AC_CHECK_LIB([elf], [elf_begin],[],[AC_MSG_ERROR(["Missing necessary function elf_begin in libelf"])])
45
46 diff --git a/tests/gnustack/Makefile.am b/tests/gnustack/Makefile.am
47 index 7a19c18..2915988 100644
48 --- a/tests/gnustack/Makefile.am
49 +++ b/tests/gnustack/Makefile.am
50 @@ -1,11 +1,11 @@
51 noinst_PROGRAMS = bad-gnustack
52 -bad_gnustack_SOURCES = bad64.s bad32.s
53
54 -ARCH = $(shell uname -m | sed -e 's/i./x/')
55 +bad-gnustack.s: bad-gnustack.c
56 + $(CC) -S $<
57 + sed -i -e 's/GNU-stack,"",@progbits/GNU-stack,"x",@progbits/' $@
58
59 -bad-gnustack: bad64.s bad32.s
60 - [[ "$(ARCH)" == "x86" ]] && $(CCAS) -m32 -o bad-gnustack bad32.s || true
61 - [[ "$(ARCH)" == "x86_64" ]] && $(CCAS) -m64 -o bad-gnustack bad64.s || true
62 +bad-gnustack: bad-gnustack.s
63 + $(CC) -o $@ $<
64
65 check_SCRIPTS = test.sh
66 TEST = $(check_SCRIPTS)
67
68 diff --git a/tests/gnustack/bad-gnustack.c b/tests/gnustack/bad-gnustack.c
69 new file mode 100644
70 index 0000000..b6c1f55
71 --- /dev/null
72 +++ b/tests/gnustack/bad-gnustack.c
73 @@ -0,0 +1,2 @@
74 +// Any c will do here
75 +int main() { return 0 ; }
76
77 diff --git a/tests/gnustack/bad32.s b/tests/gnustack/bad32.s
78 deleted file mode 100644
79 index 95441d8..0000000
80 --- a/tests/gnustack/bad32.s
81 +++ /dev/null
82 @@ -1,29 +0,0 @@
83 -/*
84 - bad32.s: 32-bit asm source for sample elf with X on GNU_STACK
85 - Copyright (C) 2012 Anthony G. Basile
86 -
87 - This program is free software: you can redistribute it and/or modify
88 - it under the terms of the GNU General Public License as published by
89 - the Free Software Foundation, either version 3 of the License, or
90 - (at your option) any later version.
91 -
92 - This program is distributed in the hope that it will be useful,
93 - but WITHOUT ANY WARRANTY; without even the implied warranty of
94 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95 - GNU General Public License for more details.
96 -
97 - You should have received a copy of the GNU General Public License
98 - along with this program. If not, see <http://www.gnu.org/licenses/>.
99 -*/
100 -
101 - .file "main.c"
102 - .text
103 - .globl main
104 - .type main, @function
105 -main:
106 - pushl %ebp
107 - movl %esp, %ebp
108 - popl %ebp
109 - ret
110 - .size main, .-main
111 - .section .note.GNU-stack,"x",@progbits
112
113 diff --git a/tests/gnustack/bad64.s b/tests/gnustack/bad64.s
114 deleted file mode 100644
115 index 0168921..0000000
116 --- a/tests/gnustack/bad64.s
117 +++ /dev/null
118 @@ -1,37 +0,0 @@
119 -/*
120 - bad32.s: 32-bit asm source for sample elf with X on GNU_STACK
121 - Copyright (C) 2012 Anthony G. Basile
122 -
123 - This program is free software: you can redistribute it and/or modify
124 - it under the terms of the GNU General Public License as published by
125 - the Free Software Foundation, either version 3 of the License, or
126 - (at your option) any later version.
127 -
128 - This program is distributed in the hope that it will be useful,
129 - but WITHOUT ANY WARRANTY; without even the implied warranty of
130 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
131 - GNU General Public License for more details.
132 -
133 - You should have received a copy of the GNU General Public License
134 - along with this program. If not, see <http://www.gnu.org/licenses/>.
135 -*/
136 -
137 - .file "main.c"
138 - .text
139 - .globl main
140 - .type main, @function
141 -main:
142 -.LFB0:
143 - .cfi_startproc
144 - pushq %rbp
145 - .cfi_def_cfa_offset 16
146 - movq %rsp, %rbp
147 - .cfi_offset 6, -16
148 - .cfi_def_cfa_register 6
149 - leave
150 - .cfi_def_cfa 7, 8
151 - ret
152 - .cfi_endproc
153 -.LFE0:
154 - .size main, .-main
155 - .section .note.GNU-stack,"x",@progbits