[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
Loading
Please register or sign in to comment