diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2024-05-08 06:22:20 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2024-05-08 07:01:24 -0700 |
commit | 1509f0c231854b2fd3556d77d6be1f98301bf8a3 (patch) | |
tree | 5c8953368da0c275a5093a362ceeffd8f42d7d7b /ld | |
parent | 1dfd6a2f93a0267a4a358b51ad4ed42feba3d920 (diff) | |
download | gdb-1509f0c231854b2fd3556d77d6be1f98301bf8a3.zip gdb-1509f0c231854b2fd3556d77d6be1f98301bf8a3.tar.gz gdb-1509f0c231854b2fd3556d77d6be1f98301bf8a3.tar.bz2 |
ld: Add PR ld/31710 tests
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.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/wrap.exp | 26 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/wrap2.h | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/wrap2a.c | 11 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/wrap2b.c | 20 |
4 files changed, 63 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/wrap.exp b/ld/testsuite/ld-elf/wrap.exp index 90e2d60..efc44bc 100644 --- a/ld/testsuite/ld-elf/wrap.exp +++ b/ld/testsuite/ld-elf/wrap.exp @@ -52,3 +52,29 @@ if [check_shared_lib_support] { 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" \ + ] \ +] diff --git a/ld/testsuite/ld-elf/wrap2.h b/ld/testsuite/ld-elf/wrap2.h new file mode 100644 index 0000000..8fd9495 --- /dev/null +++ b/ld/testsuite/ld-elf/wrap2.h @@ -0,0 +1,6 @@ +struct ops +{ + void (*loaded)(void); +}; + +extern struct ops impl; diff --git a/ld/testsuite/ld-elf/wrap2a.c b/ld/testsuite/ld-elf/wrap2a.c new file mode 100644 index 0000000..a37655f --- /dev/null +++ b/ld/testsuite/ld-elf/wrap2a.c @@ -0,0 +1,11 @@ +#include "wrap2.h" + +static void +loaded (void) +{ +} + +struct ops impl = +{ + .loaded = loaded +}; diff --git a/ld/testsuite/ld-elf/wrap2b.c b/ld/testsuite/ld-elf/wrap2b.c new file mode 100644 index 0000000..c1f4444 --- /dev/null +++ b/ld/testsuite/ld-elf/wrap2b.c @@ -0,0 +1,20 @@ +#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; +} |