Skip to content

gas / binutils 2.27 generates invalid ELF files #76

@osresearch

Description

@osresearch

The Heads project is having problems building musl-cross on modern systems due to an incompatible change in libelf. linuxboot/heads#618 (comment)

The problem is also described here: https://wiki.gentoo.org/wiki/Binutils_2.32_upgrade_notes/elfutils_0.175:_unable_to_initialize_decompress_status_for_section_.debug_info

Starting from dev-libs/elfutils-0.175 libelf writes compressed section alignment according to the ELF spec (see https://sourceware.org/PR23916). Unfortunately GNU assembler (gas from binutis-2.31.1 and older) writes non-conformant alignment. This means that libelf processing of such ELF files "corrupts" object files for binutils-2.31.
binutils-2.32 now writes conformant ELF alignments (see https://sourceware.org/PR23919) but the result is not compatible to binutils-2.31.

The symptom that we encounter is that musl-cross-gas produces invalid ELF files for the Linux kernel's .S assembly programs, which are corrupted when they are processed by the ORC unwinder linked against the system's libelf:

/heads/build/../crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-objdump: arch/x86/lib/memmove_64.o: File format not recognized
/heads/build/../crossgcc/x86_64-linux-musl/bin/x86_64-linux-musl-objdump: arch/x86/lib/retpoline.o: unable to initialize decompress status for section .debug_line

I think moving musl-cross to binutils 2.32 (from the current 2.27) would fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions