[llvm-bugs] [Bug 32026] New: Assertion failure when using debug info and input linkerscript
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 20 20:59:43 PST 2017
http://bugs.llvm.org/show_bug.cgi?id=32026
Bug ID: 32026
Summary: Assertion failure when using debug info and input
linkerscript
Product: lld
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: phosek at chromium.org
CC: llvm-bugs at lists.llvm.org
When using object file that has a debug info and defines a common symbol which
is provided by the input linker script, lld crashes with assertion failure.
The test case for reproducing the issue is:
debug-input-linkerscript.s
---
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux
%S/Inputs/debug-input-linkerscript.s -o %t1
# RUN: llvm-ar rcs %tar %t1
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t2
# RUN: echo "PROVIDE_HIDDEN(foo = 0);" > %t3
# RUN: ld.lld %t2 %t3 %tar -o %tout
# RUN: llvm-objdump -section-headers %tout | FileCheck %s
# CHECK: Sections:
# CHECK-NEXT: Idx Name Size Address Type
# CHECK-NEXT: 0 00000000 0000000000000000
.text
.globl _start
_start:
nop
---
Inputs/debug-input-linkerscript.s
---
.globl foo
.hidden foo
.comm foo,8,8
.section .debug_str,"MS", at progbits,1
.Linfo_string:
.asciz "foo\0bar\0baz"
.section .debug_info,"", at progbits
.long .Linfo_string
---
The stack trace is:
ld.lld: ../../tools/lld/ELF/InputSection.cpp:728: It fastUpperBound(It, It,
const T &, Compare) [It = __gnu_cxx::__normal_iterator<const
lld::elf::SectionPiece *, std::vector<lld::elf::SectionPiece,
std::allocator<lld::elf::SectionPiece> > >, T = unsigned long, Compare =
(lambda at ../../tools/lld/ELF/InputSection.cpp:752:7)]: Assertion `Size != 0'
failed.
#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 0x00007efe150c0330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#5 0x00007efe13cb3c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007efe13cb7028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007efe13cacbf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#8 0x00007efe13cacca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#9 0x00000000006badc7
_ZL14fastUpperBoundIN9__gnu_cxx17__normal_iteratorIPKN3lld3elf12SectionPieceESt6vectorIS4_SaIS4_EEEEmZNKS3_17MergeInputSectionIN4llvm6object7ELFTypeILNSC_7support10endiannessE1ELb1EEEE15getSectionPieceEmEUlRKmRS5_E_ET_SN_SN_RKT0_T1_
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/InputSection.cpp:729:3
#10 0x00000000006c9a8c
lld::elf::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::getSectionPiece(unsigned long) const
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/InputSection.cpp:750:12
#11 0x00000000006c9455
lld::elf::MergeInputSection<llvm::object::ELFType<(llvm::support::endianness)1,
true> >::getSectionPiece(unsigned long)
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/InputSection.cpp:722:3
#12 0x0000000000879583
_ZL15includeInSymtabIN4llvm6object7ELFTypeILNS0_7support10endiannessE1ELb1EEEEbRKN3lld3elf10SymbolBodyE
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Writer.cpp:494:42
#13 0x00000000008758a1 (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
>::copyLocalSymbols()
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/ELF/Writer.cpp:515:11
#14 0x000000000085ddc4 (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:0:5
#15 0x0000000000887192 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
#16 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
#17 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
#18 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
#19 0x00000000004b666e main
/usr/local/google/home/phosek/clang-llvm/llvm/out/lld/../../tools/lld/tools/lld/lld.cpp:104:12
#20 0x00007efe13c9ef45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#21 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/41abedd0/attachment-0001.html>
More information about the llvm-bugs
mailing list