[all-commits] [llvm/llvm-project] dcf336: [lld][WebAssembly] Retain data segments referenced...
Yuta Saito via All-commits
all-commits at lists.llvm.org
Fri Jun 3 19:35:16 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: dcf3368e33c3a01bd21b692d3be5dc1ecee587f4
https://github.com/llvm/llvm-project/commit/dcf3368e33c3a01bd21b692d3be5dc1ecee587f4
Author: Yuta Saito <kateinoigakukun at gmail.com>
Date: 2022-06-04 (Sat, 04 Jun 2022)
Changed paths:
A lld/test/wasm/gc-sections-startstop.s
M lld/wasm/MarkLive.cpp
Log Message:
-----------
[lld][WebAssembly] Retain data segments referenced via __start/__stop
As well as ELF linker does, retain all data segments named X referenced
through `__start_X` or `__stop_X`.
For example, `FOO_MD` should not be stripped in the below case, but it's currently mis-stripped
```llvm
@FOO_MD = global [4 x i8] c"bar\00", section "foo_md", align 1
@__start_foo_md = external constant i8*
@__stop_foo_md = external constant i8*
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @foo_md_size to i8*)], section "llvm.metadata"
define i32 @foo_md_size() {
entry:
ret i32 sub (
i32 ptrtoint (i8** @__stop_foo_md to i32),
i32 ptrtoint (i8** @__start_foo_md to i32)
)
}
```
This fixes https://github.com/llvm/llvm-project/issues/55839
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D126950
More information about the All-commits
mailing list