[lld] [ELF] Respect ltoCanOmit for symbols in non-prevailing COMDAT (PR #119332)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 10:01:00 PST 2024


================
@@ -1,21 +1,31 @@
 ; REQUIRES: x86
-; RUN: llvm-as %s -o %t.o
-; RUN: llvm-as %p/Inputs/internalize-exportdyn.ll -o %t2.o
-; RUN: ld.lld %t.o %t2.o -o %t2 --export-dynamic -save-temps
-; RUN: llvm-dis < %t2.0.2.internalize.bc | FileCheck %s
-; RUN: ld.lld %t.o %t2.o -o %t3 -shared -save-temps
-; RUN: llvm-dis < %t3.0.2.internalize.bc | FileCheck %s --check-prefix=DSO
+; RUN: rm -rf %t && split-file %s %t && cd %t
+; RUN: llvm-as a.ll -o a.bc
+; RUN: llvm-as %p/Inputs/internalize-exportdyn.ll -o b.bc
+; RUN: llvm-mc -filetype=obj -triple=x86_64 lib.s -o lib.o
+; RUN: ld.lld a.bc b.bc lib.o -o out --export-dynamic -save-temps
+; RUN: llvm-dis < out.0.2.internalize.bc | FileCheck %s
+; RUN: ld.lld a.bc b.bc lib.o -o out2 -shared -save-temps
+; RUN: llvm-dis < out2.0.2.internalize.bc | FileCheck %s --check-prefix=DSO
 
+;--- a.ll
 target triple = "x86_64-unknown-linux-gnu"
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 
+$ext_and_ext = comdat any
----------------
smithp35 wrote:

It took me a while to work out what these meant, as I didn't realise that the definitions in Inputs were different. Could be worth a quick comment explaining the naming convention.

https://github.com/llvm/llvm-project/pull/119332


More information about the llvm-commits mailing list