PR ld/31710
* testsuite/ld-elf/wrap.exp: Run ld/31710 tests.
* testsuite/ld-elf/wrap2.h: New file.
* testsuite/ld-elf/wrap2a.c: Likewise.
* testsuite/ld-elf/wrap2b.c: Likewise.
run_cc_link_tests $build_tests
run_ld_link_exec_tests $run_tests
}
+
+run_ld_link_tests [list \
+ [list \
+ "Build libwrap2.a" \
+ "" \
+ "" \
+ "" \
+ {wrap2a.c} \
+ {} \
+ "libwrap2.a" \
+ "-g" \
+ ] \
+]
+
+# Test very simple native Linux/x86 programs with linux-x86.S.
+run_ld_link_exec_tests [list \
+ [list \
+ "Run wrap2" \
+ "-Wl,--wrap=impl" \
+ "" \
+ { wrap2b.c } \
+ "wrap2" \
+ "pass.out" \
+ "-g" \
+ ] \
+]
--- /dev/null
+struct ops
+{
+ void (*loaded)(void);
+};
+
+extern struct ops impl;
--- /dev/null
+#include "wrap2.h"
+
+static void
+loaded (void)
+{
+}
+
+struct ops impl =
+{
+ .loaded = loaded
+};
--- /dev/null
+#include <stdio.h>
+#include "wrap2.h"
+
+static void
+loaded(void)
+{
+ printf ("PASS\n");
+}
+
+struct ops __wrap_impl =
+{
+ .loaded = loaded,
+};
+
+int
+main()
+{
+ impl.loaded ();
+ return 0;
+}