https://llvm.org/bugs/show_bug.cgi?id=31196
Bug ID: 31196 Summary: lld -Ttext 0x600 (as used in FreeBSD boot loader) results in 4GB output on i386 Product: lld Version: unspecified Hardware: PC OS: FreeBSD Status: NEW Severity: normal Priority: P Component: ELF Assignee: unassignedb...@nondot.org Reporter: ema...@freebsd.org CC: llvm-bugs@lists.llvm.org Blocks: 23214 Classification: Unclassified Created attachment 17677 --> https://llvm.org/bugs/attachment.cgi?id=17677&action=edit reproducer for large output with -Ttext 0x0600 Found while testing the WIP -N support in https://reviews.llvm.org/D26888 The boot0 boot component is linked with the following command line: ld --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -m elf_i386_fbsd -o boot0 -L/usr/lib32 -Ttext 0x600 -e start -N -S --oformat binary boot0.o This produces 4GB output: % ls -l boot0 -rwxr-xr-x 1 emaste emaste 4294903808 28 Nov 18:01 boot0 Outputting as ELF instead by dropping the --oformat binary: % /tank/emaste/src/llvm/build-debug/bin/ld.lld --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -m elf_i386_fbsd -o boot0 -L/usr/lib32 -Ttext 0x600 -e start -N -S boot0.o lets us see what's going on (note the Off column): % readelf -S boot0 There are 8 section headers, starting at offset 0xffff0e60: 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 00000600 ffff0600 000200 00 AX 0 0 4 [ 2] .data PROGBITS 00000800 ffff0800 000000 00 WA 0 0 4 [ 3] .bss NOBITS 00000800 ffff0800 000000 00 WA 0 0 4 [ 4] .comment PROGBITS 00000000 ffff0800 000055 01 MS 0 0 1 [ 5] .symtab SYMTAB 00000000 ffff0858 0003e0 10 7 61 4 [ 6] .shstrtab STRTAB 00000000 ffff0c38 000035 00 0 0 1 [ 7] .strtab STRTAB 00000000 ffff0c6d 0001f1 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) For reference, here's the output when linked by ld.bfd 2.17.50: % readelf -S boot0 There are 5 section headers, starting at offset 0x278: 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 00000600 000054 000200 00 WAX 0 0 4 [ 2] .shstrtab STRTAB 00000000 000254 000021 00 0 0 1 [ 3] .symtab SYMTAB 00000000 000340 000420 10 4 62 4 [ 4] .strtab STRTAB 00000000 000760 000209 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) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs