This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[PATCH] Fix bfd_generic_get_relocated_section_contents on IA-64
- From: Jakub Jelinek <jakub at redhat dot com>
- To: rth at redhat dot com
- Cc: binutils at sources dot redhat dot com, drepper at redhat dot com
- Date: Tue, 30 Sep 2003 20:34:35 +0200
- Subject: [PATCH] Fix bfd_generic_get_relocated_section_contents on IA-64
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Following testcase:
/* gcc -shared -g -O2 -fpic -Wl,-z,defs test.c -o test.so /lib/ld-linux-ia64.so.2 */
static __thread int i;
extern int bar;
int *foo (void)
{
return &i + bar;
}
(distilled from glibc with a buggy patch) causes linker abort.
The problem is that .rela.debug_info contains R_IA64_DTPREL64LSB
relocation and ia64_howto_table incorrectly used howto->size 8
(which is 16 bytes) for it, which means bfd_perform_relocation returned
bfd_reloc_other and bfd_generic_get_relocated_section_contents aborted.
Apparently I wrote the sizes in bytes instead of the weirdo encoding.
Ok to commit?
BTW: I have doubts about other relocs:
IA64_HOWTO (R_IA64_IPLTMSB, "IPLTMSB", 4, FALSE, TRUE),
IA64_HOWTO (R_IA64_IPLTLSB, "IPLTLSB", 4, FALSE, TRUE),
IA64_HOWTO (R_IA64_COPY, "COPY", 4, FALSE, TRUE),
I'd say the former two should be size NN/8 (16 bytes for elf64_ia64,
8 bytes for elf32_ia64) and R_IA64_COPY should be size 3 (0 bytes).
2003-09-30 Jakub Jelinek <jakub@redhat.com>
* elfxx-ia64.c (ia64_howto_table): Fix size of R_IA64_TPREL64[LM]SB,
R_IA64_DTPREL{32,64}[LM]SB and R_IA64_DTPMOD64[LM]SB.
--- bfd/elfxx-ia64.c.jj 2003-09-30 16:44:32.000000000 +0200
+++ bfd/elfxx-ia64.c 2003-09-30 17:53:11.000000000 +0200
@@ -446,21 +446,21 @@ static reloc_howto_type ia64_howto_table
IA64_HOWTO (R_IA64_TPREL14, "TPREL14", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_TPREL22, "TPREL22", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_TPREL64I, "TPREL64I", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 8, FALSE, FALSE),
- IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 8, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL64MSB, "TPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_TPREL64LSB, "TPREL64LSB", 4, FALSE, FALSE),
IA64_HOWTO (R_IA64_LTOFF_TPREL22, "LTOFF_TPREL22", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 8, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 8, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPMOD64MSB, "TPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPMOD64LSB, "TPREL64LSB", 4, FALSE, FALSE),
IA64_HOWTO (R_IA64_LTOFF_DTPMOD22, "LTOFF_DTPMOD22", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_DTPREL14, "DTPREL14", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_DTPREL22, "DTPREL22", 0, FALSE, FALSE),
IA64_HOWTO (R_IA64_DTPREL64I, "DTPREL64I", 0, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 4, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 8, FALSE, FALSE),
- IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 8, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL32MSB, "DTPREL32MSB", 2, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL32LSB, "DTPREL32LSB", 2, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL64MSB, "DTPREL64MSB", 4, FALSE, FALSE),
+ IA64_HOWTO (R_IA64_DTPREL64LSB, "DTPREL64LSB", 4, FALSE, FALSE),
IA64_HOWTO (R_IA64_LTOFF_DTPREL22, "LTOFF_DTPREL22", 0, FALSE, FALSE),
};
Jakub