[llvm-bugs] [Bug 32024] New: Segfaults when using --gc-sections with linker script
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 20 17:20:13 PST 2017
http://bugs.llvm.org/show_bug.cgi?id=32024
Bug ID: 32024
Summary: Segfaults when using --gc-sections with linker script
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: release blocker
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: phosek at chromium.org
CC: llvm-bugs at lists.llvm.org
Bisecting revealed this was introduced in r295485, the test input to reproduce
this issue is:
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
# RUN: echo "ENTRY(foo) \
# RUN: SECTIONS { \
# RUN: . = 0x1000; \
# RUN: .text : { *(.text*) }\
# RUN: }" > %t.script
# RUN: ld.lld %t --gc-sections --script %t.script -o %t1
# RUN: llvm-objdump -section-headers %t1 | FileCheck %s
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size Address Type
# CHECK-NEXT: 0 00000000 0000000000000000
# CHECK-NEXT: 1 .text 00000002 0000000000000000
.section .text.bar
.global bar
bar:
nop
.section .text.foo
.global foo
foo:
nop
The stack trace is as follows:
#0 0x00000000004da869 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../lib/Support/Unix/Signals.inc:402:11
#1 0x00000000004daa19 PrintStackTraceSignalHandler(void*)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../lib/Support/Unix/Signals.inc:466:1
#2 0x00000000004d90e3 llvm::sys::RunSignalHandlers()
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../lib/Support/Signals.cpp:0:5
#3 0x00000000004dad74 SignalHandler(int)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../lib/Support/Unix/Signals.inc:256:1
#4 0x00002b33c4c6b330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x000000000071a7ae
lld::elf::LinkerScript<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::switchTo(lld::elf::OutputSectionBase*)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/LinkerScript.cpp:458:33
#6 0x000000000071aa10
lld::elf::LinkerScript<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::process(lld::elf::BaseCommand&)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/LinkerScript.cpp:503:48
#7 0x000000000071a2a6
lld::elf::LinkerScript<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::assignOffsets(lld::elf::OutputSectionCommand*)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/LinkerScript.cpp:0:5
#8 0x000000000071ae00
lld::elf::LinkerScript<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::assignAddresses(std::vector<lld::elf::PhdrEntry,
std::allocator<lld::elf::PhdrEntry> >&)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/LinkerScript.cpp:0:5
#9 0x000000000085d9bd (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
>::run()
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Writer.cpp:250:5
#10 0x00000000008869f2 void
lld::elf::writeResult<llvm::object::ELFType<(llvm::support::endianness)1, true>
>()
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Writer.cpp:140:64
#11 0x00000000006337fa void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Driver.cpp:873:1
#12 0x0000000000624ae4 lld::elf::LinkerDriver::main(llvm::ArrayRef<char
const*>, bool)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Driver.cpp:340:5
#13 0x0000000000624266 lld::elf::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Driver.cpp:79:3
#14 0x00000000004b666e main
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/tools/lld/lld.cpp:104:12
#15 0x00002b33c5f08f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#16 0x00000000004b6419 _start (../bin/ld.lld+0x4b6419)
--
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/20170221/8a349092/attachment.html>
More information about the llvm-bugs
mailing list