Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/elfix:master commit in: /, tests/gnustack/, doc/, misc/fix-gnustack/, misc/fix-gnustack/doc/, src/, ...
Date: Wed, 30 Jul 2014 21:16:12
Message-Id: 1406755045.774ce372e0a21e58541d34035ed15903b4b5b34a.blueness@gentoo
1 commit: 774ce372e0a21e58541d34035ed15903b4b5b34a
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 30 21:17:25 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 30 21:17:25 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=774ce372
7
8 Refactor source tree: separate out fix-gnustack
9
10 ---
11 .gitignore | 15 +++---
12 autogen.sh | 3 ++
13 configure.ac | 5 +-
14 doc/Makefile.am | 8 ---
15 doc/make.sh | 22 +++-----
16 doc/paxctl-ng.1 | 4 +-
17 doc/revdep-pax.1 | 4 +-
18 misc/fix-gnustack/ChangeLog | 46 +++++++++++++++++
19 misc/fix-gnustack/Makefile.am | 6 +++
20 autogen.sh => misc/fix-gnustack/autogen.sh | 4 +-
21 misc/fix-gnustack/configure.ac | 58 ++++++++++++++++++++++
22 misc/fix-gnustack/doc/Makefile.am | 3 ++
23 {doc => misc/fix-gnustack/doc}/fix-gnustack.1 | 4 +-
24 {doc => misc/fix-gnustack/doc}/fix-gnustack.pod | 0
25 {doc => misc/fix-gnustack/doc}/make.sh | 28 +++--------
26 {src => misc/fix-gnustack}/fix-gnustack.c | 0
27 .../fix-gnustack/tests}/Makefile.am | 4 +-
28 .../fix-gnustack/tests}/bad-gnustack.c | 0
29 .../fix-gnustack/tests}/gnustacktest.sh | 23 ++-------
30 src/Makefile.am | 5 --
31 tests/Makefile.am | 3 --
32 21 files changed, 153 insertions(+), 92 deletions(-)
33
34 diff --git a/.gitignore b/.gitignore
35 index ead9914..b2500c4 100644
36 --- a/.gitignore
37 +++ b/.gitignore
38 @@ -25,7 +25,6 @@ stamp-h1
39 *.la
40 *.lo
41 #
42 -fix-gnustack
43 paxctl-ng
44 bad-gnustack
45 daemon*
46 @@ -33,11 +32,11 @@ dummy
47 revdepbin
48 #
49 scripts/build
50 -misc/__pycache__
51 #
52 -misc/change-interp/bash
53 -misc/change-interp/change-interp
54 -misc/elf-manipulate/clear-dt-path
55 -misc/elf-manipulate/parse-elf
56 -misc/elf-manipulate/print-sections
57 -misc/elf-manipulate/remove-ptpax
58 +misc/fix-gnustack/fix-gnustack
59 +#
60 +poc/change-interp/change-interp
61 +poc/elf-manipulate/clear-dt-path
62 +poc/elf-manipulate/parse-elf
63 +poc/elf-manipulate/print-sections
64 +poc/elf-manipulate/remove-ptpax
65
66 diff --git a/autogen.sh b/autogen.sh
67 index 917d1a7..aec299b 100755
68 --- a/autogen.sh
69 +++ b/autogen.sh
70 @@ -5,3 +5,6 @@ autoheader && \
71 autoconf && \
72 libtoolize --copy && \
73 automake --add-missing --copy
74 +
75 +cd doc
76 +./make.sh
77
78 diff --git a/configure.ac b/configure.ac
79 index 2b66eae..179eed5 100644
80 --- a/configure.ac
81 +++ b/configure.ac
82 @@ -17,8 +17,8 @@
83 #
84
85 AC_PREREQ([2.68])
86 -AC_INIT([elfix], [0.8], [http://bugs.gentoo.org/])
87 -AC_CONFIG_SRCDIR([src/fix-gnustack.c])
88 +AC_INIT([elfix], [0.9], [http://bugs.gentoo.org/])
89 +AC_CONFIG_SRCDIR([src/paxctl-ng.c])
90 AC_CONFIG_HEADERS([config.h])
91 AM_INIT_AUTOMAKE([1.12 foreign])
92 AM_SILENT_RULES([no])
93 @@ -150,7 +150,6 @@ AC_CONFIG_FILES([
94 scripts/Makefile
95 doc/Makefile
96 tests/Makefile
97 - tests/gnustack/Makefile
98 tests/pxtpax/Makefile
99 tests/paxmodule/Makefile
100 tests/revdeppaxtest/Makefile
101
102 diff --git a/doc/Makefile.am b/doc/Makefile.am
103 index 836014b..4ce1847 100644
104 --- a/doc/Makefile.am
105 +++ b/doc/Makefile.am
106 @@ -1,11 +1,3 @@
107 ACLOCAL_AMFLAGS = -I m4
108
109 dist_man_MANS = paxctl-ng.1 revdep-pax.1
110 -if BUILD_ELF
111 -dist_man_MANS += fix-gnustack.1
112 -endif
113 -
114 -# I don't know why I need this, but without it, I don't get fix-gnustack.1 distributed.
115 -# This is since commit 414cfa1770a8cfc46308149deecf9c0eef60a5bb. It will be fixed once
116 -# fix-gnustack is broken out.
117 -EXTRA_DIST = fix-gnustack.1
118
119 diff --git a/doc/make.sh b/doc/make.sh
120 index bf29d22..a330f17 100755
121 --- a/doc/make.sh
122 +++ b/doc/make.sh
123 @@ -17,31 +17,23 @@
124 # along with this program. If not, see <http://www.gnu.org/licenses/>.
125 #
126
127 -#Run this on developer side, and distribute troff
128 -#in case the end user doesn't have pod2man
129 +# This is run on the developer side with autogen.sh
130
131 -rm -f fix-gnustack.1
132 +PKG=$(cat ../configure.ac | grep ^AC_INIT | sed -e 's/^.*(\[//' -e 's/\].*$//')
133 +VERSION=$(cat ../configure.ac | grep ^AC_INIT | sed -e "s/^.*$PKG\], \[//" -e 's/\].*$//')
134
135 pod2man \
136 --official \
137 --section="1" \
138 - --release="elfix 0.3" \
139 + --release="$PKG $VERSION" \
140 --center="Documentation for elfix" \
141 - --date="2011-04-14" \
142 - fix-gnustack.pod > fix-gnustack.1
143 -
144 -pod2man \
145 - --official \
146 - --section="1" \
147 - --release="elfix 0.3" \
148 - --center="Documentation for elfix" \
149 - --date="2011-08-18" \
150 + --date=$(date +%Y-%m-%d) \
151 paxctl-ng.pod > paxctl-ng.1
152
153 pod2man \
154 --official \
155 --section="1" \
156 - --release="elfix 0.3" \
157 + --release="$PKG $VERSION" \
158 --center="Documentation for elfix" \
159 - --date="2011-10-19" \
160 + --date=$(date +%Y-%m-%d) \
161 revdep-pax.pod > revdep-pax.1
162
163 diff --git a/doc/paxctl-ng.1 b/doc/paxctl-ng.1
164 index 744184b..5cb923a 100644
165 --- a/doc/paxctl-ng.1
166 +++ b/doc/paxctl-ng.1
167 @@ -1,4 +1,4 @@
168 -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
169 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23)
170 .\"
171 .\" Standard preamble:
172 .\" ========================================================================
173 @@ -124,7 +124,7 @@
174 .\" ========================================================================
175 .\"
176 .IX Title "PAXCTL-NG 1"
177 -.TH PAXCTL-NG 1 "2011-08-18" "elfix 0.3" "Documentation for elfix"
178 +.TH PAXCTL-NG 1 "2014-07-30" "elfix 0.9" "Documentation for elfix"
179 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
180 .\" way too many mistakes in technical documents.
181 .if n .ad l
182
183 diff --git a/doc/revdep-pax.1 b/doc/revdep-pax.1
184 index 58568fa..ee7cfd5 100644
185 --- a/doc/revdep-pax.1
186 +++ b/doc/revdep-pax.1
187 @@ -1,4 +1,4 @@
188 -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
189 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23)
190 .\"
191 .\" Standard preamble:
192 .\" ========================================================================
193 @@ -124,7 +124,7 @@
194 .\" ========================================================================
195 .\"
196 .IX Title "REVDEP-PAX 1"
197 -.TH REVDEP-PAX 1 "2011-10-19" "elfix 0.3" "Documentation for elfix"
198 +.TH REVDEP-PAX 1 "2014-07-30" "elfix 0.9" "Documentation for elfix"
199 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
200 .\" way too many mistakes in technical documents.
201 .if n .ad l
202
203 diff --git a/misc/fix-gnustack/ChangeLog b/misc/fix-gnustack/ChangeLog
204 new file mode 100644
205 index 0000000..7e6fc49
206 --- /dev/null
207 +++ b/misc/fix-gnustack/ChangeLog
208 @@ -0,0 +1,46 @@
209 +2014-07-30
210 +
211 + * Seperate out fix-gnustack. See: https://bugs.gentoo.org/518524
212 +
213 +2014-06-07
214 +
215 + * Switch from error() to errx() make the code portable to musl (and BSD).
216 +
217 +2013-05-20
218 +
219 + * Add check if ELF_C_RDWR_MMAP is declared in libelf.h. This distinguishes
220 + elfutils from libelf. The former will not build on uclibc, but the later
221 + does not provide ELF_C_RDWR_MMAP.
222 +
223 +2012-07-29
224 +
225 + * remove unnecessary check for yasm in configure.ac
226 + * make tests/gnustack machine independant by generating
227 + native assembly using gcc
228 +
229 +2012-07-27
230 +
231 + * switch from yasm to gcc for assembler for arches other than
232 + x86 and amd64
233 + * opening an ELF_C_RDWR does not work for either libelf or
234 + elfutils, so revert to ELF_C_RDWR_MMAP. This does, however,
235 + break linking against libelf
236 +
237 +2012-07-24
238 +
239 + * switch from ELF_C_RDWR_MMAP to ELF_C_RDWR to link again libelf
240 + for uclibc systems
241 +
242 +2011-11-26
243 +
244 + * fix-gnustack and paxctl-ng: fix exit code on success
245 +
246 +2011-04-14
247 +
248 + * Initial release of fix-gnustack
249 +-----
250 +
251 +Copyright (C) 2011-2014 Anthony G. Basile
252 +
253 +Copying and distribution of this file, with or without modification, are
254 +permitted provided the copyright notice and this notice are preserved.
255
256 diff --git a/misc/fix-gnustack/Makefile.am b/misc/fix-gnustack/Makefile.am
257 new file mode 100644
258 index 0000000..821f549
259 --- /dev/null
260 +++ b/misc/fix-gnustack/Makefile.am
261 @@ -0,0 +1,6 @@
262 +ACLOCAL_AMFLAGS = -I m4
263 +
264 +sbin_PROGRAMS = fix-gnustack
265 +fix_gnustack_SOURCES = fix-gnustack.c
266 +
267 +SUBDIRS = doc tests
268
269 diff --git a/autogen.sh b/misc/fix-gnustack/autogen.sh
270 similarity index 78%
271 copy from autogen.sh
272 copy to misc/fix-gnustack/autogen.sh
273 index 917d1a7..0b7b16b 100755
274 --- a/autogen.sh
275 +++ b/misc/fix-gnustack/autogen.sh
276 @@ -3,5 +3,7 @@
277 aclocal && \
278 autoheader && \
279 autoconf && \
280 -libtoolize --copy && \
281 automake --add-missing --copy
282 +
283 +cd doc
284 +./make.sh
285
286 diff --git a/misc/fix-gnustack/configure.ac b/misc/fix-gnustack/configure.ac
287 new file mode 100644
288 index 0000000..2f5a245
289 --- /dev/null
290 +++ b/misc/fix-gnustack/configure.ac
291 @@ -0,0 +1,58 @@
292 +#
293 +# configure.ac: this file is part of the elfix package
294 +# Copyright (C) 2011 Anthony G. Basile
295 +#
296 +# This program is free software: you can redistribute it and/or modify
297 +# it under the terms of the GNU General Public License as published by
298 +# the Free Software Foundation, either version 3 of the License, or
299 +# (at your option) any later version.
300 +#
301 +# This program is distributed in the hope that it will be useful,
302 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
303 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 +# GNU General Public License for more details.
305 +#
306 +# You should have received a copy of the GNU General Public License
307 +# along with this program. If not, see <http://www.gnu.org/licenses/>.
308 +#
309 +
310 +AC_PREREQ([2.69])
311 +AC_INIT([fix-gnustack], [0.1], [http://bugs.gentoo.org/])
312 +AC_CONFIG_SRCDIR([fix-gnustack.c])
313 +AC_CONFIG_HEADERS([config.h])
314 +AM_INIT_AUTOMAKE([1.12 foreign])
315 +AM_SILENT_RULES([no])
316 +
317 +# Checks for programs.
318 +AC_PROG_AWK
319 +AC_PROG_CC
320 +AC_PROG_SED
321 +
322 +# Checks for header files.
323 +AC_CHECK_HEADERS(
324 + [err.h fcntl.h gelf.h libgen.h stdlib.h string.h sys/stat.h sys/types.h unistd.h],
325 + [],
326 + [AC_MSG_ERROR(["Missing necessary header"])]
327 +)
328 +
329 +# Checks for DECLs.
330 +AC_CHECK_DECL([ELF_C_RDWR_MMAP],[],[],[[#include <libelf.h>]])
331 +
332 +# Checks for typedefs, structures, and compiler characteristics.
333 +AC_TYPE_SIZE_T
334 +
335 +# Checks for library functions.
336 +AC_CHECK_LIB(
337 + [elf],
338 + [elf_begin],
339 + [],
340 + [AC_MSG_ERROR(["Missing necessary function elf_begin in libelf"])]
341 +)
342 +
343 +AC_CONFIG_FILES([
344 + Makefile
345 + doc/Makefile
346 + tests/Makefile
347 +])
348 +
349 +AC_OUTPUT
350
351 diff --git a/misc/fix-gnustack/doc/Makefile.am b/misc/fix-gnustack/doc/Makefile.am
352 new file mode 100644
353 index 0000000..b5f33f4
354 --- /dev/null
355 +++ b/misc/fix-gnustack/doc/Makefile.am
356 @@ -0,0 +1,3 @@
357 +ACLOCAL_AMFLAGS = -I m4
358 +
359 +dist_man_MANS = fix-gnustack.1
360
361 diff --git a/doc/fix-gnustack.1 b/misc/fix-gnustack/doc/fix-gnustack.1
362 similarity index 97%
363 rename from doc/fix-gnustack.1
364 rename to misc/fix-gnustack/doc/fix-gnustack.1
365 index 3ef26eb..06f720a 100644
366 --- a/doc/fix-gnustack.1
367 +++ b/misc/fix-gnustack/doc/fix-gnustack.1
368 @@ -1,4 +1,4 @@
369 -.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14)
370 +.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.23)
371 .\"
372 .\" Standard preamble:
373 .\" ========================================================================
374 @@ -124,7 +124,7 @@
375 .\" ========================================================================
376 .\"
377 .IX Title "FIX-GNUSTACK 1"
378 -.TH FIX-GNUSTACK 1 "2011-04-14" "elfix 0.3" "Documentation for elfix"
379 +.TH FIX-GNUSTACK 1 "2014-07-30" "fix-gnustack 0.1" "Documentation for fix-gnustack"
380 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
381 .\" way too many mistakes in technical documents.
382 .if n .ad l
383
384 diff --git a/doc/fix-gnustack.pod b/misc/fix-gnustack/doc/fix-gnustack.pod
385 similarity index 100%
386 rename from doc/fix-gnustack.pod
387 rename to misc/fix-gnustack/doc/fix-gnustack.pod
388
389 diff --git a/doc/make.sh b/misc/fix-gnustack/doc/make.sh
390 similarity index 61%
391 copy from doc/make.sh
392 copy to misc/fix-gnustack/doc/make.sh
393 index bf29d22..f9ed65e 100755
394 --- a/doc/make.sh
395 +++ b/misc/fix-gnustack/doc/make.sh
396 @@ -17,31 +17,15 @@
397 # along with this program. If not, see <http://www.gnu.org/licenses/>.
398 #
399
400 -#Run this on developer side, and distribute troff
401 -#in case the end user doesn't have pod2man
402 +# This is run on the developer side with autogen.sh
403
404 -rm -f fix-gnustack.1
405 +PKG=$(cat ../configure.ac | grep ^AC_INIT | sed -e 's/^.*(\[//' -e 's/\].*$//')
406 +VERSION=$(cat ../configure.ac | grep ^AC_INIT | sed -e "s/^.*$PKG\], \[//" -e 's/\].*$//')
407
408 pod2man \
409 --official \
410 --section="1" \
411 - --release="elfix 0.3" \
412 - --center="Documentation for elfix" \
413 - --date="2011-04-14" \
414 + --release="$PKG $VERSION" \
415 + --center="Documentation for fix-gnustack" \
416 + --date=$(date +%Y-%m-%d) \
417 fix-gnustack.pod > fix-gnustack.1
418 -
419 -pod2man \
420 - --official \
421 - --section="1" \
422 - --release="elfix 0.3" \
423 - --center="Documentation for elfix" \
424 - --date="2011-08-18" \
425 - paxctl-ng.pod > paxctl-ng.1
426 -
427 -pod2man \
428 - --official \
429 - --section="1" \
430 - --release="elfix 0.3" \
431 - --center="Documentation for elfix" \
432 - --date="2011-10-19" \
433 - revdep-pax.pod > revdep-pax.1
434
435 diff --git a/src/fix-gnustack.c b/misc/fix-gnustack/fix-gnustack.c
436 similarity index 100%
437 rename from src/fix-gnustack.c
438 rename to misc/fix-gnustack/fix-gnustack.c
439
440 diff --git a/tests/gnustack/Makefile.am b/misc/fix-gnustack/tests/Makefile.am
441 similarity index 83%
442 rename from tests/gnustack/Makefile.am
443 rename to misc/fix-gnustack/tests/Makefile.am
444 index 2590ba2..9db0fd7 100644
445 --- a/tests/gnustack/Makefile.am
446 +++ b/misc/fix-gnustack/tests/Makefile.am
447 @@ -14,7 +14,7 @@ bad-gnustack$(EXEEXT): bad-gnustack.s
448 check_SCRIPTS = gnustacktest
449 TEST = $(check_SCRIPTS)
450
451 -gnustacktest:
452 - ./gnustacktest.sh 0
453 +gnustacktest: bad-gnustack
454 + $(top_srcdir)/tests/gnustacktest.sh
455
456 CLEANFILES = *.o *.s
457
458 diff --git a/tests/gnustack/bad-gnustack.c b/misc/fix-gnustack/tests/bad-gnustack.c
459 similarity index 100%
460 rename from tests/gnustack/bad-gnustack.c
461 rename to misc/fix-gnustack/tests/bad-gnustack.c
462
463 diff --git a/tests/gnustack/gnustacktest.sh b/misc/fix-gnustack/tests/gnustacktest.sh
464 similarity index 67%
465 rename from tests/gnustack/gnustacktest.sh
466 rename to misc/fix-gnustack/tests/gnustacktest.sh
467 index 84d8b69..f200baf 100755
468 --- a/tests/gnustack/gnustacktest.sh
469 +++ b/misc/fix-gnustack/tests/gnustacktest.sh
470 @@ -17,28 +17,13 @@
471 # along with this program. If not, see <http://www.gnu.org/licenses/>.
472 #
473
474 -verbose=${1-0}
475 -
476 -echo "================================================================================"
477 -echo
478 -echo " RUNNING GNU_STACK TEST"
479 -before=$(../../src/fix-gnustack -f bad-gnustack)
480 +before=$(../fix-gnustack -f bad-gnustack)
481 before=$(echo ${before} | awk '{ print $2 }')
482 -after=$(../../src/fix-gnustack bad-gnustack)
483 +after=$(../fix-gnustack bad-gnustack)
484 after=$(echo ${after} | awk '{ print $2 }')
485 rm bad-gnustack
486 -if [ "${verbose}" != 0 ]; then
487 - echo " BEFRE=${before}"
488 - echo " AFTER=${after}"
489 -fi
490 if [ "${before}" = "RWX" -a "${after}" = "RW" ]; then
491 - echo " OK"
492 - ret=0
493 + exit 0
494 else
495 - echo " NOT OKAY"
496 - ret=1
497 + exit 1
498 fi
499 -echo
500 -echo "================================================================================"
501 -
502 -exit $ret
503
504 diff --git a/src/Makefile.am b/src/Makefile.am
505 index b41f21c..ec2404e 100644
506 --- a/src/Makefile.am
507 +++ b/src/Makefile.am
508 @@ -2,8 +2,3 @@ ACLOCAL_AMFLAGS = -I m4
509
510 sbin_PROGRAMS = paxctl-ng
511 paxctl_ng_SOURCES = paxctl-ng.c
512 -
513 -if BUILD_ELF
514 -sbin_PROGRAMS += fix-gnustack
515 -fix_gnustack_SOURCES = fix-gnustack.c
516 -endif
517
518 diff --git a/tests/Makefile.am b/tests/Makefile.am
519 index 02e85b9..5deca02 100644
520 --- a/tests/Makefile.am
521 +++ b/tests/Makefile.am
522 @@ -1,6 +1,3 @@
523 ACLOCAL_AMFLAGS = -I m4
524
525 SUBDIRS = paxmodule pxtpax revdeppaxtest
526 -if BUILD_ELF
527 -SUBDIRS += gnustack
528 -endif