Objcopy fix for relocation sections
Daniel Jacobowitz
drow@mvista.com
Mon Dec 22 22:02:00 GMT 2003
More information about the Binutils mailing list
Mon Dec 22 22:02:00 GMT 2003
- Previous message (by thread): [patch] gas: texi2pod warning fixes
- Next message (by thread): Objcopy fix for relocation sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I got a bug report that objcopy failed for shared libraries with "File truncated" on arm-linux. The problem was that ARM keeps relocations for debug information, and objcopy never arranged for elf.c:assign_file_position_for_relocs to be called. This patch was the best solution I could come up with - is it OK? -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2003-12-22 Daniel Jacobowitz <drow@mvista.com> * elf.c (_bfd_elf_set_section_contents): If a relocation section does not have an offset, assign one. Index: elf.c =================================================================== RCS file: /cvs/src/src/bfd/elf.c,v retrieving revision 1.210 diff -u -p -r1.210 elf.c --- elf.c 22 Nov 2003 10:45:44 -0000 1.210 +++ elf.c 22 Dec 2003 21:02:47 -0000 @@ -6109,6 +6109,17 @@ _bfd_elf_set_section_contents (bfd *abfd return FALSE; hdr = &elf_section_data (section)->this_hdr; + + /* Unallocated relocation sections may not have a file offset yet. Give + them one now. */ + if ((hdr->sh_type == SHT_REL || hdr->sh_type == SHT_RELA) + && hdr->sh_offset == -1) + { + file_ptr off = elf_tdata (abfd)->next_file_pos; + off = _bfd_elf_assign_file_position_for_section (hdr, off, TRUE); + elf_tdata (abfd)->next_file_pos = off; + } + pos = hdr->sh_offset + offset; if (bfd_seek (abfd, pos, SEEK_SET) != 0 || bfd_bwrite (location, count, abfd) != count)
- Previous message (by thread): [patch] gas: texi2pod warning fixes
- Next message (by thread): Objcopy fix for relocation sections
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list