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]

[PATCH] s390 -pie fix


Hi!

Without this I get DT_TEXTREL relocations in PIEs like:
0000000000000e48  0000002200000013 R_390_PC32DBL          0000000000001fc8 __init_array_start + 2
0000000000000e6a  0000002200000013 R_390_PC32DBL          0000000000001fc8 __init_array_start + 2
0000000000000e4e  0000001c00000013 R_390_PC32DBL          0000000000001fc8 __init_array_end + 2
0000000000000ea0  0000001a00000013 R_390_PC32DBL          0000000000001fc8 __fini_array_start + 2
0000000000000ed4  0000001a00000013 R_390_PC32DBL          0000000000001fc8 __fini_array_start + 2
0000000000000ea6  0000001800000013 R_390_PC32DBL          0000000000001fc8 __fini_array_end + 2
(although these symbols are defined in the PIE and thus cannot be overridden,
(and they were hidden as well, just defined in the linker script)).
Unlike ia32/ppc/amd64 I'm afraid I cannot use SYMBOL_CALLS_LOCAL, since
s390* often loads function pointers from pc-relative addressing.

2003-07-04  Jakub Jelinek  <jakub@redhat.com>

	* elf32-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL
	for pc relative relocs.
	(elf_s390_relocate_section): Likewise.
	* elf64-s390.c (allocate_dynrelocs): Use SYMBOL_REFERENCES_LOCAL
	for pc relative relocs.
	(elf_s390_relocate_section): Likewise.

--- bfd/elf32-s390.c.jj	Wed Jun 25 07:53:21 2003
+++ bfd/elf32-s390.c	Fri Jul  4 12:08:11 2003
@@ -1808,9 +1808,7 @@ allocate_dynrelocs (h, inf)
 
   if (info->shared)
     {
-      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
-	  && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
-	      || info->symbolic))
+      if (SYMBOL_REFERENCES_LOCAL (info, h))
 	{
 	  struct elf_s390_dyn_relocs **pp;
 
@@ -2519,10 +2517,7 @@ elf_s390_relocate_section (output_bfd, i
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC32)
 		   || (h != NULL
-		       && h->dynindx != -1
-		       && (! info->symbolic
-			   || (h->elf_link_hash_flags
-			       & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+		       && !SYMBOL_REFERENCES_LOCAL (info, h))))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL
--- bfd/elf64-s390.c.jj	2003-07-04 15:10:57.000000000 -0400
+++ bfd/elf64-s390.c	2003-07-04 15:24:06.000000000 -0400
@@ -1780,9 +1780,7 @@ allocate_dynrelocs (h, inf)
 
   if (info->shared)
     {
-      if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0
-	  && ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0
-	      || info->symbolic))
+      if (SYMBOL_REFERENCES_LOCAL (info, h))
 	{
 	  struct elf_s390_dyn_relocs **pp;
 
@@ -2498,10 +2496,7 @@ elf_s390_relocate_section (output_bfd, i
 		    && r_type != R_390_PC32DBL
 		    && r_type != R_390_PC64)
 		   || (h != NULL
-		       && h->dynindx != -1
-		       && (! info->symbolic
-			   || (h->elf_link_hash_flags
-			       & ELF_LINK_HASH_DEF_REGULAR) == 0))))
+		       && !SYMBOL_REFERENCES_LOCAL (info, h))))
 	      || (ELIMINATE_COPY_RELOCS
 		  && !info->shared
 		  && h != NULL

	Jakub


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