58725c
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
58725c
index 9ac1840316..748f56b844 100644
58725c
--- a/ld/emultempl/elf32.em
58725c
+++ b/ld/emultempl/elf32.em
58725c
@@ -2676,6 +2676,10 @@ fragment <
58725c
 	  link_info.noexecstack = TRUE;
58725c
 	  link_info.execstack = FALSE;
58725c
 	}
58725c
+      else if (strcmp (optarg, "globalaudit") == 0)
58725c
+	{
58725c
+	  link_info.flags_1 |= DF_1_GLOBAUDIT;
58725c
+	}
58725c
 EOF
58725c
 
58725c
 if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
58725c
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
58725c
index ebe7e7b7bd..bbfa9fd4f4 100644
58725c
--- a/ld/ld.texinfo
58725c
+++ b/ld/ld.texinfo
58725c
@@ -1136,6 +1136,14 @@ This option is only meaningful when building a shared object.  It makes
58725c
 the symbols defined by this shared object available for symbol resolution
58725c
 of subsequently loaded libraries.
58725c
 
58725c
+@item globalaudit
58725c
+This option is only meaningful when building a dynamic executable.
58725c
+This option marks the executable as requiring global auditing by
58725c
+setting the @code{DF_1_GLOBAUDIT} bit in the @code{DT_FLAGS_1} dynamic
58725c
+tag.  Global auditing requires that any auditing library defined via
58725c
+the @option{--depaudit} or @option{-P} command line options be run for
58725c
+all dynamic objects loaded by the application. 
58725c
+
58725c
 @item initfirst
58725c
 This option is only meaningful when building a shared object.
58725c
 It marks the object so that its runtime initialization will occur
58725c
diff --git a/ld/lexsup.c b/ld/lexsup.c
58725c
index effa277b16..1adb302a14 100644
58725c
--- a/ld/lexsup.c
58725c
+++ b/ld/lexsup.c
58725c
@@ -1828,6 +1828,8 @@ elf_static_list_options (FILE *file)
58725c
   -z execstack                Mark executable as requiring executable stack\n"));
58725c
   fprintf (file, _("\
58725c
   -z noexecstack              Mark executable as not requiring executable stack\n"));
58725c
+  fprintf (file, _("\
58725c
+  -z globalaudit              Mark executable requiring global auditing\n"));
58725c
 }
58725c
 
58725c
 static void
58725c
diff --git a/ld/testsuite/ld-elf/audit.exp b/ld/testsuite/ld-elf/audit.exp
58725c
index 83ee35582e..b7af4b72cf 100644
58725c
--- a/ld/testsuite/ld-elf/audit.exp
58725c
+++ b/ld/testsuite/ld-elf/audit.exp
58725c
@@ -60,6 +60,9 @@ set build_tests {
58725c
   {"Run with -lusesaudit -lusesaudit2"
58725c
      "-Ltmpdir/ -lusesaudit -lusesaudit2" ""
58725c
      {main.c} {{"readelf" {-d} "depaudit2.rd"}} "useslibusesaudit2.out"}
58725c
+  {"Link with -z globalaudit"
58725c
+     "-Wl,-Paudit.so -Wl,-z,globalaudit" ""
58725c
+     {main.c} {{"readelf" {-d} "globalaudit.rd"}} "globalaudit.out"}	
58725c
 }
58725c
 
58725c
 run_cc_link_tests $build_tests
58725c
--- /dev/null	2017-08-11 08:05:42.291658471 +0100
58725c
+++ ld/testsuite/ld-elf/globalaudit.rd	2017-08-11 15:32:41.009073026 +0100
58725c
@@ -0,0 +1,3 @@
58725c
+#...
58725c
+.*\(FLAGS_1\).*Flags: GLOBAUDIT
58725c
+#pass