This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] MIPS/BFD: Handle RELA TLS_DTPMOD64 and TLS_TPREL64 relocs
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: binutils at sourceware dot org
- Cc: "Maciej W. Rozycki" <macro at linux-mips dot org>
- Date: Wed, 2 Sep 2009 00:40:00 +0100 (BST)
- Subject: [PATCH] MIPS/BFD: Handle RELA TLS_DTPMOD64 and TLS_TPREL64 relocs
Hello,
I have discovered a problem with `objdump -R' that does not decode names
for R_MIPS_TLS_DTPMOD64 and R_MIPS_TLS_TPREL64 relocations in dynamic RELA
sections. It may have been missed before, because the MIPS linker uses
the REL format for dynamic relocation sections. The prelinker however
converts such sections to RELA.
An obvious fix follows -- both R_MIPS_TLS_DTPMOD64 and R_MIPS_TLS_TPREL64
relocations are only used in the dynamic link, so the presence or absence
of the howtos does not affect the BFD linker; `objdump' however uses these
tables to decode names of relocations.
Tested for the mips-linux-gnu target, no regressions.
bfd/
2009-09-01 Maciej W. Rozycki <macro@codesourcery.com>
* elf64-mips.c (mips_elf64_howto_table_rela): Add support for
R_MIPS_TLS_DTPMOD64 and R_MIPS_TLS_TPREL64, replacing the
respective stubs.
OK to apply?
Maciej
binutils-2.19.51-20090827-mips-reloc-tls64-1.patch
Index: bfd/elf64-mips.c
===================================================================
--- bfd/elf64-mips.c
+++ bfd/elf64-mips.c
@@ -1328,7 +1328,20 @@ static reloc_howto_type mips_elf64_howto
/* TLS relocations. */
EMPTY_HOWTO (R_MIPS_TLS_DTPMOD32),
EMPTY_HOWTO (R_MIPS_TLS_DTPREL32),
- EMPTY_HOWTO (R_MIPS_TLS_DTPMOD64),
+
+ HOWTO (R_MIPS_TLS_DTPMOD64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_TLS_DTPMOD64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
HOWTO (R_MIPS_TLS_DTPREL64, /* type */
0, /* rightshift */
@@ -1419,8 +1432,22 @@ static reloc_howto_type mips_elf64_howto
0x0000ffff, /* dst_mask */
FALSE), /* pcrel_offset */
+ /* TLS IE dynamic relocations. */
EMPTY_HOWTO (R_MIPS_TLS_TPREL32),
- EMPTY_HOWTO (R_MIPS_TLS_TPREL64),
+
+ HOWTO (R_MIPS_TLS_TPREL64, /* type */
+ 0, /* rightshift */
+ 4, /* size (0 = byte, 1 = short, 2 = long) */
+ 64, /* bitsize */
+ FALSE, /* pc_relative */
+ 0, /* bitpos */
+ complain_overflow_dont, /* complain_on_overflow */
+ _bfd_mips_elf_generic_reloc, /* special_function */
+ "R_MIPS_TLS_TPREL64", /* name */
+ TRUE, /* partial_inplace */
+ MINUS_ONE, /* src_mask */
+ MINUS_ONE, /* dst_mask */
+ FALSE), /* pcrel_offset */
/* TLS thread pointer offset. */
HOWTO (R_MIPS_TLS_TPREL_HI16, /* type */