diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2007-01-19 15:13:29 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2007-01-19 15:13:29 +0000 |
commit | d8cf8b513333c644cc5305eff9d5c0dfcac69de5 (patch) | |
tree | 56edbe9735dd0cdbcd4825f6d4321552670f4b63 /ld/testsuite | |
parent | b81428656759ee87a5619f8495c04123ec71d582 (diff) | |
download | gdb-d8cf8b513333c644cc5305eff9d5c0dfcac69de5.zip gdb-d8cf8b513333c644cc5305eff9d5c0dfcac69de5.tar.gz gdb-d8cf8b513333c644cc5305eff9d5c0dfcac69de5.tar.bz2 |
ld/
2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
* ld.h (args_type): Add new symbolic and dynamic_list fields.
* ld.texinfo: Update -Bsymbolic-functions.
* ldmain.c (main): Initialize command_line.symbolic to
symbolic_unset and command_line.dynamic_list to
dynamic_list_unset. Check -Bsymbolic, -Bsymbolic-functions and
--dynamic-list* before setting link_info.symbolic,
link_info.dynamic and link_info.dynamic_data.
* lexsup.c (option_values): Add OPTION_SYMBOLIC_FUNCTIONS.
(ld_options): Use OPTION_SYMBOLIC_FUNCTIONS with
-Bsymbolic-functions.
(parse_args): Handle -Bsymbolic-functions. Don't set
link_info.dynamic, link_info.dynamic_data and link_info.symbolic
here. Set command_line.symbolic for -Bsymbolic. Set
command_line.dynamic_list and command_line.symbolic for
--dynamic-list-data, --dynamic-list-cpp-new,
--dynamic-list-cpp-typeinfo and --dynamic-list.
ld/testsuite/
2007-01-19 H.J. Lu <hongjiu.lu@intel.com>
* ld-elf/dl6.c: New file.
* ld-elf/dl6a.out: Likewise.
* ld-elf/dl6amain.c: Likewise.
* ld-elf/dl6b.out: Likewise.
* ld-elf/dl6bmain.c: Likewise.
* ld-elf/dl6cmain.c: Likewise.
* ld-elf/dl6dmain.c: Likewise.
* ld-elf/shared.exp: Add new tests for -Bsymbolic,
-Bsymbolic-functions, --dynamic-list-data and
--dynamic-list-cpp-new.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ChangeLog | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6.c | 14 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6a.out | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6amain.c | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6b.out | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6bmain.c | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6cmain.c | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/dl6dmain.c | 33 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 108 |
9 files changed, 252 insertions, 18 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index db2440e..2aa43d9 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2007-01-19 H.J. Lu <hongjiu.lu@intel.com> + + * ld-elf/dl6.c: New file. + * ld-elf/dl6a.out: Likewise. + * ld-elf/dl6amain.c: Likewise. + * ld-elf/dl6b.out: Likewise. + * ld-elf/dl6bmain.c: Likewise. + * ld-elf/dl6cmain.c: Likewise. + * ld-elf/dl6dmain.c: Likewise. + + * ld-elf/shared.exp: Add new tests for -Bsymbolic, + -Bsymbolic-functions, --dynamic-list-data and + --dynamic-list-cpp-new. + 2007-01-19 H.J. Lu <hongjiu.lu@intel.com> * ld-elf/maxpage3.t: New file. diff --git a/ld/testsuite/ld-elf/dl6.c b/ld/testsuite/ld-elf/dl6.c new file mode 100644 index 0000000..f655ca6 --- /dev/null +++ b/ld/testsuite/ld-elf/dl6.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +int bar = 10; + +void +foo (void) +{ + if (bar == 10) + printf ("bar is in DSO.\n"); + else if (bar == -20) + printf ("bar is in main.\n"); + else + printf ("FAIL\n"); +} diff --git a/ld/testsuite/ld-elf/dl6a.out b/ld/testsuite/ld-elf/dl6a.out new file mode 100644 index 0000000..186e848 --- /dev/null +++ b/ld/testsuite/ld-elf/dl6a.out @@ -0,0 +1 @@ +bar is in main. diff --git a/ld/testsuite/ld-elf/dl6amain.c b/ld/testsuite/ld-elf/dl6amain.c new file mode 100644 index 0000000..9824224 --- /dev/null +++ b/ld/testsuite/ld-elf/dl6amain.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <dlfcn.h> + +int bar = -20; + +int +main (void) +{ + int ret = 0; + void *handle; + void (*fcn) (void); + + handle = dlopen("./tmpdir/libdl6a.so", RTLD_GLOBAL|RTLD_LAZY); + if (!handle) + { + printf("dlopen ./tmpdir/libdl6a.so: %s\n", dlerror ()); + return 1; + } + + fcn = (void (*)(void)) dlsym(handle, "foo"); + if (!fcn) + { + printf("dlsym foo: %s\n", dlerror ()); + ret += 1; + } + else + { + (*fcn) (); + } + + dlclose (handle); + return ret; +} diff --git a/ld/testsuite/ld-elf/dl6b.out b/ld/testsuite/ld-elf/dl6b.out new file mode 100644 index 0000000..8cc87f5 --- /dev/null +++ b/ld/testsuite/ld-elf/dl6b.out @@ -0,0 +1 @@ +bar is in DSO. diff --git a/ld/testsuite/ld-elf/dl6bmain.c b/ld/testsuite/ld-elf/dl6bmain.c new file mode 100644 index 0000000..df9dbcc --- /dev/null +++ b/ld/testsuite/ld-elf/dl6bmain.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <dlfcn.h> + +int bar = -20; + +int +main (void) +{ + int ret = 0; + void *handle; + void (*fcn) (void); + + handle = dlopen("./tmpdir/libdl6b.so", RTLD_GLOBAL|RTLD_LAZY); + if (!handle) + { + printf("dlopen ./tmpdir/libdl6b.so: %s\n", dlerror ()); + return 1; + } + + fcn = (void (*)(void)) dlsym(handle, "foo"); + if (!fcn) + { + printf("dlsym foo: %s\n", dlerror ()); + ret += 1; + } + else + { + (*fcn) (); + } + + dlclose (handle); + return ret; +} diff --git a/ld/testsuite/ld-elf/dl6cmain.c b/ld/testsuite/ld-elf/dl6cmain.c new file mode 100644 index 0000000..f6c285c --- /dev/null +++ b/ld/testsuite/ld-elf/dl6cmain.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <dlfcn.h> + +int bar = -20; + +int +main (void) +{ + int ret = 0; + void *handle; + void (*fcn) (void); + + handle = dlopen("./tmpdir/libdl6c.so", RTLD_GLOBAL|RTLD_LAZY); + if (!handle) + { + printf("dlopen ./tmpdir/libdl6c.so: %s\n", dlerror ()); + return 1; + } + + fcn = (void (*)(void)) dlsym(handle, "foo"); + if (!fcn) + { + printf("dlsym foo: %s\n", dlerror ()); + ret += 1; + } + else + { + (*fcn) (); + } + + dlclose (handle); + return ret; +} diff --git a/ld/testsuite/ld-elf/dl6dmain.c b/ld/testsuite/ld-elf/dl6dmain.c new file mode 100644 index 0000000..2e57eb7 --- /dev/null +++ b/ld/testsuite/ld-elf/dl6dmain.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <dlfcn.h> + +int bar = -20; + +int +main (void) +{ + int ret = 0; + void *handle; + void (*fcn) (void); + + handle = dlopen("./tmpdir/libdl6d.so", RTLD_GLOBAL|RTLD_LAZY); + if (!handle) + { + printf("dlopen ./tmpdir/libdl6d.so: %s\n", dlerror ()); + return 1; + } + + fcn = (void (*)(void)) dlsym(handle, "foo"); + if (!fcn) + { + printf("dlsym foo: %s\n", dlerror ()); + ret += 1; + } + else + { + (*fcn) (); + } + + dlclose (handle); + return ret; +} diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index a6f9709..19c22a9 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -78,21 +78,39 @@ set build_tests { {"Build libdl2b.so with --dynamic-list=dl2.list and dl2xxx.list" "-shared -Wl,--dynamic-list=dl2.list,--dynamic-list=dl2xxx.list" "-fPIC" {dl2.c dl2xxx.c} {} "libdl2b.so"} - {"Build libdl2b.so with --dynamic-list-data and dl2xxx.list" + {"Build libdl2c.so with --dynamic-list-data and dl2xxx.list" "-shared -Wl,--dynamic-list-data,--dynamic-list=dl2xxx.list" "-fPIC" - {dl2.c dl2xxx.c} {} "libdl2b.so"} + {dl2.c dl2xxx.c} {} "libdl2c.so"} {"Build libdl4a.so with --dynamic-list=dl4.list" "-shared -Wl,--dynamic-list=dl4.list" "-fPIC" {dl4.c dl4xxx.c} {} "libdl4a.so"} - {"Build libdl4a.so with --dynamic-list-data" + {"Build libdl4b.so with --dynamic-list-data" "-shared -Wl,--dynamic-list-data" "-fPIC" - {dl4.c dl4xxx.c} {} "libdl4a.so"} - {"Build libdl4b.so with --dynamic-list=dl4.list and dl4xxx.list" - "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC" {dl4.c dl4xxx.c} {} "libdl4b.so"} - {"Build libdl4b.so with --dynamic-list-data and dl4xxx.list" + {"Build libdl4c.so with --dynamic-list=dl4.list and dl4xxx.list" + "-shared -Wl,--dynamic-list=dl4.list,--dynamic-list=dl4xxx.list" "-fPIC" + {dl4.c dl4xxx.c} {} "libdl4c.so"} + {"Build libdl4d.so with --dynamic-list-data and dl4xxx.list" "-shared -Wl,--dynamic-list-data,--dynamic-list=dl4xxx.list" "-fPIC" - {dl4.c dl4xxx.c} {} "libdl4b.so"} + {dl4.c dl4xxx.c} {} "libdl4d.so"} + {"Build libdl4e.so with -Bsymbolic-functions --dynamic-list-cpp-new" + "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC" + {dl4.c dl4xxx.c} {} "libdl4e.so"} + {"Build libdl4f.so with --dynamic-list-cpp-new -Bsymbolic-functions" + "-shared -Wl,--dynamic-list-cpp-new,-Bsymbolic-functions" "-fPIC" + {dl4.c dl4xxx.c} {} "libdl4f.so"} + {"Build libdl6a.so" + "-shared" "-fPIC" + {dl6.c} {} "libdl6a.so"} + {"Build libdl6b.so with -Bsymbolic --dynamic-list-data" + "-shared -Wl,-Bsymbolic,--dynamic-list-data" "-fPIC" + {dl6.c} {} "libdl6b.so"} + {"Build libdl6c.so with -Bsymbolic" + "-shared -Wl,-Bsymbolic" "-fPIC" + {dl6.c} {} "libdl6c.so"} + {"Build libdl6d.so with --dynamic-list-data -Bsymbolic" + "-shared -Wl,--dynamic-list-data,-Bsymbolic" "-fPIC" + {dl6.c} {} "libdl6d.so"} } set run_tests { @@ -132,24 +150,72 @@ set run_tests { {"Run hidden libbar.so with versioned libfoo.so" "tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" {main.c} "hidden" "hidden.out"} - {"Run dl1 with --dynamic-list=dl1.list and dlopen on libdl1.so" + {"Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" "--dynamic-list=dl1.list -ldl" "" - {dl1main.c} "dl1" "dl1.out"} - {"Run dl1 with --dynamic-list-data and dlopen on libdl1.so" + {dl1main.c} "dl1a" "dl1.out"} + {"Run dl1b with --dynamic-list-data and dlopen on libdl1.so" "--dynamic-list-data -ldl" "" - {dl1main.c} "dl1" "dl1.out"} + {dl1main.c} "dl1b" "dl1.out"} {"Run with libdl2a.so" "tmpdir/libdl2a.so" "" {dl2main.c} "dl2a" "dl2a.out"} {"Run with libdl2b.so" "tmpdir/libdl2b.so" "" {dl2main.c} "dl2b" "dl2b.out"} + {"Run with libdl2c.so" + "tmpdir/libdl2c.so" "" + {dl2main.c} "dl2c" "dl2b.out"} {"Run with libdl4a.so" "tmpdir/libdl4a.so" "" {dl4main.c} "dl4a" "dl4a.out"} {"Run with libdl4b.so" "tmpdir/libdl4b.so" "" - {dl4main.c} "dl4b" "dl4b.out"} + {dl4main.c} "dl4b" "dl4a.out"} + {"Run with libdl4c.so" + "tmpdir/libdl4c.so" "" + {dl4main.c} "dl4c" "dl4b.out"} + {"Run with libdl4d.so" + "tmpdir/libdl4d.so" "" + {dl4main.c} "dl4d" "dl4b.out"} + {"Run with libdl4e.so" + "tmpdir/libdl4e.so" "" + {dl4main.c} "dl4e" "dl4a.out"} + {"Run with libdl4f.so" + "tmpdir/libdl4f.so" "" + {dl4main.c} "dl4f" "dl4a.out"} + {"Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" + "--dynamic-list-data -ldl" "" + {dl6amain.c} "dl6a1" "dl6a.out"} + {"Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" + "-Bsymbolic-functions -ldl" "" + {dl6amain.c} "dl6a2" "dl6b.out"} + {"Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" + "-Bsymbolic -ldl" "" + {dl6amain.c} "dl6a3" "dl6b.out"} + {"Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" + "-Bsymbolic --dynamic-list-data -ldl" "" + {dl6amain.c} "dl6a4" "dl6a.out"} + {"Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" + "-Bsymbolic-functions --dynamic-list-cpp-new -ldl" "" + {dl6amain.c} "dl6a5" "dl6b.out"} + {"Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" + "--dynamic-list-cpp-new -Bsymbolic-functions -ldl" "" + {dl6amain.c} "dl6a6" "dl6b.out"} + {"Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" + "--dynamic-list-data -Bsymbolic -ldl" "" + {dl6amain.c} "dl6a7" "dl6a.out"} + {"Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" + "--dynamic-list-data -ldl" "" + {dl6bmain.c} "dl6b1" "dl6a.out"} + {"Run dl6b2 with dlopen on libdl6b.so" + "-ldl" "" + {dl6bmain.c} "dl6b2" "dl6b.out"} + {"Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" + "--dynamic-list-data -ldl" "" + {dl6cmain.c} "dl6c1" "dl6b.out"} + {"Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" + "--dynamic-list-data -ldl" "" + {dl6dmain.c} "dl6d1" "dl6b.out"} } run_cc_link_tests $build_tests @@ -171,9 +237,12 @@ set build_cxx_tests { {"Build libdl3a.so with --dynamic-list-cpp-typeinfo" "-shared -Wl,--dynamic-list-cpp-typeinfo" "-fPIC" {dl3.cc} {} "libdl3c.so" "c++"} - {"Build libdnew.so with -Bsymbolic-functions -dynamic-list-cpp-new" + {"Build libdnew1a.so with --Bsymbolic-functions --dynamic-list-cpp-new" "-shared -Wl,-Bsymbolic-functions,--dynamic-list-cpp-new" "-fPIC" - {del.cc new.cc} {} "libnew.so" "c++"} + {del.cc new.cc} {} "libnew1a.so" "c++"} + {"Build libdnew1b.so with --dynamic-list-data --dynamic-list-cpp-new" + "-shared -Wl,--dynamic-list-data,--dynamic-list-cpp-new" "-fPIC" + {del.cc new.cc} {} "libnew1b.so" "c++"} } set run_cxx_tests { @@ -186,9 +255,12 @@ set run_cxx_tests { {"Run with libdl3c.so" "tmpdir/libdl3c.so" "" {dl3main.cc} "dl3c" "dl3a.out" "" "c++"} - {"Run with libnew.so" - "tmpdir/libnew.so" "" - {dl5.cc} "dl5" "dl5.out" "" "c++"} + {"Run with libnew1a.so" + "tmpdir/libnew1a.so" "" + {dl5.cc} "dl5a" "dl5.out" "" "c++"} + {"Run with libnew1b.so" + "tmpdir/libnew1b.so" "" + {dl5.cc} "dl5b" "dl5.out" "" "c++"} } run_cc_link_tests $build_cxx_tests |