Skip to content

After r371957 (06bb7dfbd): error: output file too large: 18446744073707016932 bytes #44060

@DimitryAndric

Description

@DimitryAndric
Bugzilla Link 44715
Resolution WONTFIX
Resolved on Feb 26, 2020 15:18
Version unspecified
OS All
Blocks #43900
Attachments Reproduction tarball for negative size problem
CC @dwblaikie,@emaste,@zmodem,@MaskRay,@rui314,@smithp35

Extended Description

Trying to build one of FreeBSD's boot loader components with lld 10.0.0, we see the following error appear:

$ ld.lld --sysroot=/usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/tmp --eh-frame-hdr -Bstatic -m elf_i386_fbsd -o loader_lua.sym -L/usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/tmp/usr/lib -Ttext 0x0 --gc-sections --no-rosegment /usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/stand/i386/btx/lib/crt0.o main.o conf.o vers.o chain.o boot.o commands.o console.o devopen.o interp.o interp_backslash.o interp_parse.o ls.o misc.o module.o load_elf32.o load_elf32_obj.o reloc_elf32.o load_elf64.o load_elf64_obj.o reloc_elf64.o disk.o part.o vdisk.o dev_net.o bcache.o isapnp.o pnp.o interp_lua.o zfs_cmd.o /usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/stand/liblua32/liblua.a /usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/stand/i386/libi386/libi386.a /usr/obj/share/dim/src/freebsd/clang1000-import/amd64.amd64/stand/libsa32/libsa32.a
ld: error: output file too large: 18446744073707016908 bytes

18446744073707016908 = 0xffffffffffd952cc, so it is pretty clear that lld is somehow creating a negative size.

Bisecting shows that this was introduced with https://reviews.llvm.org/rL371957 ("[ELF] Map the ELF header at imageBase"). It seems that this change has a bad effect when both -Ttext 0x0 and --no-rosegment are used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillalld:ELFwontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions