[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (#113446) (PR #115848)
anutosh491 wrote: Hi @aheejin The checks pass as expected. I guess this should be ready ! https://github.com/llvm/llvm-project/pull/115848 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 edited https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
anutosh491 wrote: Closing as duplicate of #115848 https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 closed https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/115846 None >From ced19e161ff572e6141850eca2468f645083b5e7 Mon Sep 17 00:00:00 2001 From: anutosh491 Date: Tue, 12 Nov 2024 15:37:35 +0530 Subject: [PATCH] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm --- clang/lib/Interpreter/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt index 6a069659ebb8db..0a2d60757c216d 100644 --- a/clang/lib/Interpreter/CMakeLists.txt +++ b/clang/lib/Interpreter/CMakeLists.txt @@ -14,6 +14,7 @@ set(LLVM_LINK_COMPONENTS if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS) set(WASM_SRC Wasm.cpp) + set(WASM_LINK lldWasm) endif() add_clang_library(clangInterpreter @@ -43,6 +44,7 @@ add_clang_library(clangInterpreter clangParse clangSema clangSerialization + ${WASM_LINK} ) if ((MINGW OR CYGWIN) AND BUILD_SHARED_LIBS) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 converted_to_draft https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 converted_to_draft https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (#113446) (PR #115848)
anutosh491 wrote: Yupp made the change. Have never seen such a message before and I wasn't even sure as to why my mail was private. Is something more expected from my side ? https://github.com/llvm/llvm-project/pull/115848 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (#113446) (PR #115848)
anutosh491 wrote: I think one of the checks has been queued since quite some time but isn't running. https://github.com/llvm/llvm-project/pull/115848 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clang-repl] Fix undefined lld::wasm::link symbol while building clangInterpreter for wasm (PR #115846)
https://github.com/anutosh491 ready_for_review https://github.com/llvm/llvm-project/pull/115846 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix generation of wasm binaries while running clang-repl in browser (#117978) (PR #118077)
anutosh491 wrote: Hi @tru Just curious as to know when a 19.1.5 release is scheduled ? https://github.com/llvm/llvm-project/pull/118077 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Improve flags responsible for generating shared wasm binaries (#116735) (PR #116766)
anutosh491 wrote: > It's going into 19.1.5 in two weeks. I have already finalized 19.1.4. Sure do we have a finalized date for `19.1.4` ? https://github.com/llvm/llvm-project/pull/116766 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix generation of wasm binaries while running clang-repl in browser (#117978) (PR #118077)
anutosh491 wrote: > please add the release:note label to this PR. Hi @tru, the above comment requires us to add a label for release notes. Not sure I can add a label. Can you help me out here ? https://github.com/llvm/llvm-project/pull/118077 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix generation of wasm binaries while running clang-repl in browser (#117978) (PR #118077)
anutosh491 wrote: > @anutosh491 (or anyone else). If you would like to add a note about this fix > in the release notes (completely optional). Please reply to this comment with > a one or two sentence description of the fix. When you are done, please add > the release:note label to this PR. Fixes addModule function for clang-repl allowing it to be run completely in browser. https://github.com/llvm/llvm-project/pull/118077 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/19.x: [clang-repl] Fix generation of wasm binaries while running clang-repl in browser (#117978) (PR #118077)
anutosh491 wrote: > > Hi @tru > > Curious to know as to when a 19.1.5 release is scheduled ? > > Tomorrow. Thanks for the update :) https://github.com/llvm/llvm-project/pull/118077 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/137620 Backport : https://github.com/llvm/llvm-project/commit/9cbbb74d370c09e13b8412f21dccb7d2c4afc6a4 >From 8efbc116707fd482ddb2d3d890bbd93c0b01427b Mon Sep 17 00:00:00 2001 From: Anutosh Bhat Date: Fri, 25 Apr 2025 20:05:00 +0530 Subject: [PATCH] [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Towards This change moves WasmSym from a static global struct to an instance owned by Ctx, allowing it to be reset cleanly between linker runs. This enables safe support for multiple invocations of wasm-ld within the same process Changes done - Converted WasmSym from a static struct to a regular struct with instance members. - Added a std::unique_ptr wasmSym field inside Ctx. - Reset wasmSym in Ctx::reset() to clear state between links. - Replaced all WasmSym:: references with ctx.wasmSym->. - Removed global symbol definitions from Symbols.cpp that are no longer needed. Clearing wasmSym in ctx.reset() ensures a clean slate for each link invocation, preventing symbol leakage across runs—critical when using wasm-ld/lld as a reentrant library where global state can cause subtle, hard-to-debug errors. - Co-authored-by: Vassil Vassilev (cherry picked from commit 9cbbb74d370c09e13b8412f21dccb7d2c4afc6a4) --- lld/wasm/Config.h | 110 +++ lld/wasm/Driver.cpp| 64 +-- lld/wasm/InputChunks.cpp | 10 +- lld/wasm/MarkLive.cpp | 6 +- lld/wasm/OutputSections.cpp| 4 +- lld/wasm/Symbols.cpp | 25 - lld/wasm/Symbols.h | 99 - lld/wasm/SyntheticSections.cpp | 32 +++--- lld/wasm/Writer.cpp| 187 + 9 files changed, 262 insertions(+), 275 deletions(-) diff --git a/lld/wasm/Config.h b/lld/wasm/Config.h index 1fa6c42d9cd86..71dabaedb8a8c 100644 --- a/lld/wasm/Config.h +++ b/lld/wasm/Config.h @@ -32,6 +32,11 @@ class InputTable; class InputGlobal; class InputFunction; class Symbol; +class DefinedData; +class GlobalSymbol; +class DefinedFunction; +class UndefinedGlobal; +class TableSymbol; // For --unresolved-symbols. enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic }; @@ -139,6 +144,111 @@ struct Ctx { llvm::SmallVector syntheticGlobals; llvm::SmallVector syntheticTables; + // linker-generated symbols + struct WasmSym { +// __global_base +// Symbol marking the start of the global section. +DefinedData *globalBase; + +// __stack_pointer/__stack_low/__stack_high +// Global that holds current value of stack pointer and data symbols marking +// the start and end of the stack region. stackPointer is initialized to +// stackHigh and grows downwards towards stackLow +GlobalSymbol *stackPointer; +DefinedData *stackLow; +DefinedData *stackHigh; + +// __tls_base +// Global that holds the address of the base of the current thread's +// TLS block. +GlobalSymbol *tlsBase; + +// __tls_size +// Symbol whose value is the size of the TLS block. +GlobalSymbol *tlsSize; + +// __tls_size +// Symbol whose value is the alignment of the TLS block. +GlobalSymbol *tlsAlign; + +// __data_end +// Symbol marking the end of the data and bss. +DefinedData *dataEnd; + +// __heap_base/__heap_end +// Symbols marking the beginning and end of the "heap". It starts at the end +// of the data, bss and explicit stack, and extends to the end of the linear +// memory allocated by wasm-ld. This region of memory is not used by the +// linked code, so it may be used as a backing store for `sbrk` or `malloc` +// implementations. +DefinedData *heapBase; +DefinedData *heapEnd; + +// __wasm_first_page_end +// A symbol whose address is the end of the first page in memory (if any). +DefinedData *firstPageEnd; + +// __wasm_init_memory_flag +// Symbol whose contents are nonzero iff memory has already been +// initialized. +DefinedData *initMemoryFlag; + +// __wasm_init_memory +// Function that initializes passive data segments during instantiation. +DefinedFunction *initMemory; + +// __wasm_call_ctors +// Function that directly calls all ctors in priority order. +DefinedFunction *callCtors; + +// __wasm_call_dtors +// Function that calls the libc/etc. cleanup function. +DefinedFunction *callDtors; + +// __wasm_apply_global_relocs +// Function that applies relocations to wasm globals post-instantiation. +// Unlike __wasm_apply_data_relocs this needs to run on every thread. +DefinedFunction *applyGlobalRelocs; + +// __wasm_apply_tls_relocs +// Like __wasm_apply_data_relocs but for TLS section. These must be +// delayed until __wasm_init_tls. +De
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
anutosh491 wrote: cc @tstellar Not sure you saw my tag above but as I mentioned here https://github.com/llvm/llvm-project/pull/137620#issuecomment-2834979164 I had to manually backport this due to some merge conflicts. This was critical for downstream projects and I was hoping it would be picked up in the 20.1.4 release 😬 https://github.com/llvm/llvm-project/pull/137620 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/137620 >From 8efbc116707fd482ddb2d3d890bbd93c0b01427b Mon Sep 17 00:00:00 2001 From: Anutosh Bhat Date: Fri, 25 Apr 2025 20:05:00 +0530 Subject: [PATCH 1/2] [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Towards This change moves WasmSym from a static global struct to an instance owned by Ctx, allowing it to be reset cleanly between linker runs. This enables safe support for multiple invocations of wasm-ld within the same process Changes done - Converted WasmSym from a static struct to a regular struct with instance members. - Added a std::unique_ptr wasmSym field inside Ctx. - Reset wasmSym in Ctx::reset() to clear state between links. - Replaced all WasmSym:: references with ctx.wasmSym->. - Removed global symbol definitions from Symbols.cpp that are no longer needed. Clearing wasmSym in ctx.reset() ensures a clean slate for each link invocation, preventing symbol leakage across runs—critical when using wasm-ld/lld as a reentrant library where global state can cause subtle, hard-to-debug errors. - Co-authored-by: Vassil Vassilev (cherry picked from commit 9cbbb74d370c09e13b8412f21dccb7d2c4afc6a4) --- lld/wasm/Config.h | 110 +++ lld/wasm/Driver.cpp| 64 +-- lld/wasm/InputChunks.cpp | 10 +- lld/wasm/MarkLive.cpp | 6 +- lld/wasm/OutputSections.cpp| 4 +- lld/wasm/Symbols.cpp | 25 - lld/wasm/Symbols.h | 99 - lld/wasm/SyntheticSections.cpp | 32 +++--- lld/wasm/Writer.cpp| 187 + 9 files changed, 262 insertions(+), 275 deletions(-) diff --git a/lld/wasm/Config.h b/lld/wasm/Config.h index 1fa6c42d9cd86..71dabaedb8a8c 100644 --- a/lld/wasm/Config.h +++ b/lld/wasm/Config.h @@ -32,6 +32,11 @@ class InputTable; class InputGlobal; class InputFunction; class Symbol; +class DefinedData; +class GlobalSymbol; +class DefinedFunction; +class UndefinedGlobal; +class TableSymbol; // For --unresolved-symbols. enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic }; @@ -139,6 +144,111 @@ struct Ctx { llvm::SmallVector syntheticGlobals; llvm::SmallVector syntheticTables; + // linker-generated symbols + struct WasmSym { +// __global_base +// Symbol marking the start of the global section. +DefinedData *globalBase; + +// __stack_pointer/__stack_low/__stack_high +// Global that holds current value of stack pointer and data symbols marking +// the start and end of the stack region. stackPointer is initialized to +// stackHigh and grows downwards towards stackLow +GlobalSymbol *stackPointer; +DefinedData *stackLow; +DefinedData *stackHigh; + +// __tls_base +// Global that holds the address of the base of the current thread's +// TLS block. +GlobalSymbol *tlsBase; + +// __tls_size +// Symbol whose value is the size of the TLS block. +GlobalSymbol *tlsSize; + +// __tls_size +// Symbol whose value is the alignment of the TLS block. +GlobalSymbol *tlsAlign; + +// __data_end +// Symbol marking the end of the data and bss. +DefinedData *dataEnd; + +// __heap_base/__heap_end +// Symbols marking the beginning and end of the "heap". It starts at the end +// of the data, bss and explicit stack, and extends to the end of the linear +// memory allocated by wasm-ld. This region of memory is not used by the +// linked code, so it may be used as a backing store for `sbrk` or `malloc` +// implementations. +DefinedData *heapBase; +DefinedData *heapEnd; + +// __wasm_first_page_end +// A symbol whose address is the end of the first page in memory (if any). +DefinedData *firstPageEnd; + +// __wasm_init_memory_flag +// Symbol whose contents are nonzero iff memory has already been +// initialized. +DefinedData *initMemoryFlag; + +// __wasm_init_memory +// Function that initializes passive data segments during instantiation. +DefinedFunction *initMemory; + +// __wasm_call_ctors +// Function that directly calls all ctors in priority order. +DefinedFunction *callCtors; + +// __wasm_call_dtors +// Function that calls the libc/etc. cleanup function. +DefinedFunction *callDtors; + +// __wasm_apply_global_relocs +// Function that applies relocations to wasm globals post-instantiation. +// Unlike __wasm_apply_data_relocs this needs to run on every thread. +DefinedFunction *applyGlobalRelocs; + +// __wasm_apply_tls_relocs +// Like __wasm_apply_data_relocs but for TLS section. These must be +// delayed until __wasm_init_tls. +DefinedFunction *applyTLSRelocs; + +// __wasm_apply_global_tls_relocs +// Like applyGlob
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
anutosh491 wrote: cc @tstellar I couldn't get the bot to cherry pick this due to a simple conflict that I had to manually resolved https://github.com/llvm/llvm-project/pull/134970#issuecomment-2834854620 Hope this is all that's needed from my side ! https://github.com/llvm/llvm-project/pull/137620 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/137620 >From 8efbc116707fd482ddb2d3d890bbd93c0b01427b Mon Sep 17 00:00:00 2001 From: Anutosh Bhat Date: Fri, 25 Apr 2025 20:05:00 +0530 Subject: [PATCH] [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Towards This change moves WasmSym from a static global struct to an instance owned by Ctx, allowing it to be reset cleanly between linker runs. This enables safe support for multiple invocations of wasm-ld within the same process Changes done - Converted WasmSym from a static struct to a regular struct with instance members. - Added a std::unique_ptr wasmSym field inside Ctx. - Reset wasmSym in Ctx::reset() to clear state between links. - Replaced all WasmSym:: references with ctx.wasmSym->. - Removed global symbol definitions from Symbols.cpp that are no longer needed. Clearing wasmSym in ctx.reset() ensures a clean slate for each link invocation, preventing symbol leakage across runs—critical when using wasm-ld/lld as a reentrant library where global state can cause subtle, hard-to-debug errors. - Co-authored-by: Vassil Vassilev (cherry picked from commit 9cbbb74d370c09e13b8412f21dccb7d2c4afc6a4) --- lld/wasm/Config.h | 110 +++ lld/wasm/Driver.cpp| 64 +-- lld/wasm/InputChunks.cpp | 10 +- lld/wasm/MarkLive.cpp | 6 +- lld/wasm/OutputSections.cpp| 4 +- lld/wasm/Symbols.cpp | 25 - lld/wasm/Symbols.h | 99 - lld/wasm/SyntheticSections.cpp | 32 +++--- lld/wasm/Writer.cpp| 187 + 9 files changed, 262 insertions(+), 275 deletions(-) diff --git a/lld/wasm/Config.h b/lld/wasm/Config.h index 1fa6c42d9cd86..71dabaedb8a8c 100644 --- a/lld/wasm/Config.h +++ b/lld/wasm/Config.h @@ -32,6 +32,11 @@ class InputTable; class InputGlobal; class InputFunction; class Symbol; +class DefinedData; +class GlobalSymbol; +class DefinedFunction; +class UndefinedGlobal; +class TableSymbol; // For --unresolved-symbols. enum class UnresolvedPolicy { ReportError, Warn, Ignore, ImportDynamic }; @@ -139,6 +144,111 @@ struct Ctx { llvm::SmallVector syntheticGlobals; llvm::SmallVector syntheticTables; + // linker-generated symbols + struct WasmSym { +// __global_base +// Symbol marking the start of the global section. +DefinedData *globalBase; + +// __stack_pointer/__stack_low/__stack_high +// Global that holds current value of stack pointer and data symbols marking +// the start and end of the stack region. stackPointer is initialized to +// stackHigh and grows downwards towards stackLow +GlobalSymbol *stackPointer; +DefinedData *stackLow; +DefinedData *stackHigh; + +// __tls_base +// Global that holds the address of the base of the current thread's +// TLS block. +GlobalSymbol *tlsBase; + +// __tls_size +// Symbol whose value is the size of the TLS block. +GlobalSymbol *tlsSize; + +// __tls_size +// Symbol whose value is the alignment of the TLS block. +GlobalSymbol *tlsAlign; + +// __data_end +// Symbol marking the end of the data and bss. +DefinedData *dataEnd; + +// __heap_base/__heap_end +// Symbols marking the beginning and end of the "heap". It starts at the end +// of the data, bss and explicit stack, and extends to the end of the linear +// memory allocated by wasm-ld. This region of memory is not used by the +// linked code, so it may be used as a backing store for `sbrk` or `malloc` +// implementations. +DefinedData *heapBase; +DefinedData *heapEnd; + +// __wasm_first_page_end +// A symbol whose address is the end of the first page in memory (if any). +DefinedData *firstPageEnd; + +// __wasm_init_memory_flag +// Symbol whose contents are nonzero iff memory has already been +// initialized. +DefinedData *initMemoryFlag; + +// __wasm_init_memory +// Function that initializes passive data segments during instantiation. +DefinedFunction *initMemory; + +// __wasm_call_ctors +// Function that directly calls all ctors in priority order. +DefinedFunction *callCtors; + +// __wasm_call_dtors +// Function that calls the libc/etc. cleanup function. +DefinedFunction *callDtors; + +// __wasm_apply_global_relocs +// Function that applies relocations to wasm globals post-instantiation. +// Unlike __wasm_apply_data_relocs this needs to run on every thread. +DefinedFunction *applyGlobalRelocs; + +// __wasm_apply_tls_relocs +// Like __wasm_apply_data_relocs but for TLS section. These must be +// delayed until __wasm_init_tls. +DefinedFunction *applyTLSRelocs; + +// __wasm_apply_global_tls_relocs +// Like applyGlobalRe
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
anutosh491 wrote: > Do you not build llvm from source in your project? Can't you therefore build > from tip-of-tree? Hi, yes I think the latest changes on the release/latest_version.x branch is being used for https://github.com/compiler-research/CppInterOp (@vgvassilev or @mcbarton can confirm) So probably we don't need for a release but yeah need these changes to go into the release branch https://github.com/llvm/llvm-project/pull/137620 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/137620 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
anutosh491 wrote: Hey @tstellar, The CI is green. Should be good to go ! https://github.com/llvm/llvm-project/pull/137620 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [wasm-ld] Refactor WasmSym from static globals to per-link context (#134970) (PR #137620)
anutosh491 wrote: > If this patch is needed to run your emscripten tests, how did they pass prior > to the llvm 20 upgrade? Hey @sbc100 Not sure you remember but we did disucss a good chunk of this in the issue I had raised https://github.com/llvm/llvm-project/issues/134809 This is exactly what changed from 19.1.7 to 20.x https://github.com/llvm/llvm-project/issues/134809#issuecomment-2786937154 https://github.com/llvm/llvm-project/pull/137620 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Ensure clang-repl accepts all C keywords supported in all language models (#142749) (PR #142909)
anutosh491 wrote: See https://github.com/llvm/llvm-project/pull/142933#issuecomment-2943354247 :( https://github.com/llvm/llvm-project/pull/142909 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Ensure clang-repl accepts all C keywords supported in all language models (#142749) (PR #142909)
https://github.com/anutosh491 converted_to_draft https://github.com/llvm/llvm-project/pull/142909 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
anutosh491 wrote: cc @DavidSpickett , I executed a cherry pick on my patch to move it into the next release. Haven't had the time to go through the issue you discovered on Windows but is this all we want ? Or should I change something here ? https://github.com/llvm/llvm-project/pull/142445 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [clan-reply] Backport PTU error recovery to 20.x (PR #143893)
https://github.com/anutosh491 approved this pull request. https://github.com/llvm/llvm-project/pull/143893 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
https://github.com/anutosh491 updated https://github.com/llvm/llvm-project/pull/142445 >From 4c50edbf427a7ebac4d5a9bf8249203bb112c1a7 Mon Sep 17 00:00:00 2001 From: Anutosh Bhat Date: Mon, 2 Jun 2025 20:14:28 +0530 Subject: [PATCH] [clang-repl] Fix error recovery while PTU cleanup (#127467) Fixes #123300 What is seen ``` clang-repl> int x = 42; clang-repl> auto capture = [&]() { return x * 2; }; In file included from <<< inputs >>>:1: input_line_4:1:17: error: non-local lambda expression cannot have a capture-default 1 | auto capture = [&]() { return x * 2; }; | ^ zsh: segmentation fault clang-repl --Xcc="-v" (lldb) bt * thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8) * frame #0: 0x000107b4f8b8 libclang-cpp.19.1.dylib`clang::IncrementalParser::CleanUpPTU(clang::PartialTranslationUnit&) + 988 frame #1: 0x000107b4f1b4 libclang-cpp.19.1.dylib`clang::IncrementalParser::ParseOrWrapTopLevelDecl() + 416 frame #2: 0x000107b4fb94 libclang-cpp.19.1.dylib`clang::IncrementalParser::Parse(llvm::StringRef) + 612 frame #3: 0x000107b52fec libclang-cpp.19.1.dylib`clang::Interpreter::ParseAndExecute(llvm::StringRef, clang::Value*) + 180 frame #4: 0x00013498 clang-repl`main + 3560 frame #5: 0x00018d39a0e0 dyld`start + 2360 ``` Though the error is justified, we shouldn't be interested in exiting through a segfault in such cases. The issue is that empty named decls weren't being taken care of resulting into this assert https://github.com/llvm/llvm-project/blob/c1a229252617ed58f943bf3f4698bd8204ee0f04/clang/include/clang/AST/DeclarationName.h#L503 Can also be seen when the example is attempted through xeus-cpp-lite.  (cherry picked from commit 3b4c51bb3243a02526313c51207a674139b67a00) --- clang/lib/Interpreter/IncrementalParser.cpp | 2 +- clang/test/Interpreter/lambda.cpp | 15 +-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/clang/lib/Interpreter/IncrementalParser.cpp b/clang/lib/Interpreter/IncrementalParser.cpp index e43cea1baf43a..1d223e230669c 100644 --- a/clang/lib/Interpreter/IncrementalParser.cpp +++ b/clang/lib/Interpreter/IncrementalParser.cpp @@ -175,7 +175,7 @@ void IncrementalParser::CleanUpPTU(TranslationUnitDecl *MostRecentTU) { // FIXME: We should de-allocate MostRecentTU for (Decl *D : MostRecentTU->decls()) { auto *ND = dyn_cast(D); -if (!ND) +if (!ND || ND->getDeclName().isEmpty()) continue; // Check if we need to clean up the IdResolver chain. if (ND->getDeclName().getFETokenInfo() && !D->getLangOpts().ObjC && diff --git a/clang/test/Interpreter/lambda.cpp b/clang/test/Interpreter/lambda.cpp index df75274a050b2..7e5e1057e4c9e 100644 --- a/clang/test/Interpreter/lambda.cpp +++ b/clang/test/Interpreter/lambda.cpp @@ -1,7 +1,8 @@ // REQUIRES: host-supports-jit // UNSUPPORTED: system-aix // RUN: cat %s | clang-repl | FileCheck %s -// RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s +// RUN: cat %s | clang-repl -Xcc -Xclang -Xcc -verify -Xcc -O2 | FileCheck %s + extern "C" int printf(const char *, ...); auto l1 = []() { printf("ONE\n"); return 42; }; @@ -14,4 +15,14 @@ auto r2 = l2(); auto r3 = l2(); // CHECK: TWO -%quit +// Verify non-local lambda capture error is correctly reported +int x = 42; + +// expected-error {{non-local lambda expression cannot have a capture-default}} +auto capture = [&]() { return x * 2; }; + +// Ensure interpreter continues and x is still valid +printf("x = %d\n", x); +// CHECK: x = 42 + +%quit \ No newline at end of file ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
anutosh491 wrote: > Yes, we need to have the commit in this PR, and then > https://github.com/llvm/llvm-project/commit/beffd1509af7b12eeab0d5ae85b2f8322e039287 > to prevent test failures on Windows. Okay in that case let's do that. Let's take this in. And then on top (on the pr itself) we can do a cherry pick with the commit pointed above. https://github.com/llvm/llvm-project/pull/142445 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
anutosh491 wrote: cc @tstellar I think this should be ready now. Could you help us out here ? https://github.com/llvm/llvm-project/pull/142445 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang][Interpreter] Disable part of lambda test on Windows (PR #143851)
https://github.com/anutosh491 approved this pull request. Thank you ! Closing the previous PR. https://github.com/llvm/llvm-project/pull/143851 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
https://github.com/anutosh491 closed https://github.com/llvm/llvm-project/pull/142445 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] release/20.x: [clang-repl] Fix error recovery while PTU cleanup (#127467) (PR #142445)
anutosh491 wrote: > Was > https://github.com/llvm/llvm-project/commit/beffd1509af7b12eeab0d5ae85b2f8322e039287 > squashed in with this commit? We thought we would take this in and then cherry pick that on top of this. I am not sure if the cherry pick done by the bot here can be updated in any way to also include changes from the other commit. Is that feasible ? In that case maybe we can take both in through the same pr. Not sure if it can be done manually by me though. Could you help us with the same if that's possible ? https://github.com/llvm/llvm-project/pull/142445 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits