From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 117BD13800E for ; Fri, 27 Jul 2012 22:32:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1EE2AE07AB; Fri, 27 Jul 2012 22:32:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CE83FE07AB for ; Fri, 27 Jul 2012 22:31:59 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 187811B4065 for ; Fri, 27 Jul 2012 22:31:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D11FEE5436 for ; Fri, 27 Jul 2012 22:31:57 +0000 (UTC) From: "Anthony G. Basile" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Anthony G. Basile" Message-ID: <1343428304.a7eaee158e9f3525edb1648d59fa6fef3c16827c.blueness@gentoo> Subject: [gentoo-commits] proj/elfix:elfix-0.5.x commit in: /, tests/gnustack/ X-VCS-Repository: proj/elfix X-VCS-Files: configure.ac tests/gnustack/Makefile.am tests/gnustack/bad-gnustack.c tests/gnustack/bad32.asm tests/gnustack/bad32.s tests/gnustack/bad64.asm tests/gnustack/bad64.s X-VCS-Directories: / tests/gnustack/ X-VCS-Committer: blueness X-VCS-Committer-Name: Anthony G. Basile X-VCS-Revision: a7eaee158e9f3525edb1648d59fa6fef3c16827c X-VCS-Branch: elfix-0.5.x Date: Fri, 27 Jul 2012 22:31:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: eb68f282-dd69-4aff-8522-b0275f2f927a X-Archives-Hash: e2beeec50921df6a036da9eaea097edf commit: a7eaee158e9f3525edb1648d59fa6fef3c16827c Author: Anthony G. Basile gentoo org> AuthorDate: Fri Jul 27 21:07:28 2012 +0000 Commit: Anthony G. Basile gentoo 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 . - -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 . */ -#include -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 . - -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 . */ -#include -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