[hjl@gnu-6 testsuite]$ cat x.s .arch armv4 .text bx lr [hjl@gnu-6 testsuite]$ ../as-new -meabi=4 --fix-v4bx -o x.o x.s [hjl@gnu-6 testsuite]$ readelf -S x.o There are 9 section headers, starting at offset 0x94: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000034 000004 00 AX 0 0 1 [ 2] .rel.text REL 00000000 000260 000008 08 7 1 4 [ 3] .data PROGBITS 00000000 000038 000000 00 WA 0 0 1 [ 4] .bss NOBITS 00000000 000038 000000 00 WA 0 0 1 [ 5] .ARM.attributes ARM_ATTRIBUTES 00000000 000038 000019 00 0 0 1 [ 6] .shstrtab STRTAB 00000000 000051 000040 00 0 0 1 [ 7] .symtab SYMTAB 00000000 0001fc 000060 10 8 6 4 [ 8] .strtab STRTAB 00000000 00025c 000004 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) [hjl@gnu-6 testsuite]$ ../../binutils/strip-new --strip-unneeded x.o -o b.o [hjl@gnu-6 testsuite]$ readelf -S b.o There are 7 section headers, starting at offset 0x84: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .text PROGBITS 00000000 000034 000004 00 AX 0 0 1 [ 2] .rel.text REL 00000000 00019c 000008 08 0 1 4 [ 3] .data PROGBITS 00000000 000038 000000 00 WA 0 0 1 [ 4] .bss NOBITS 00000000 000038 000000 00 WA 0 0 1 [ 5] .ARM.attributes ARM_ATTRIBUTES 00000000 000038 000019 00 0 0 1 [ 6] .shstrtab STRTAB 00000000 000051 000030 00 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings) I (info), L (link order), G (group), x (unknown) O (extra OS processing required) o (OS specific), p (processor specific) [hjl@gnu-6 testsuite]$ readelf -r b.o Relocation section '.rel.text' at offset 0x19c contains 1 entries: Offset Info Type Sym.Value Sym. Name 00000000 00000028 R_ARM_V4BX [hjl@gnu-6 testsuite]$ Symbol table is needed for R_ARM_V4BX, which references the first entry of symbol table.
*** Bug 9934 has been marked as a duplicate of this bug. ***
Created attachment 3818 [details] A patch Relocation will need symbol table. This patch will keep symbol table if there are any relocations in output.
Hi H.J. Patch approved - please apply. Cheers Nick
Subject: Bug 9945 CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2009-03-13 13:39:57 Modified files: bfd : ChangeLog elf.c binutils : ChangeLog objcopy.c Log message: bfd/ 2009-03-13 H.J. Lu <hongjiu.lu@intel.com> PR binutils/9945 * elf.c (assign_section_numbers): Generate symbol table if there is any relocation in output. (_bfd_elf_compute_section_file_positions): Likewise. binutils/ 2009-03-13 H.J. Lu <hongjiu.lu@intel.com> PR binutils/9945 * objcopy.c (copy_object): Clear HAS_RELOC when stripping all. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.4497&r2=1.4498 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/bfd/elf.c.diff?cvsroot=src&r1=1.477&r2=1.478 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/ChangeLog.diff?cvsroot=src&r1=1.1439&r2=1.1440 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/binutils/objcopy.c.diff?cvsroot=src&r1=1.126&r2=1.127
Fixed.