GNU Binutils with patches for OS216
Revisión | 93ab9c0de7ba4a477720622c7e772d76f646e3f5 (tree) |
---|---|
Tiempo | 2017-08-12 00:36:28 |
Autor | Nick Clifton <nickc@redh...> |
Commiter | Nick Clifton |
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.
@@ -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 | + | |
1 | 14 | 2017-08-11 H.J. Lu <hongjiu.lu@intel.com> |
2 | 15 | |
3 | 16 | PR ld/21884 |
@@ -1,4 +1,7 @@ | ||
1 | 1 | -*- 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. | |
2 | 5 | |
3 | 6 | * Tighten linker script grammar around file name specifiers to prevent the use |
4 | 7 | of SORT_BY_ALIGNMENT and SORT_BY_INIT_PRIORITY on filenames. These would |
@@ -2676,6 +2676,10 @@ fragment <<EOF | ||
2676 | 2676 | link_info.noexecstack = TRUE; |
2677 | 2677 | link_info.execstack = FALSE; |
2678 | 2678 | } |
2679 | + else if (strcmp (optarg, "globalaudit") == 0) | |
2680 | + { | |
2681 | + link_info.flags_1 |= DF_1_GLOBAUDIT; | |
2682 | + } | |
2679 | 2683 | EOF |
2680 | 2684 | |
2681 | 2685 | if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then |
@@ -1136,6 +1136,14 @@ This option is only meaningful when building a shared object. It makes | ||
1136 | 1136 | the symbols defined by this shared object available for symbol resolution |
1137 | 1137 | of subsequently loaded libraries. |
1138 | 1138 | |
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 | + | |
1139 | 1147 | @item initfirst |
1140 | 1148 | This option is only meaningful when building a shared object. |
1141 | 1149 | It marks the object so that its runtime initialization will occur |
@@ -1828,6 +1828,8 @@ elf_static_list_options (FILE *file) | ||
1828 | 1828 | -z execstack Mark executable as requiring executable stack\n")); |
1829 | 1829 | fprintf (file, _("\ |
1830 | 1830 | -z noexecstack Mark executable as not requiring executable stack\n")); |
1831 | + fprintf (file, _("\ | |
1832 | + -z globalaudit Mark executable requiring global auditing\n")); | |
1831 | 1833 | } |
1832 | 1834 | |
1833 | 1835 | static void |
@@ -60,6 +60,9 @@ set build_tests { | ||
60 | 60 | {"Run with -lusesaudit -lusesaudit2" |
61 | 61 | "-Ltmpdir/ -lusesaudit -lusesaudit2" "" |
62 | 62 | {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"} | |
63 | 66 | } |
64 | 67 | |
65 | 68 | run_cc_link_tests $build_tests |
@@ -0,0 +1,3 @@ | ||
1 | +#... | |
2 | +.*\(FLAGS_1\).*Flags: GLOBAUDIT | |
3 | +#pass |