When creating a shared library, bind references to global symbols to the
definition within the shared library, if any. Normally, it is possible
for a program linked against a shared library to override the definition
-within the shared library. This option is only meaningful on ELF
-platforms which support shared libraries.
+within the shared library. This option can also be used with the
+@option{--export-dynamic} option, when creating a position independent
+executable, to bind references to global symbols to the definition within
+the executable. This option is only meaningful on ELF platforms which
+support shared libraries and position independent executables.
@kindex -Bsymbolic-functions
@item -Bsymbolic-functions
When creating a shared library, bind references to global function
symbols to the definition within the shared library, if any.
+This option can also be used with the @option{--export-dynamic} option,
+when creating a position independent executable, to bind references
+to global function symbols to the definition within the executable.
This option is only meaningful on ELF platforms which support shared
-libraries.
+libraries and position independent executables.
@kindex --dynamic-list=@var{dynamic-list-file}
@item --dynamic-list=@var{dynamic-list-file}
/* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
--dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
--dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
- for shared libraries. -Bsymbolic overrides all others and vice
- versa. */
+ for PIC outputs. -Bsymbolic overrides all others and vice versa. */
switch (command_line.symbolic)
{
case symbolic_unset:
break;
case symbolic:
- /* -Bsymbolic is for shared library only. */
- if (bfd_link_dll (&link_info))
+ /* -Bsymbolic is for PIC output only. */
+ if (bfd_link_pic (&link_info))
{
link_info.symbolic = TRUE;
/* Should we free the unused memory? */
}
break;
case symbolic_functions:
- /* -Bsymbolic-functions is for shared library only. */
- if (bfd_link_dll (&link_info))
+ /* -Bsymbolic-functions is for PIC output only. */
+ if (bfd_link_pic (&link_info))
command_line.dynamic_list = dynamic_list_data;
break;
}
run_dump_test "load5b"
run_dump_test "load6"
run_dump_test "pr19175"
+run_dump_test "pr19615"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
--- /dev/null
+#as: --32
+#ld: -pie -Bsymbolic -E -melf_i386
+#readelf: -r --wide --dyn-syms
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Sym. Value Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+
+Symbol table '.dynsym' contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
+#...
--- /dev/null
+ .text
+ .globl _start
+ .type _start, @function
+_start:
+ ret
+
+ .globl xyzzy /* This symbol should be exported */
+ .type xyzzy, @function
+xyzzy:
+ ret
+
+ .section ".xyzzy_ptr","aw",%progbits
+ .dc.a xyzzy
--- /dev/null
+#as: --64
+#ld: -pie -Bsymbolic -E -melf_x86_64
+#readelf: -r --wide --dyn-syms
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9]+
+
+Symbol table '.dynsym' contains [0-9]+ entries:
+ Num: Value Size Type Bind Vis Ndx Name
+#...
+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
+#...
--- /dev/null
+ .text
+ .globl _start
+ .type _start, @function
+_start:
+ ret
+
+ .globl xyzzy /* This symbol should be exported */
+ .type xyzzy, @function
+xyzzy:
+ ret
+
+ .section ".xyzzy_ptr","aw",%progbits
+ .dc.a xyzzy
run_dump_test "pr19162"
run_dump_test "pr19175"
run_dump_test "pr18591"
+run_dump_test "pr19615"
# Add $PLT_CFLAGS if PLT is expected.
global PLT_CFLAGS