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: scripts/
Date: Wed, 28 Dec 2011 16:37:32
Message-Id: 6a30317f55891c6d9637a5ac42de0fe9503fff6e.blueness@gentoo
1 commit: 6a30317f55891c6d9637a5ac42de0fe9503fff6e
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 28 16:37:17 2011 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 28 16:37:17 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/elfix.git;a=commit;h=6a30317f
7
8 scripts/revdep-pax: warn only for complex markings
9
10 ---
11 scripts/revdep-pax | 57 +++++++++++++++++++++++++++++++++++++--------------
12 1 files changed, 41 insertions(+), 16 deletions(-)
13
14 diff --git a/scripts/revdep-pax b/scripts/revdep-pax
15 index e2073da..be6a387 100755
16 --- a/scripts/revdep-pax
17 +++ b/scripts/revdep-pax
18 @@ -187,20 +187,45 @@ def run_reverse(verbose, executable_only):
19 print_reverse_linkings( reverse_linkings, so2library_mappings, verbose, executable_only)
20
21
22 -def migrate_flags(elf, pax_flags):
23 - """
24 - Importer Exporter Result
25 - Force On Force On Force On
26 - Force On Force Off Warn Only
27 - Force On Nothing Force On
28 - Force Off Force On Warn Only
29 - Force Off Force Off Force Off
30 - Force Off Nothing Force Off
31 - Nothing Force On Force On
32 - Nothing Force Off Force Off
33 - Nothing Nothing Nothing
34 - """
35 - pax.setflags(elf, pax_flags)
36 +def migrate_flags(importer, exporter_str_flags, exporter_bin_flags):
37 + # We implement the following logic for setting the pax flags
38 + # on the target elf object, the 'importer', given that the
39 + # flags from the elf object we want it to match to, the exporter.
40 + #
41 + # Importer Exporter Result
42 + # Force On Force On Force On
43 + # Force On Force Off Force On + Warn
44 + # Force On Nothing Force On
45 + # Force Off Force On Force Off + Warn
46 + # Force Off Force Off Force Off
47 + # Force Off Nothing Force Off
48 + # Nothing Force On Force On
49 + # Nothing Force Off Force Off
50 + # Nothing Nothing Nothing
51 + #
52 + # The algorithm proceeds by assuming the resulting flags = the exporter
53 + # flags and then changes them in cases where that's not what we want, ie
54 + #
55 + # Force On Force Off Force On + Warn
56 + # Force On Nothing Force On
57 + # Force Off Force On Force Off + Warn
58 + # Force Off Nothing Force Off
59 +
60 + ( importer_str_flags, importer_bin_flags ) = pax.getflags(importer)
61 +
62 + result_bin_flags = exporter_bin_flags
63 +
64 + for i in range(len(importer_str_flags)):
65 + if importer_str_flags[i].isupper() and exporter_str_flags[i].islower():
66 + print 'Warning: importer = %s exporter = %s' % ( importer_str_flags[i], exporter_str_flags[i] )
67 + if importer_str_flags[i].isupper() and exporter_str_flags[i] == '-':
68 + print 'Warning: importer = %s exporter = %s' % ( importer_str_flags[i], exporter_str_flags[i] )
69 + if importer_str_flags[i].islower() and exporter_str_flags[i].isupper():
70 + print 'Warning: importer = %s exporter = %s' % ( importer_str_flags[i], exporter_str_flags[i] )
71 + if importer_str_flags[i].islower() and exporter_str_flags[i] == '-':
72 + print 'Warning: importer = %s exporter = %s' % ( importer_str_flags[i], exporter_str_flags[i] )
73 +
74 + pax.setflags(importer, result_bin_flags)
75
76
77 def run_binary(binary, verbose, mark):
78 @@ -246,7 +271,7 @@ def run_binary(binary, verbose, mark):
79
80 if do_marking:
81 try:
82 - migrate_flags(library, binary_bin_flags)
83 + migrate_flags(library, binary_str_flags, binary_bin_flags)
84 except:
85 print "\n\tCould not set pax flags on %s, file is probably busy" % library
86 print "\tShut down all processes that use it and try again"
87 @@ -326,7 +351,7 @@ def run_soname(name, verbose, use_soname, mark, executable_only):
88 print '\t\tPlease enter y or n'
89 if do_marking:
90 try:
91 - migrate_flags(binary, library_bin_flags)
92 + migrate_flags(binary, library_str_flags, library_bin_flags)
93 except:
94 print "\n\tCould not set pax flags on %s, file is probably busy" % binary
95 print "\tShut down all processes that use it and try again"