public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/
@ 2012-07-29 15:27 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2012-07-29 15:27 UTC (permalink / raw
  To: gentoo-commits

commit:     0a063eb50a55b8b405ed22e407eb1d3078370e30
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 29 01:16:22 2012 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul 29 15:27:23 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=0a063eb5

tests/gnustack/Makefile.am: make sed line work on arm
(cherry picked from commit 8fa951f1421051e12778fd438856cd77864c2302)

---
 configure.ac               |    1 +
 tests/gnustack/Makefile.am |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 23d9fd7..a2a7f5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,7 @@ AC_ARG_ENABLE(
 # Checks for programs.
 AC_PROG_AWK
 AC_PROG_CC
+AC_PROG_SED
 
 # 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 a1dc24b..6f5f569 100644
--- a/tests/gnustack/Makefile.am
+++ b/tests/gnustack/Makefile.am
@@ -2,7 +2,7 @@ noinst_PROGRAMS = bad-gnustack
 
 bad-gnustack.s: bad-gnustack.c
 	$(CC) -S $<
-	sed -i -e 's/GNU-stack,"",@progbits/GNU-stack,"x",@progbits/' $@
+	$(SED) -i -e 's/GNU-stack,"",/GNU-stack,"x",/' $@
 
 bad-gnustack: bad-gnustack.s
 	$(CC) -o $@ $<


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/
@ 2012-07-29 15:24 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2012-07-29 15:24 UTC (permalink / raw
  To: gentoo-commits

commit:     d61df6074dc99b361025bc3706d2841ce2f80cc2
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 29 00:26:33 2012 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Sun Jul 29 15:23:49 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=d61df607

tests/gnustack: make test machine independant
(cherry picked from commit f2a19530532ef81f404723a93932d30e04828a4c)

---
 .gitignore                    |    1 +
 configure.ac                  |    1 -
 tests/gnustack/Makefile.am    |   10 +++++-----
 tests/gnustack/bad-gnustack.c |    2 ++
 tests/gnustack/bad32.s        |   29 -----------------------------
 tests/gnustack/bad64.s        |   37 -------------------------------------
 6 files changed, 8 insertions(+), 72 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5bd120c..f18ff9d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/
@ 2012-07-27 22:31 Anthony G. Basile
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony G. Basile @ 2012-07-27 22:31 UTC (permalink / raw
  To: gentoo-commits

commit:     a7eaee158e9f3525edb1648d59fa6fef3c16827c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 27 21:07:28 2012 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul 27 22:31:44 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=a7eaee15

tests/gnustack: switch from yasm to gcc for assembler
(cherry picked from commit f8a6f9f2f822e7d1c9b5abc32f409af3d82c99ef)

---
 configure.ac                               |    2 +
 tests/gnustack/Makefile.am                 |   18 ++++++----------
 tests/gnustack/bad32.asm                   |   26 -------------------------
 tests/gnustack/{bad-gnustack.c => bad32.s} |   21 ++++++++++++-------
 tests/gnustack/bad64.asm                   |   25 ------------------------
 tests/gnustack/{bad-gnustack.c => bad64.s} |   29 ++++++++++++++++++++-------
 6 files changed, 43 insertions(+), 78 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1b4f2ad..c817686 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,6 +6,7 @@ AC_INIT([elfix], [0.5.0], [http://bugs.gentoo.org/])
 AC_CONFIG_SRCDIR([src/fix-gnustack.c])
 AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([1.11 foreign])
+AM_SILENT_RULES([yes])
 
 AC_ARG_ENABLE(
 	[tests],
@@ -61,6 +62,7 @@ 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 af11d60..7a19c18 100644
--- a/tests/gnustack/Makefile.am
+++ b/tests/gnustack/Makefile.am
@@ -1,15 +1,11 @@
 noinst_PROGRAMS = bad-gnustack
-bad_gnustack_SOURCES = bad-gnustack.c
-bad_gnustack_DEPENDENCIES = bad-asm.o
-bad_gnustack_LDADD = bad-asm.o
-
-EXTRA_DIST = bad64.asm bad32.asm
+bad_gnustack_SOURCES = bad64.s bad32.s
 
 ARCH = $(shell uname -m | sed -e 's/i./x/')
 
-bad-asm.o: bad64.asm bad32.asm
-	[[ "$(ARCH)" == "x86" ]] && yasm -f elf -m x86 bad32.asm && mv bad32.o bad-asm.o || true
-	[[ "$(ARCH)" == "x86_64" ]] && yasm -f elf -m amd64 bad64.asm && mv bad64.o bad-asm.o || true
+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
 
 check_SCRIPTS = test.sh
 TEST = $(check_SCRIPTS)
@@ -17,12 +13,12 @@ TEST = $(check_SCRIPTS)
 test.sh:
 	@echo "================================================================================"
 	@echo
-	@echo "Fixing Bad GNU_STACK Elf"
+	@echo "Before GNU_STACK Elf: "
 	@../../src/fix-gnustack -f bad-gnustack
 	@echo
-	@echo "Fixed Bad GNU_STACK Elf"
+	@echo "After GNU_STACK Elf: "
 	@../../src/fix-gnustack bad-gnustack
 	@echo
 	@echo "================================================================================"
 
-CLEANFILES = bad-asm.o test.sh
+CLEANFILES = *.o test.sh

diff --git a/tests/gnustack/bad32.asm b/tests/gnustack/bad32.asm
deleted file mode 100644
index 8020ac7..0000000
--- a/tests/gnustack/bad32.asm
+++ /dev/null
@@ -1,26 +0,0 @@
-;bad32.asm: 32-bit asm source for sample elf with X on GNU_STACK
-;Copyright (C) 2011  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/>.
-
-global badness
-
-SECTION .text
-
-badness:
-	push ebp
-	mov ebp,esp
-	mov esp,ebp
-	pop ebp
-	ret

diff --git a/tests/gnustack/bad-gnustack.c b/tests/gnustack/bad32.s
similarity index 69%
copy from tests/gnustack/bad-gnustack.c
copy to tests/gnustack/bad32.s
index fa7bcf5..95441d8 100644
--- a/tests/gnustack/bad-gnustack.c
+++ b/tests/gnustack/bad32.s
@@ -1,6 +1,6 @@
 /*
-	bad-gnustack.c: C source for sample elf with X on GNU_STACK
-	Copyright (C) 2011  Anthony G. Basile
+	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
@@ -15,10 +15,15 @@
 	You should have received a copy of the GNU General Public License
 	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-#include <stdlib.h>
 
-int main()
-{
-	badness();
-	return 0;
-}
+	.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.asm b/tests/gnustack/bad64.asm
deleted file mode 100644
index 1164095..0000000
--- a/tests/gnustack/bad64.asm
+++ /dev/null
@@ -1,25 +0,0 @@
-;bad64.asm: 64-bit asm source for sample elf with X on GNU_STACK
-;Copyright (C) 2011  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/>.
-
-global badness
-
-SECTION .text
-badness:
-	push rbp
-	mov rbp,rsp
-	mov rsp,rbp
-	pop rbp
-	ret

diff --git a/tests/gnustack/bad-gnustack.c b/tests/gnustack/bad64.s
similarity index 61%
rename from tests/gnustack/bad-gnustack.c
rename to tests/gnustack/bad64.s
index fa7bcf5..0168921 100644
--- a/tests/gnustack/bad-gnustack.c
+++ b/tests/gnustack/bad64.s
@@ -1,6 +1,6 @@
 /*
-	bad-gnustack.c: C source for sample elf with X on GNU_STACK
-	Copyright (C) 2011  Anthony G. Basile
+	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
@@ -15,10 +15,23 @@
 	You should have received a copy of the GNU General Public License
 	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
-#include <stdlib.h>
 
-int main()
-{
-	badness();
-	return 0;
-}
+	.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-29 15:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-29 15:27 [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/ Anthony G. Basile
  -- strict thread matches above, loose matches on Subject: below --
2012-07-29 15:24 Anthony G. Basile
2012-07-27 22:31 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox