[llvm] [DTLTO][TEST] Add a test for Unicode characters (PR #194823)

Edd Dawson via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 05:21:14 PDT 2026


================
@@ -0,0 +1,70 @@
+# Test that DTLTO handles Unicode characters in paths and symbols for
+# archive members, thin archive members, and FatLTO inputs.
+
+REQUIRES: ld.lld, llvm-ar
+
+RUN: rm -rf %t && split-file %s %t && mkdir %t/📁 && cd %t/📁
+
+# Compile bitcode. -O2 is required for cross-module importing.
+RUN: %clang --target=x86_64-linux-gnu -O2 -flto=thin -c ../α.c ../β.c ../δ.c
+RUN: %clang --target=x86_64-linux-gnu -O2 -flto=thin -ffat-lto-objects -c ../γ.c
+
+# Create an archive and a thin archive.
+RUN: llvm-ar rcs 🎁.a α.o
+RUN: llvm-ar rcsT 📦.a β.o
+
+# Build with DTLTO.
+RUN: %clang --target=x86_64-linux-gnu -O2 -flto=thin -ffat-lto-objects \
+RUN:   -fuse-ld=lld -nostdlib -shared -fthinlto-distributor=%python \
+RUN:   -Xthinlto-distributor=%llvm_src_root/utils/dtlto/local.py \
+RUN:   -Wl,--save-temps -Wl,--whole-archive 🎁.a 📦.a γ.o δ.o -o 💾.so
+
+# Check that the temporary file names preserve the Unicode symbols.
+RUN: ls | FileCheck %s --check-prefix=FILES
+
+# Archive member: 🎁.a(α.o).
+FILES-DAG: {{^}}🎁.a(α.o at [[#OFFSET:]]).1.[[#%X,HEXPID:]].1.[[#PID:]].native.o{{$}}
+FILES-DAG: {{^}}🎁.a(α.o at [[#OFFSET]]).1.[[#%X,HEXPID]].1.[[#PID]].native.o.thinlto.bc{{$}}
+FILES-DAG: {{^}}🎁.a(α.o at [[#OFFSET]]).1.[[#%X,HEXPID]].o{{$}}
+
+# Thin archive member: 📦.a(β.o).
+FILES-DAG: {{^}}β.2.[[#PID]].native.o{{$}}
+FILES-DAG: {{^}}β.2.[[#PID]].native.o.thinlto.bc{{$}}
+
+# FatLTO object: γ.o.
+FILES-DAG: {{^}}γ.o.3.[[#%X,HEXPID]].3.[[#PID]].native.o{{$}}
+FILES-DAG: {{^}}γ.o.3.[[#%X,HEXPID]].3.[[#PID]].native.o.thinlto.bc{{$}}
+FILES-DAG: {{^}}γ.o.3.[[#%X,HEXPID]].o{{$}}
+
+# Bitcode input: δ.o.
+FILES-DAG: {{^}}δ.4.[[#PID]].native.o{{$}}
+FILES-DAG: {{^}}δ.4.[[#PID]].native.o.thinlto.bc{{$}}
+
+# JSON file for the distributor.
+FILES-DAG: {{^}}💾.[[#PID]].dist-file.json{{$}}
+
+# Check that the final DTLTO-linked shared library exports the expected
+# symbol names.
+RUN: llvm-nm -D -j 💾.so | FileCheck %s --check-prefix=SYMS
----------------
playstation-edd wrote:

Testing Unicode _file name_ handling during DTLTO make sense, as those names are passed around and manipulated in new ways, when compared to established workflows.

But is there anything about DTLTO that warrants such testing for _symbol names_?



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


More information about the llvm-commits mailing list