about summary refs log tree commit diff
path: root/elf/tst-ptrguard1.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/tst-ptrguard1.c')
-rw-r--r--elf/tst-ptrguard1.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/elf/tst-ptrguard1.c b/elf/tst-ptrguard1.c
index 91fbc79fdb..8ea65bb0bb 100644
--- a/elf/tst-ptrguard1.c
+++ b/elf/tst-ptrguard1.c
@@ -25,6 +25,12 @@
 #include <tls.h>
 #include <unistd.h>
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+/* Requires _GNU_SOURCE  */
+#include <getopt.h>
+
 #ifndef POINTER_CHK_GUARD
 extern uintptr_t __pointer_chk_guard;
 # define POINTER_CHK_GUARD __pointer_chk_guard
@@ -191,12 +197,21 @@ do_test (void)
 #define CMDLINE_OPTIONS	\
   { "command", required_argument, NULL, OPT_COMMAND },  \
   { "child", no_argument, NULL, OPT_CHILD },
-#define CMDLINE_PROCESS	\
-  case OPT_COMMAND:	\
-    command = optarg;	\
-    break;		\
-  case OPT_CHILD:	\
-    child = true;	\
-    break;
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
+
+static void __attribute((used))
+cmdline_process_function (int c)
+{
+  switch (c)
+    {
+      case OPT_COMMAND:
+        command = optarg;
+        break;
+      case OPT_CHILD:
+        child = true;
+        break;
+    }
+}
+
+#define CMDLINE_PROCESS	cmdline_process_function
+
+#include <support/test-driver.c>