Committed, CRIS: elf32-cris.c fix *_REF_DYNAMIC not exported from program.
Hans-Peter Nilsson
hans-peter.nilsson@axis.com
Wed Aug 14 22:22:00 GMT 2002
Doh. It seems not many libraries depend on programs exporting
dynamic symbols while not also requiring --export-dynamic. I
see the branch is open; I'll put this there too.
bfd:
* elf32-cris.c (elf_cris_discard_excess_program_dynamics): Add
missing check for whether the symbol is referenced by DSO before
unexporting it as an unneeded dynamic symbol.
ld/testsuite:
* ld-cris/libdso-4.d, ld-cris/undef1.d: New test.
Index: ld-cris/libdso-4.d
===================================================================
RCS file: ld-cris/libdso-4.d
diff -N ld-cris/libdso-4.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld-cris/libdso-4.d 15 Aug 2002 05:16:57 -0000
***************
*** 0 ****
--- 1,11 ----
+ #source: dso-2.s
+ #as: --pic --no-underscore
+ #ld: --shared -m crislinux
+ #objdump: -T
+
+ # DSO with an undef symbol "dsofn". See undef1.d.
+
+ .*: file format elf32-cris
+ #...
+ 0+ D \*UND\* 0+ dsofn
+
Index: ld-cris/undef1.d
===================================================================
RCS file: ld-cris/undef1.d
diff -N ld-cris/undef1.d
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- ld-cris/undef1.d 15 Aug 2002 05:16:57 -0000
***************
*** 0 ****
--- 1,13 ----
+ #source: dso-1.s
+ #source: gotrel1.s --pic
+ #as: --no-underscore
+ #ld: -m crislinux tmpdir/libdso-4.so
+ #objdump: -T
+
+ # The DSO used has an undef reference to the symbol "dsofn", which is
+ # supposed to cause the program to automatically export it as a dynamic
+ # symbol; no --export-dynamic is supposed to be needed.
+
+ #...
+ [0-9a-f]+ g DF .text 00000000 dsofn
+ #pass
Index: elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.35
diff -p -c -r1.35 elf32-cris.c
*** elf32-cris.c 23 Jul 2002 12:29:32 -0000 1.35
--- elf32-cris.c 15 Aug 2002 04:57:33 -0000
*************** elf_cris_discard_excess_program_dynamics
*** 2917,2923 ****
functions; doing this for all symbols would presumably not
introduce new problems. Of course we don't do this if we're
exporting all dynamic symbols. */
! if (! info->export_dynamic)
{
h->root.dynindx = -1;
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
--- 2917,2924 ----
functions; doing this for all symbols would presumably not
introduce new problems. Of course we don't do this if we're
exporting all dynamic symbols. */
! if (! info->export_dynamic
! && (h->root.elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0)
{
h->root.dynindx = -1;
_bfd_elf_strtab_delref (elf_hash_table (info)->dynstr,
brgds, H-P
More information about the Binutils
mailing list