This is the mail archive of the binutils@sourceware.org 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]

[PowerPC64] correct tprel offset limit


I don't expect anyone will have hit this bug.  You'd need a TLS
segment of 2G before you'd notice.

	* elf64-ppc.c (ppc64_elf_tls_optimize): Correct test for allowed
	range of tp-relative offsets.

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index d77cfdf9d2..9d3ba36c02 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7734,9 +7734,8 @@ ppc64_elf_tls_optimize (struct bfd_link_info *info)
 			{
 			  value += sym_sec->output_offset;
 			  value += sym_sec->output_section->vma;
-			  value -= htab->elf.tls_sec->vma;
-			  ok_tprel = (value + TP_OFFSET + ((bfd_vma) 1 << 31)
-				      < (bfd_vma) 1 << 32);
+			  value -= htab->elf.tls_sec->vma + TP_OFFSET;
+			  ok_tprel = value + 0x80008000ULL < 1ULL << 32;
 			}
 		    }
 

-- 
Alan Modra
Australia Development Lab, IBM


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