• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión93ab9c0de7ba4a477720622c7e772d76f646e3f5 (tree)
Tiempo2017-08-12 00:36:28
AutorNick Clifton <nickc@redh...>
CommiterNick Clifton

Log Message

Add -z globalaudit linker command line option to set the DF_GLOBALAUDIT flag bit in the dynamic tags.

* emultempl/elf32.em (handle_option): Accept the -z globalaudit
command line option.
* lexsup.c (elf_static_list_options): Add -z globalaudit.
* ld.texinfo: Document the support for the new command line
option.
* NEWS: Mention the new feature.
* testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit
command line option.
* testsuite/ld-elf/globalaudit.rd: New file: Expected output from
readelf.

Cambiar Resumen

Diferencia incremental

--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,16 @@
1+2017-08-11 Nick Clifton <nickc@redhat.com>
2+
3+ * emultempl/elf32.em (handle_option): Accept the -z globalaudit
4+ command line option.
5+ * lexsup.c (elf_static_list_options): Add -z globalaudit.
6+ * ld.texinfo: Document the support for the new command line
7+ option.
8+ * NEWS: Mention the new feature.
9+ * testsuite/ld-elf/audit.exp: Add a test of the -z globalaudit
10+ command line option.
11+ * testsuite/ld-elf/globalaudit.rd: New file: Expected output from
12+ readelf.
13+
114 2017-08-11 H.J. Lu <hongjiu.lu@intel.com>
215
316 PR ld/21884
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,4 +1,7 @@
11 -*- text -*-
2+* Add -z globalaudit command line option to force audit libraries to be run
3+ for every dynamic object loaded by an executable - provided that the loader
4+ supports this functionality.
25
36 * Tighten linker script grammar around file name specifiers to prevent the use
47 of SORT_BY_ALIGNMENT and SORT_BY_INIT_PRIORITY on filenames. These would
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -2676,6 +2676,10 @@ fragment <<EOF
26762676 link_info.noexecstack = TRUE;
26772677 link_info.execstack = FALSE;
26782678 }
2679+ else if (strcmp (optarg, "globalaudit") == 0)
2680+ {
2681+ link_info.flags_1 |= DF_1_GLOBAUDIT;
2682+ }
26792683 EOF
26802684
26812685 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -1136,6 +1136,14 @@ This option is only meaningful when building a shared object. It makes
11361136 the symbols defined by this shared object available for symbol resolution
11371137 of subsequently loaded libraries.
11381138
1139+@item globalaudit
1140+This option is only meaningful when building a dynamic executable.
1141+This option marks the executable as requiring global auditing by
1142+setting the @code{DF_1_GLOBAUDIT} bit in the @code{DT_FLAGS_1} dynamic
1143+tag. Global auditing requires that any auditing library defined via
1144+the @option{--depaudit} or @option{-P} command line options be run for
1145+all dynamic objects loaded by the application.
1146+
11391147 @item initfirst
11401148 This option is only meaningful when building a shared object.
11411149 It marks the object so that its runtime initialization will occur
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1828,6 +1828,8 @@ elf_static_list_options (FILE *file)
18281828 -z execstack Mark executable as requiring executable stack\n"));
18291829 fprintf (file, _("\
18301830 -z noexecstack Mark executable as not requiring executable stack\n"));
1831+ fprintf (file, _("\
1832+ -z globalaudit Mark executable requiring global auditing\n"));
18311833 }
18321834
18331835 static void
--- a/ld/testsuite/ld-elf/audit.exp
+++ b/ld/testsuite/ld-elf/audit.exp
@@ -60,6 +60,9 @@ set build_tests {
6060 {"Run with -lusesaudit -lusesaudit2"
6161 "-Ltmpdir/ -lusesaudit -lusesaudit2" ""
6262 {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"}
63+ {"Link with -z globalaudit"
64+ "-Wl,-Paudit.so -Wl,-z,globalaudit" ""
65+ {main.c} {{"readelf" {-d} "globalaudit.rd"}} "globalaudit.out"}
6366 }
6467
6568 run_cc_link_tests $build_tests
--- /dev/null
+++ b/ld/testsuite/ld-elf/globalaudit.rd
@@ -0,0 +1,3 @@
1+#...
2+.*\(FLAGS_1\).*Flags: GLOBAUDIT
3+#pass