This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed, elf32-cris.c: Fix constant GOT entry.


Oopsie.  Guaranteed SEGV if you happen to include
-fpic/-fPIC-compiled objects (not DSO:s) with your program and
no DSO uses a symbol that seemed to need a GOT entry at time of
compilation.  Had I looked inside .got for some of the existing
tests, I'd seen that they were wrong (zero).

ld/testsuite:
	* ld-cris/expdyn6.d, ld-cris/weakref2.d, ld-cris/expdyn7.d,
	ld-cris/nodyn5.d, ld-cris/expdyn5.d: New tests.

bfd:
	* elf32-cris.c (cris_elf_relocate_section) <case R_CRIS_16_GOT,
	case R_CRIS_32_GOT>: Correct test for filling in constant .got
	contents, enabling for a non-DSO, for symbols defined in the
	program with --export-dynamic.

Index: ld-cris/expdyn5.d
===================================================================
RCS file: ld-cris/expdyn5.d
diff -N ld-cris/expdyn5.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld-cris/expdyn5.d	7 Nov 2002 13:08:45 -0000
***************
*** 0 ****
--- 1,13 ----
+ #source: expdyn1.s
+ #source: expdref1.s --pic
+ #as: --no-underscore
+ #ld: -m crislinux --export-dynamic tmpdir/libdso-1.so
+ #objdump: -s -j .got
+ 
+ # Like expdyn2.d, but testing that the .got contents is correct.  There
+ # needs to be a .got due to the GOT relocs, but the entry is constant.
+ 
+ .*:     file format elf32-cris
+ Contents of section \.got:
+  8228c 24220800 00000000 00000000 06020800  .*
+  8229c 20220800                             .*
Index: ld-cris/expdyn6.d
===================================================================
RCS file: ld-cris/expdyn6.d
diff -N ld-cris/expdyn6.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld-cris/expdyn6.d	7 Nov 2002 13:08:45 -0000
***************
*** 0 ****
--- 1,13 ----
+ #source: expdyn1.s
+ #source: expdref1.s --pic
+ #source: euwref1.s --pic
+ #as: --no-underscore
+ #ld: -m crislinux --export-dynamic tmpdir/libdso-1.so
+ #objdump: -s -j .got
+ 
+ # Like expdyn5.d, weakly referencing symbols.
+ 
+ .*:     file format elf32-cris
+ Contents of section \.got:
+  822ec 84220800 00000000 00000000 00000000  .*
+  822fc 4e020800 80220800                    .*
Index: ld-cris/expdyn7.d
===================================================================
RCS file: ld-cris/expdyn7.d
diff -N ld-cris/expdyn7.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld-cris/expdyn7.d	7 Nov 2002 13:08:45 -0000
***************
*** 0 ****
--- 1,13 ----
+ #source: expdyn1.s
+ #source: expdref1.s --pic
+ #source: comref1.s --pic
+ #as: --no-underscore
+ #ld: -m crislinux --export-dynamic tmpdir/libdso-1.so
+ #objdump: -s -j .got
+ 
+ # Like expdyn5.d, referencing COMMON symbols.
+ 
+ .*:     file format elf32-cris
+ Contents of section \.got:
+  822ec 84220800 00000000 00000000 04230800  .*
+  822fc 4b020800 80220800                    .*
Index: ld-cris/nodyn5.d
===================================================================
RCS file: ld-cris/nodyn5.d
diff -N ld-cris/nodyn5.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld-cris/nodyn5.d	7 Nov 2002 13:08:45 -0000
***************
*** 0 ****
--- 1,13 ----
+ #source: expdyn1.s
+ #source: expdref1.s --pic
+ #source: comref1.s --pic
+ #as: --no-underscore
+ #ld: -m crislinux
+ #objdump: -s -j .got
+ 
+ # Like nodyn4.d, but checking .got contents.
+ 
+ .*:     file format elf32-cris
+ Contents of section \.got:
+  820c4 00000000 00000000 00000000 dc200800  .*
+  820d4 76000800 c0200800                    .*
Index: ld-cris/weakref2.d
===================================================================
RCS file: ld-cris/weakref2.d
diff -N ld-cris/weakref2.d
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- ld-cris/weakref2.d	7 Nov 2002 13:08:45 -0000
***************
*** 0 ****
--- 1,10 ----
+ #source: gotrel2.s
+ #as: --pic --no-underscore
+ #ld: -m crislinux tmpdir/libdso-1.so
+ #objdump: -s -j .got
+ 
+ # Like weakref1.d, but check contents of .got.
+ 
+ .*:     file format elf32-cris
+ Contents of section \.got:
+  82248 e0210800 00000000 00000000 00000000  .*

Index: elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.36
diff -p -c -r1.36 elf32-cris.c
*** elf32-cris.c	15 Aug 2002 05:20:54 -0000	1.36
--- elf32-cris.c	7 Nov 2002 12:58:46 -0000
*************** cris_elf_relocate_section (output_bfd, i
*** 1022,1028 ****
  		BFD_ASSERT (off != (bfd_vma) -1);
  
  		if (!elf_hash_table (info)->dynamic_sections_created
! 		    || (! info->shared && h->dynindx == -1)
  		    || (info->shared
  			&& (info->symbolic || h->dynindx == -1)
  			&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
--- 1022,1029 ----
  		BFD_ASSERT (off != (bfd_vma) -1);
  
  		if (!elf_hash_table (info)->dynamic_sections_created
! 		    || (! info->shared
! 			&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
  		    || (info->shared
  			&& (info->symbolic || h->dynindx == -1)
  			&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]