aboutsummaryrefslogtreecommitdiff
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
commitbd695bcc90bf296d67a85cd49c6fe1879715e04e (patch)
tree9de0bb06ca92c46caca204787b67571d102e7354 /bfd/elf32-sparc.c
parentac119ae83bf6d1a1fd5f8aa609180dacf220a3e8 (diff)
downloadgdb-bd695bcc90bf296d67a85cd49c6fe1879715e04e.zip
gdb-bd695bcc90bf296d67a85cd49c6fe1879715e04e.tar.gz
gdb-bd695bcc90bf296d67a85cd49c6fe1879715e04e.tar.bz2
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 1669aaa..74c1627 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;