<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/58555>58555</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [wasm] LLVM ERROR: LEB is outside Varint32 range
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          merlinsun
      </td>
    </tr>
</table>

<pre>
    Hi,
For this case, `emcc` crashes when compiling this [file](https://github.com/llvm/llvm-project/files/9846206/test.c.zip). 
I feel sorry it is not easy to reduce.
```
$ emcc -w test.c
LLVM ERROR: LEB is outside Varint32 range
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /emsdk/upstream/bin/wasm-ld -o a.out.wasm /tmp/emscripten_temp_z9m487gl/test_0.o -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024
 #0 0x000056177d8dc913 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/emsdk/upstream/bin/wasm-ld+0xe89913)
 #1 0x000056177d8da26e llvm::sys::RunSignalHandlers() (/emsdk/upstream/bin/wasm-ld+0xe8726e)
 #2 0x000056177d8dd18f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f02e8585520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f02e85d9a7c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x96a7c)
 #5 0x00007f02e8585476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f02e856b7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x000056177d839fa6 llvm::report_fatal_error(llvm::Twine const&, bool) (/emsdk/upstream/bin/wasm-ld+0xde6fa6)
 #8 0x000056177d839de6 (/emsdk/upstream/bin/wasm-ld+0xde6de6)
 #9 0x000056177fa47a1a (/emsdk/upstream/bin/wasm-ld+0x2ff4a1a)
#10 0x000056177fa3fc78 llvm::object::WasmObjectFile::parseDataSection(llvm::object::WasmObjectFile::ReadContext&) (/emsdk/upstream/bin/wasm-ld+0x2fecc78)
#11 0x000056177fa3b2a8 llvm::object::WasmObjectFile::parseSection(llvm::object::WasmSection&) (/emsdk/upstream/bin/wasm-ld+0x2fe82a8)
#12 0x000056177fa3ad0e llvm::object::WasmObjectFile::WasmObjectFile(llvm::MemoryBufferRef, llvm::Error&) (/emsdk/upstream/bin/wasm-ld+0x2fe7d0e)
#13 0x000056177fa1d76e llvm::object::ObjectFile::createObjectFile(llvm::MemoryBufferRef, llvm::file_magic, bool) (/emsdk/upstream/bin/wasm-ld+0x2fca76e)
#14 0x000056177fa38cce llvm::object::SymbolicFile::createSymbolicFile(llvm::MemoryBufferRef, llvm::file_magic, llvm::LLVMContext*, bool) (/emsdk/upstream/bin/wasm-ld+0x2fe5cce)
#15 0x000056177f9c71c0 llvm::object::createBinary(llvm::MemoryBufferRef, llvm::LLVMContext*, bool) (/emsdk/upstream/bin/wasm-ld+0x2f741c0)
#16 0x000056177dc5dd74 lld::wasm::createObjectFile(llvm::MemoryBufferRef, llvm::StringRef, unsigned long) (/emsdk/upstream/bin/wasm-ld+0x120ad74)
#17 0x000056177dc58eeb lld::wasm::(anonymous namespace)::LinkerDriver::addFile(llvm::StringRef) Driver.cpp:0:0
#18 0x000056177dc54c12 lld::wasm::(anonymous namespace)::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) Driver.cpp:0:0
#19 0x000056177dc4f9d3 lld::wasm::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/emsdk/upstream/bin/wasm-ld+0x11fc9d3)
#20 0x000056177d8136b7 lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) lld.cpp:0:0
#21 0x000056177d812c8d main (/emsdk/upstream/bin/wasm-ld+0xdbfc8d)
#22 0x00007f02e856cd90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x00007f02e856ce40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x000056177d78cdaa _start (/emsdk/upstream/bin/wasm-ld+0xd39daa)
emcc: error: '/emsdk/upstream/bin/wasm-ld -o a.out.wasm /tmp/emscripten_temp_z9m487gl/test_0.o -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -lGL -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --import-undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=__main_argc_argv --export-if-defined=fflush --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_init --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=__get_temp_ret --export=__set_temp_ret --export-table -z stack-size=5242880 --initial-memory=16777216 --no-entry --max-memory=16777216 --global-base=1024' failed (received SIGABRT (-6))
```

version:
```
$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.24 (68a9f990429e0bcfb63b1cde68bad792554350a5)
clang version 16.0.0 (https://github.com/llvm/llvm-project 277c382760bf9575cfa2eac73d5ad1db91466d3f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /emsdk/upstream/bin
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWUtz2zYQ_jXyBUMNCb4POtixk3bGaTN2mh45IABSiEFCA4B-5Nd3AdKSKNux5fbSmXhkPhb7-BZYLBZgrdjD6jexwB8W4fkiPP2oNLJrYRAlhgMVLbKQd5TCDVFNzJobdLfmPaKq2wgp-nZkX6RnjZB8kZ4vcLG2dmMW8ekCf4RfK-x6qJcgAC9S3j7ego1W3zm18OpEDdzLIslwmMGT5cYu6fKH2CxwuUQjuN9Rw7lERmn9gIRFYLdXFnFiHpBVSHM2UL4ceQHw9BtfcYKcHyi4Q6PukX55-e0zuri6-vMK8KLLizOnVA3WCMbRN6JFb2OMNOlbPgp8ubw4vb5AZqg7QEBQPbRgeKO0dRCO9lwYM3jXEekZEj2VAxi2az72NqoJvbGabN26tkBAbOg2zoonhdBUftGq1aRDRLdDx3vrQCBQyzvDbuA-bIzVnDgEtejhekdMF0iGAoXIEhxeOoKTsKDay1EtNpb3leXdpvpRdkmRt3IamipcKhRcPm9gJwsvlNA1BNJH82C0Us5lKerJfoyDHS8K5KdLuBAJl7XtZAp3Y4faBIy7Xg5kr_g9dHog6ZbEZEekVNQRfURyXWnPssBn8AucDOWbPRKpxSi-32YUveHWoKBzA4QCUAb9xHXQSlUTGRApiAlIT-SDEdC55w2Rhm_ZeU9qyfe8Ccx3-X3bzITx7dJoFASic-ESDD3jDdiAMQig78Tm0amA33sG0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