|
|
752103b |
diff -upr binutils-2.26.orig/ld/ld.texinfo binutils-2.26/ld/ld.texinfo
|
|
|
752103b |
--- binutils-2.26.orig/ld/ld.texinfo 2016-02-16 10:45:43.245336561 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/ld.texinfo 2016-02-16 10:47:04.670763451 +0000
|
|
|
752103b |
@@ -1325,15 +1325,21 @@ libraries.
|
|
|
752103b |
When creating a shared library, bind references to global symbols to the
|
|
|
752103b |
definition within the shared library, if any. Normally, it is possible
|
|
|
752103b |
for a program linked against a shared library to override the definition
|
|
|
752103b |
-within the shared library. This option is only meaningful on ELF
|
|
|
752103b |
-platforms which support shared libraries.
|
|
|
752103b |
+within the shared library. This option can also be used with the
|
|
|
752103b |
+@option{--export-dynamic} option, when creating a position independent
|
|
|
752103b |
+executable, to bind references to global symbols to the definition within
|
|
|
752103b |
+the executable. This option is only meaningful on ELF platforms which
|
|
|
752103b |
+support shared libraries and position independent executables.
|
|
|
752103b |
|
|
|
752103b |
@kindex -Bsymbolic-functions
|
|
|
752103b |
@item -Bsymbolic-functions
|
|
|
752103b |
When creating a shared library, bind references to global function
|
|
|
752103b |
symbols to the definition within the shared library, if any.
|
|
|
752103b |
+This option can also be used with the @option{--export-dynamic} option,
|
|
|
752103b |
+when creating a position independent executable, to bind references
|
|
|
752103b |
+to global function symbols to the definition within the executable.
|
|
|
752103b |
This option is only meaningful on ELF platforms which support shared
|
|
|
752103b |
-libraries.
|
|
|
752103b |
+libraries and position independent executables.
|
|
|
752103b |
|
|
|
752103b |
@kindex --dynamic-list=@var{dynamic-list-file}
|
|
|
752103b |
@item --dynamic-list=@var{dynamic-list-file}
|
|
|
752103b |
diff -upr binutils-2.26.orig/ld/lexsup.c binutils-2.26/ld/lexsup.c
|
|
|
752103b |
--- binutils-2.26.orig/ld/lexsup.c 2016-02-16 10:45:43.246336567 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/lexsup.c 2016-02-16 10:47:04.671763456 +0000
|
|
|
752103b |
@@ -1586,15 +1586,14 @@ parse_args (unsigned argc, char **argv)
|
|
|
752103b |
/* We may have -Bsymbolic, -Bsymbolic-functions, --dynamic-list-data,
|
|
|
752103b |
--dynamic-list-cpp-new, --dynamic-list-cpp-typeinfo and
|
|
|
752103b |
--dynamic-list FILE. -Bsymbolic and -Bsymbolic-functions are
|
|
|
752103b |
- for shared libraries. -Bsymbolic overrides all others and vice
|
|
|
752103b |
- versa. */
|
|
|
752103b |
+ for PIC outputs. -Bsymbolic overrides all others and vice versa. */
|
|
|
752103b |
switch (command_line.symbolic)
|
|
|
752103b |
{
|
|
|
752103b |
case symbolic_unset:
|
|
|
752103b |
break;
|
|
|
752103b |
case symbolic:
|
|
|
752103b |
- /* -Bsymbolic is for shared library only. */
|
|
|
752103b |
- if (bfd_link_dll (&link_info))
|
|
|
752103b |
+ /* -Bsymbolic is for PIC output only. */
|
|
|
752103b |
+ if (bfd_link_pic (&link_info))
|
|
|
752103b |
{
|
|
|
752103b |
link_info.symbolic = TRUE;
|
|
|
752103b |
/* Should we free the unused memory? */
|
|
|
752103b |
@@ -1603,8 +1602,8 @@ parse_args (unsigned argc, char **argv)
|
|
|
752103b |
}
|
|
|
752103b |
break;
|
|
|
752103b |
case symbolic_functions:
|
|
|
752103b |
- /* -Bsymbolic-functions is for shared library only. */
|
|
|
752103b |
- if (bfd_link_dll (&link_info))
|
|
|
752103b |
+ /* -Bsymbolic-functions is for PIC output only. */
|
|
|
752103b |
+ if (bfd_link_pic (&link_info))
|
|
|
752103b |
command_line.dynamic_list = dynamic_list_data;
|
|
|
752103b |
break;
|
|
|
752103b |
}
|
|
|
752103b |
diff -upr binutils-2.26.orig/ld/testsuite/ld-i386/i386.exp binutils-2.26/ld/testsuite/ld-i386/i386.exp
|
|
|
752103b |
--- binutils-2.26.orig/ld/testsuite/ld-i386/i386.exp 2016-02-16 10:45:43.319336949 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-i386/i386.exp 2016-02-16 10:47:04.672763461 +0000
|
|
|
752103b |
@@ -319,6 +319,7 @@ run_dump_test "load5a"
|
|
|
752103b |
run_dump_test "load5b"
|
|
|
752103b |
run_dump_test "load6"
|
|
|
752103b |
run_dump_test "pr19175"
|
|
|
752103b |
+run_dump_test "pr19615"
|
|
|
752103b |
|
|
|
752103b |
if { !([istarget "i?86-*-linux*"]
|
|
|
752103b |
|| [istarget "i?86-*-gnu*"]
|
|
|
752103b |
--- /dev/null 2016-02-16 08:27:18.513962320 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-i386/pr19615.s 2016-02-16 10:56:11.886632341 +0000
|
|
|
752103b |
@@ -0,0 +1,13 @@
|
|
|
752103b |
+ .text
|
|
|
752103b |
+ .globl _start
|
|
|
752103b |
+ .type _start, @function
|
|
|
752103b |
+_start:
|
|
|
752103b |
+ ret
|
|
|
752103b |
+
|
|
|
752103b |
+ .globl xyzzy /* This symbol should be exported */
|
|
|
752103b |
+ .type xyzzy, @function
|
|
|
752103b |
+xyzzy:
|
|
|
752103b |
+ ret
|
|
|
752103b |
+
|
|
|
752103b |
+ .section ".xyzzy_ptr","aw",%progbits
|
|
|
752103b |
+ .dc.a xyzzy
|
|
|
752103b |
--- /dev/null 2016-02-16 08:27:18.513962320 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-i386/pr19615.d 2016-02-16 10:56:11.886632341 +0000
|
|
|
752103b |
@@ -0,0 +1,13 @@
|
|
|
752103b |
+#as: --32
|
|
|
752103b |
+#ld: -pie -Bsymbolic -E -melf_i386
|
|
|
752103b |
+#readelf: -r --wide --dyn-syms
|
|
|
752103b |
+
|
|
|
752103b |
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
|
|
|
752103b |
+ Offset Info Type Sym. Value Symbol's Name
|
|
|
752103b |
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
|
|
|
752103b |
+
|
|
|
752103b |
+Symbol table '.dynsym' contains [0-9]+ entries:
|
|
|
752103b |
+ Num: Value Size Type Bind Vis Ndx Name
|
|
|
752103b |
+#...
|
|
|
752103b |
+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
|
|
|
752103b |
+#...
|
|
|
752103b |
--- /dev/null 2016-02-16 08:27:18.513962320 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-x86-64/pr19615.s 2016-02-16 10:57:55.386174958 +0000
|
|
|
752103b |
@@ -0,0 +1,13 @@
|
|
|
752103b |
+ .text
|
|
|
752103b |
+ .globl _start
|
|
|
752103b |
+ .type _start, @function
|
|
|
752103b |
+_start:
|
|
|
752103b |
+ ret
|
|
|
752103b |
+
|
|
|
752103b |
+ .globl xyzzy /* This symbol should be exported */
|
|
|
752103b |
+ .type xyzzy, @function
|
|
|
752103b |
+xyzzy:
|
|
|
752103b |
+ ret
|
|
|
752103b |
+
|
|
|
752103b |
+ .section ".xyzzy_ptr","aw",%progbits
|
|
|
752103b |
+ .dc.a xyzzy
|
|
|
752103b |
--- /dev/null 2016-02-16 08:27:18.513962320 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-x86-64/pr19615.d 2016-02-16 10:57:55.386174958 +0000
|
|
|
752103b |
@@ -0,0 +1,13 @@
|
|
|
752103b |
+#as: --64
|
|
|
752103b |
+#ld: -pie -Bsymbolic -E -melf_x86_64
|
|
|
752103b |
+#readelf: -r --wide --dyn-syms
|
|
|
752103b |
+
|
|
|
752103b |
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
|
|
|
752103b |
+ Offset Info Type Symbol's Value Symbol's Name \+ Addend
|
|
|
752103b |
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_RELATIVE +[0-9]+
|
|
|
752103b |
+
|
|
|
752103b |
+Symbol table '.dynsym' contains [0-9]+ entries:
|
|
|
752103b |
+ Num: Value Size Type Bind Vis Ndx Name
|
|
|
752103b |
+#...
|
|
|
752103b |
+[ ]*[a-f0-9]+: [a-f0-9]+ 0 FUNC GLOBAL DEFAULT [a-f0-9]+ xyzzy
|
|
|
752103b |
+#...
|
|
|
752103b |
--- binutils-2.26.orig/ld/testsuite/ld-x86-64/x86-64.exp 2016-02-16 10:45:43.443337600 +0000
|
|
|
752103b |
+++ binutils-2.26/ld/testsuite/ld-x86-64/x86-64.exp 2016-02-16 11:01:02.418162157 +0000
|
|
|
752103b |
@@ -353,6 +353,7 @@ run_dump_test "pr19013-x32"
|
|
|
752103b |
run_dump_test "pr19013-nacl"
|
|
|
752103b |
run_dump_test "pr19162"
|
|
|
752103b |
run_dump_test "pr19175"
|
|
|
752103b |
+run_dump_test "pr19615"
|
|
|
752103b |
|
|
|
752103b |
# Add $PLT_CFLAGS if PLT is expected.
|
|
|
752103b |
global PLT_CFLAGS
|