[llvm-bugs] [Bug 41913] New: Assert hit at lld/wasm/Symbols.cpp#L86

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 16 10:58:46 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41913

            Bug ID: 41913
           Summary: Assert hit at lld/wasm/Symbols.cpp#L86
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: wasm
          Assignee: unassignedbugs at nondot.org
          Reporter: scott.waye at hubse.com
                CC: llvm-bugs at lists.llvm.org, sbc at chromium.org

I'm looking at an assert I'm hitting in ld-wasm with code as 13/05/2019
16:25:02, specifically
https://github.com/llvm/llvm-project/blob/af8cda15decac903e884015e49a043c4d58e0910/lld/wasm/Symbols.cpp#L86.
 The symbol in question has isLocal() == false (FLAGS==16).

The obvious (and probably wrong) thinking is that the problem is at
https://github.com/llvm/llvm-project/blob/af8cda15decac903e884015e49a043c4d58e0910/lld/wasm/Writer.cpp#L1094
where it only adds local symbols and hence never calls
`Sym->setOutputSymbolIndex`.  

Stack trace for assert is

        lld.exe!HandleAbort(int Sig) Line 408   C++
        [External Code] 
        lld.exe!lld::wasm::Symbol::getOutputSymbolIndex() Line 86       C++
        lld.exe!lld::wasm::ObjFile::calcNewIndex(const
llvm::wasm::WasmRelocation & Reloc) Line 79      C++
        lld.exe!lld::wasm::InputChunk::writeRelocations(llvm::raw_ostream & OS)
Line 155        C++
        lld.exe!lld::wasm::DataSection::writeRelocations(llvm::raw_ostream &
OS) Line 202       C++
        lld.exe!`anonymous namespace'::Writer::createRelocSections() Line 475  
C++
        lld.exe!`anonymous namespace'::Writer::createSections() Line 890       
C++
        lld.exe!`anonymous namespace'::Writer::run() Line 1461  C++
        lld.exe!lld::wasm::writeResult() Line 1500      C++
        lld.exe!`anonymous namespace'::LinkerDriver::link(llvm::ArrayRef<char
const *> ArgsArr) Line 628        C++
        lld.exe!lld::wasm::link(llvm::ArrayRef<char const *> Args, bool
CanExitEarly, llvm::raw_ostream & Error) Line 93        C++
        lld.exe!main(int Argc, const char * * Argv) Line 137    C++


The actual project I'm compiling is https://github.com/dotnet/corert and the
symbol is "RhpNewFinalizable" which is declared extern in
RuntimeInstance.cpp.o:

#define DECLARE_INDIRECTION(HELPER_NAME) \
    EXTERN_C void HELPER_NAME(); \
    const PTR_VOID indirection_##HELPER_NAME = (PTR_VOID)&HELPER_NAME

DECLARE_INDIRECTION(RhpNewFinalizable);

The definition of the symbol is in portable.cpp.o which is supplied

The command line to lld is 

-flavor wasm -o libPortableRuntime.bc --allow-undefined --import-memory
--import-table --lto-O0 CMakeFiles/PortableRuntime.dir/__/allocheap.cpp.o
CMakeFiles/PortableRuntime.dir/__/rhassert.cpp.o
CMakeFiles/PortableRuntime.dir/__/CachedInterfaceDispatch.cpp.o
CMakeFiles/PortableRuntime.dir/__/Crst.cpp.o
CMakeFiles/PortableRuntime.dir/__/DebugEventSource.cpp.o
CMakeFiles/PortableRuntime.dir/__/DebugFuncEval.cpp.o
CMakeFiles/PortableRuntime.dir/__/DebuggerHook.cpp.o
CMakeFiles/PortableRuntime.dir/__/eetype.cpp.o
CMakeFiles/PortableRuntime.dir/__/EHHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/event.cpp.o
CMakeFiles/PortableRuntime.dir/__/FinalizerHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/GCHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/gcheaputilities.cpp.o
CMakeFiles/PortableRuntime.dir/__/GCMemoryHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/gcrhenv.cpp.o
CMakeFiles/PortableRuntime.dir/__/gcrhscan.cpp.o
CMakeFiles/PortableRuntime.dir/__/GcStressControl.cpp.o
CMakeFiles/PortableRuntime.dir/__/GenericUnification.cpp.o
CMakeFiles/PortableRuntime.dir/__/HandleTableHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/MathHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/MiscHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/TypeManager.cpp.o
CMakeFiles/PortableRuntime.dir/__/ObjectLayout.cpp.o
CMakeFiles/PortableRuntime.dir/__/OptionalFieldsRuntime.cpp.o
CMakeFiles/PortableRuntime.dir/__/portable.cpp.o
CMakeFiles/PortableRuntime.dir/__/profheapwalkhelper.cpp.o
CMakeFiles/PortableRuntime.dir/__/RestrictedCallouts.cpp.o
CMakeFiles/PortableRuntime.dir/__/RhConfig.cpp.o
CMakeFiles/PortableRuntime.dir/__/RuntimeInstance.cpp.o
CMakeFiles/PortableRuntime.dir/__/RWLock.cpp.o
CMakeFiles/PortableRuntime.dir/__/SectionMethodList.cpp.o
CMakeFiles/PortableRuntime.dir/__/sha1.cpp.o
CMakeFiles/PortableRuntime.dir/__/StackFrameIterator.cpp.o
CMakeFiles/PortableRuntime.dir/__/startup.cpp.o
CMakeFiles/PortableRuntime.dir/__/stressLog.cpp.o
CMakeFiles/PortableRuntime.dir/__/strongname.cpp.o
CMakeFiles/PortableRuntime.dir/__/SyncClean.cpp.o
CMakeFiles/PortableRuntime.dir/__/thread.cpp.o
CMakeFiles/PortableRuntime.dir/__/threadstore.cpp.o
CMakeFiles/PortableRuntime.dir/__/UniversalTransitionHelpers.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/gchandletable.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/gccommon.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/gceewks.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/gcwks.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/gcscan.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/handletable.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/handletablecache.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/handletablecore.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/handletablescan.cpp.o
CMakeFiles/PortableRuntime.dir/__/__/gc/objecthandle.cpp.o
CMakeFiles/PortableRuntime.dir/__/unix/PalRedhawkUnix.cpp.o -mllvm
-combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm
-disable-lsr --export __wasm_call_ctors --export __data_end --export main
--export malloc --export free --export setThrew --export __errno_location
--export fflush -z stack-size=5242880 --initial-memory=16777216 --no-entry
--max-memory=16777216 --global-base=1024 --relocatable

If something jumps out then great, otherwise let me know and I'll try to create
a small repro.

-- 
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/20190516/6b57f787/attachment-0001.html>


More information about the llvm-bugs mailing list