Date: Sat, 05 Sep 2020 22:18:46 +0000 From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 249121] program compiled with -pg produces ld-elf abort Message-ID: <bug-249121-29464-v9Y3UOi4K0@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-249121-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-249121-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249121 Konstantin Belousov <kib@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dim@FreeBSD.org, | |emaste@freebsd.org --- Comment #4 from Konstantin Belousov <kib@FreeBSD.org> --- Clang+lld produce very strange binary when all linked libraries are static: Elf file type is EXEC (Executable file) Entry point 0x2237a0 There are 11 program headers, starting at offset 64 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align PHDR 0x0000000000000040 0x0000000000200040 0x0000000000200040 0x0000000000000268 0x0000000000000268 R 0x8 INTERP 0x00000000000002a8 0x00000000002002a8 0x00000000002002a8 0x0000000000000015 0x0000000000000015 R 0x1 [Requesting program interpreter: /libexec/ld-elf.so.1] LOAD 0x0000000000000000 0x0000000000200000 0x0000000000200000 0x000000000002279c 0x000000000002279c R 0x1000 LOAD 0x00000000000227a0 0x00000000002237a0 0x00000000002237a0 0x0000000000091760 0x0000000000091760 R E 0x1000 LOAD 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001898 0x0000000000001898 RW 0x1000 LOAD 0x00000000000b57a0 0x00000000002b87a0 0x00000000002b87a0 0x00000000000037c0 0x00000000002247a9 RW 0x1000 TLS 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001850 0x0000000000001870 R 0x10 GNU_RELRO 0x00000000000b3f00 0x00000000002b5f00 0x00000000002b5f00 0x0000000000001898 0x0000000000002100 R 0x1 GNU_EH_FRAME 0x000000000000fc80 0x000000000020fc80 0x000000000020fc80 0x000000000000300c 0x000000000000300c R 0x4 GNU_STACK 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 RW 0 NOTE 0x00000000000002c0 0x00000000002002c0 0x00000000002002c0 0x0000000000000048 0x0000000000000048 R 0x4 ... There is no dynamic section in this file. Relocation section with addend (.rela.dyn): r_offset r_info r_type st_value st_name + r_addend 0000002bbf50 000000000025 R_X86_64_IRELATIVE 0000000000000000 + 223dd0 0000002bbf58 000000000025 R_X86_64_IRELATIVE 0000000000000000 + 2a91e0 As you see, it specifies PHDR INTERP, which brings rtld into action. But there is no dynamic segment, so rtld cannot see any relocs, which resul= ts in the IRELATIVE relocation sites to still point to the resolver functions. This is arguably a bug in lld. There are also two bugs in rtld which fixes I will commit shortly. I assum= es dynamic segment is there and dereferences NULL pointer otherwise. Also, it terminates the image if there is no dynamic symbol table. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249121-29464-v9Y3UOi4K0>