------- Additional Comments From hjl at lucon dot org 2007-02-23 13:09 ------- Linker should issue an error when a section is placed into a segment improperly:
[EMAIL PROTECTED] objcopy-2]$ cat foo.t OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) PHDRS { text PT_LOAD FLAGS(5); /* R_E */ data PT_LOAD FLAGS(7); /* RWE */ } SECTIONS { . = 0xC0000000 + ((0x100000 + (0x100000 - 1)) & ~(0x100000 - 1)); .bar : AT(ADDR(.bar) - 0xC0000000) { *(.bar) } :text .bss : AT(ADDR(.bss) - 0xC0000000) { *(.bss) } .foo 0 : AT(ADDR(.bss) + SIZEOF(.bss) - 0xC0000000) { *(.foo) } :text /DISCARD/ : { *(.*) } } [EMAIL PROTECTED] objcopy-2]$ cat foo.s .section .bar,"ax","progbits" .byte 0 .section .foo,"aw","progbits" .byte 0 .bss .long 0 [EMAIL PROTECTED] objcopy-2]$ make copy as --32 -o foo.o foo.s ./ld -m elf_i386 -o foo -T foo.t foo.o objcopy foo foo-cpy BFD: foo-cpy: warning: allocated section `.foo' not in segment [EMAIL PROTECTED] objcopy-2]$ make readelf -lS foo There are 7 section headers, starting at offset 0x1034: Section Headers: [Nr] Name Type Addr Off Size ES Flg Lk Inf Al [ 0] NULL 00000000 000000 000000 00 0 0 0 [ 1] .bar PROGBITS c0100000 001000 000001 00 AX 0 0 1 [ 2] .bss NOBITS c0100004 001001 000004 00 WA 0 0 4 [ 3] .foo PROGBITS 00000000 001008 000001 00 WA 0 0 1 [ 4] .shstrtab STRTAB 00000000 001009 00002a 00 0 0 1 [ 5] .symtab SYMTAB 00000000 00114c 000040 10 6 4 4 [ 6] .strtab STRTAB 00000000 00118c 000001 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) Elf file type is EXEC (Executable file) Entry point 0x0 There are 1 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0xc0100000 0x00100000 0x00009 0x00010 R E 0x1000 Section to Segment mapping: Segment Sections... 00 .bar .bss [EMAIL PROTECTED] objcopy-2]$ -- What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID | Summary|problems with linker / strip|Linker failed to issue an |/ BFD |error on bad section in | |segment Version|2.17 |2.18 (HEAD) http://sourceware.org/bugzilla/show_bug.cgi?id=4007 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils