[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: as 2.12, 2.13 on sparc -m64: error when linking: relocation trunc at
From: |
Alan Modra |
Subject: |
Re: as 2.12, 2.13 on sparc -m64: error when linking: relocation trunc ated to fit: R_SPARC_DISP32 .gnu.linkonce.t.NewAlloc |
Date: |
Mon, 23 Sep 2002 20:22:46 +0930 |
User-agent: |
Mutt/1.2.5i |
The sparc64-solaris problem is due to
- TEXT_START_ADDR=0x100000000
- R_SPARC_DISP32 used in eh_frame relocs
- relocations against removed linkonce section symbols resolving to zero,
which means a displacement larger than can fit in a 32 bit field.
Fixed as follows.
bfd/ChangeLog
* elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Zero relocs
for discarded FDEs. Remove redundant assignment.
* elflink.h (elf_bfd_discard_info): Save edited relocs.
Index: bfd/elf-eh-frame.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-eh-frame.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf-eh-frame.c
--- bfd/elf-eh-frame.c 23 Aug 2002 09:42:21 -0000 1.14
+++ bfd/elf-eh-frame.c 23 Sep 2002 10:21:07 -0000
@@ -632,11 +632,11 @@ _bfd_elf_discard_section_eh_frame (abfd,
goto free_no_table;
if ((*reloc_symbol_deleted_p) (buf - ehbuf, cookie))
{
- cookie->rel = rel;
/* This is a FDE against discarded section, it should
be deleted. */
new_size -= hdr.length + 4;
sec_info->entry[sec_info->count].removed = 1;
+ memset (rel, 0, sizeof (*rel));
}
else
{
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.186
diff -u -p -r1.186 elflink.h
--- bfd/elflink.h 19 Sep 2002 16:34:14 -0000 1.186
+++ bfd/elflink.h 23 Sep 2002 10:21:15 -0000
@@ -8482,7 +8482,12 @@ elf_bfd_discard_info (output_bfd, info)
if (_bfd_elf_discard_section_eh_frame (abfd, info, eh, ehdr,
elf_reloc_symbol_deleted_p,
&cookie))
- ret = true;
+ {
+ /* Relocs have been edited. Ensure edited version is
+ used later in relocate_section. */
+ elf_section_data (eh)->relocs = cookie.rels;
+ ret = true;
+ }
if (cookie.rels && elf_section_data (eh)->relocs != cookie.rels)
free (cookie.rels);
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre