Summary: | glibc-2.28 on little-endian mips32 broken due to commit 2bf2bf23da | ||
---|---|---|---|
Product: | binutils | Reporter: | Manuel Lauss <manuel.lauss> |
Component: | ld | Assignee: | Alan Modra <amodra> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 2.32 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: | 2018-12-27 00:00:00 | |
Attachments: | archive of working and broken libraries |
The differences are in .sbss, which is oddly made PROGBITS rather than NOBITS. ld-2.28.so.BAD: file format elf32-tradlittlemips Contents of section .sbss: 35c20 1c000000 02000000 ........ ld-2.28.so.GOOD: file format elf32-tradlittlemips Contents of section .sbss: 35c20 00000000 00000000 ........ The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0e41bebb938dbe9eae7063f5321429194bfc5ab7 commit 0e41bebb938dbe9eae7063f5321429194bfc5ab7 Author: Alan Modra <amodra@gmail.com> Date: Fri Dec 28 09:41:44 2018 +1030 PR24015, glibc-2.28 on little-endian mips32 broken Commit 2bf2bf23da exposed a bug on targets that create common sections other than the standard ELF SHN_COMMON. If these are output by ld -r, then their type becomes SHT_PROGBITS unless the target handles them specially (eg. by elf_backend_special_sections), and if they are merged into .bss/.sbss by ld -r then that section becomes SHT_PROGBITS. Worse, if they are output by ld -r, then their size is increased by bfd_generic_define_common_symbol during final link, which leads to bogus file contents being copied to output. For mips, it seems to me that the .scommon section should not be output for ld -r, but I haven't made that change in this patch. PR 24015 * elf.c (bfd_elf_get_default_section_type): Make common sections SHT_NOBITS. * linker.c (bfd_generic_define_common_symbol): Clear SEC_HAS_CONTENTS. Should now be fixed. Thanks, yes it's fixed now. Final binary is even 8 bytes smaller now. |
Created attachment 11480 [details] archive of working and broken libraries On MIPS32 little-endian softfloat target ("mipsel-softfloat-linux-gnu"), commit 2bf2bf23da5237f465fdbb759657aeb7825a08a3 ("ELF ld -r scripts") creates a corrupt MIPS32 ld.so binary (glibc-2.28), which segfaults somehere in dl_main(). I see however no issues in other packages. I attach a tar archive with a working and broken ld-2.28.so file. The good one was built with binutils commit 8bca297856, the broken one with 2bf2bf23da. They seem to differ in only 2 bytes: # cmp -b -l ld-2.28.so.GOOD ld-2.28.so.BAD 154657 0 ^@ 34 ^\ 154661 0 ^@ 2 ^B Please take a look! Thanks! Manuel