[llvm-bugs] [Bug 44878] New: crash with --emit-relocs and --strip-debug when debug sections present
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Feb 12 00:35:11 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44878
Bug ID: 44878
Summary: crash with --emit-relocs and --strip-debug when debug
sections present
Product: lld
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: keescook at chromium.org
CC: llvm-bugs at lists.llvm.org, peter.smith at linaro.org
Combining --emit-relocs with --strip-debug on an object with debug sections
will crash during orphan placement:
$ echo "a;" > test.c
$ clang -g -c -o test.o test.c
...
$ objdump -wh test.o
test.o: file format elf64-x86-64
Sections:
Idx Name Size VMA LMA File off
Algn Flags
0 .text 00000000 0000000000000000 0000000000000000 00000040
2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .debug_str 00000091 0000000000000000 0000000000000000 00000040
2**0 CONTENTS, READONLY, DEBUGGING
2 .debug_abbrev 0000002c 0000000000000000 0000000000000000 000000d1
2**0 CONTENTS, READONLY, DEBUGGING
3 .debug_info 0000003b 0000000000000000 0000000000000000 000000fd
2**0 CONTENTS, RELOC, READONLY, DEBUGGING
4 .comment 0000006a 0000000000000000 0000000000000000 00000138
2**0 CONTENTS, READONLY
5 .note.GNU-stack 00000000 0000000000000000 0000000000000000 000001a2
2**0 CONTENTS, READONLY
6 .debug_line 0000002e 0000000000000000 0000000000000000 000001a2
2**0 CONTENTS, READONLY, DEBUGGING
7 .llvm_addrsig 00000000 0000000000000000 0000000000000000 00000320
2**0 CONTENTS, READONLY, EXCLUDE
$ ld.lld --emit-relocs --strip-debug -o /dev/null test.o
Stack dump:
0. Program arguments: ld.lld --emit-relocs --strip-debug -o /dev/null
test.o
#0 0x000055a6d904b68e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/kees/src/llvm-build/x86/bin/lld+0x51168e)
#1 0x000055a6d9049514 llvm::sys::RunSignalHandlers()
(/home/kees/src/llvm-build/x86/bin/lld+0x50f514)
#2 0x000055a6d9049658 SignalHandler(int)
(/home/kees/src/llvm-build/x86/bin/lld+0x50f658)
#3 0x00007fe35d416540 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x15540)
#4 0x000055a6d9028122 llvm::Twine::printOneChild(llvm::raw_ostream&,
llvm::Twine::Child, llvm::Twine::NodeKind) const
(/home/kees/src/llvm-build/x86/bin/lld+0x4ee122)
#5 0x000055a6d90282a1 llvm::Twine::toVector(llvm::SmallVectorImpl<char>&)
const (/home/kees/src/llvm-build/x86/bin/lld+0x4ee2a1)
#6 0x000055a6d902834b llvm::Twine::str[abi:cxx11]() const
(/home/kees/src/llvm-build/x86/bin/lld+0x4ee34b)
#7 0x000055a6d9261a9f
lld::elf::getOutputSectionName(lld::elf::InputSectionBase const*)
(/home/kees/src/llvm-build/x86/bin/lld+0x727a9f)
#8 0x000055a6d91a8a5e
lld::elf::LinkerScript::addOrphanSections()::'lambda'(lld::elf::InputSectionBase*)::operator()(lld::elf::InputSectionBase*)
const (/home/kees/src/llvm-build/x86/bin/lld+0x66ea5e)
#9 0x000055a6d91a6177 lld::elf::LinkerScript::addOrphanSections()
(/home/kees/src/llvm-build/x86/bin/lld+0x66c177)
#10 0x000055a6d912ce0e void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
(/home/kees/src/llvm-build/x86/bin/lld+0x5f2e0e)
#11 0x000055a6d8f7c833 lld::elf::LinkerDriver::main(llvm::ArrayRef<char
const*>) (/home/kees/src/llvm-build/x86/bin/lld+0x442833)
#12 0x000055a6d9130dfb lld::elf::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&, llvm::raw_ostream&)
(/home/kees/src/llvm-build/x86/bin/lld+0x5f6dfb)
#13 0x000055a6d8f79ede main (/home/kees/src/llvm-build/x86/bin/lld+0x43fede)
#14 0x00007fe35ce921e3 __libc_start_main
/build/glibc-4WA41p/glibc-2.30/csu/../csu/libc-start.c:342:3
#15 0x000055a6d900aa4e _start (/home/kees/src/llvm-build/x86/bin/lld+0x4d0a4e)
Segmentation fault (core dumped)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200212/7f164e25/attachment-0001.html>
More information about the llvm-bugs
mailing list