mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-27 04:52:05 +08:00
d8cf8b5133
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.
34 lines
504 B
C
34 lines
504 B
C
#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;
|
|
}
|