summaryrefslogtreecommitdiff
path: root/bfd/elf32-sparc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-04-11 22:13:28 +0000
committerJakub Jelinek <jakub@redhat.com>2005-04-11 22:13:28 +0000
commit96b399d565fbad7ff49bb51857cec63ba0683dfb (patch)
tree7db0263aedf241e04a6458c02bc3e08343e3f645 /bfd/elf32-sparc.c
parent327c9969b571319298ebf7af1ce93de72ecb06d0 (diff)
downloadbinutils-redhat-96b399d565fbad7ff49bb51857cec63ba0683dfb.tar.gz
2005-04-11 David S. Miller <davem@davemloft.net>
* elf32-sparc.c (elf32_sparc_relocate_section, R_SPARC_TLS_LDO_{HIX22,LOX10}): When not shared, transition to R_SPARC_TLS_LE_{HIX22,LOX10}. (elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_HIX22): Only xor relocation with 0xffffffff if R_SPARC_TLS_LE_HIX22. (elf32_sparc_relocate_section, R_SPARC_TLS_{LDO,LE}_LOX10): Only or 0x1c00 into relocation if R_SPARC_TLS_LE_HIX22. * ld-sparc/tlssunbin32.dd: Update for TLS relocation fixes. * ld-sparc/tlssunbin32.rd: Likewise. * ld-sparc/tlssunbin32.sd: Likewise. * ld-sparc/tlssunpic32.dd: Likewise.
Diffstat (limited to 'bfd/elf32-sparc.c')
-rw-r--r--bfd/elf32-sparc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 1669aaa874..74c16272a3 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -2678,10 +2678,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_TLS_LDO_HIX22:
case R_SPARC_TLS_LDO_LOX10:
if (info->shared)
- relocation -= dtpoff_base (info);
- else
- relocation = tpoff (info, relocation);
- break;
+ {
+ relocation -= dtpoff_base (info);
+ break;
+ }
+
+ r_type = (r_type == R_SPARC_TLS_LDO_HIX22
+ ? R_SPARC_TLS_LE_HIX22 : R_SPARC_TLS_LE_LOX10);
+ /* Fall through. */
case R_SPARC_TLS_LE_HIX22:
case R_SPARC_TLS_LE_LOX10:
@@ -2900,7 +2904,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma x;
relocation += rel->r_addend;
- relocation = relocation ^ 0xffffffff;
+ if (r_type == R_SPARC_TLS_LE_HIX22)
+ relocation = relocation ^ 0xffffffff;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
x = (x & ~(bfd_vma) 0x3fffff) | ((relocation >> 10) & 0x3fffff);
@@ -2913,7 +2918,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma x;
relocation += rel->r_addend;
- relocation = (relocation & 0x3ff) | 0x1c00;
+ relocation &= 0x3ff;
+ if (r_type == R_SPARC_TLS_LE_LOX10)
+ relocation |= 0x1c00;
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
x = (x & ~(bfd_vma) 0x1fff) | relocation;