[llvm] f5fd0de - [LinkerWrapper][NFC] Rename 'all' to 'generic' for architecture agnostic IR
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 06:15:57 PST 2024
Author: Joseph Huber
Date: 2024-02-12T08:15:48-06:00
New Revision: f5fd0deb2371d0bae3bef2563f50e005a140fc6d
URL: https://github.com/llvm/llvm-project/commit/f5fd0deb2371d0bae3bef2563f50e005a140fc6d
DIFF: https://github.com/llvm/llvm-project/commit/f5fd0deb2371d0bae3bef2563f50e005a140fc6d.diff
LOG: [LinkerWrapper][NFC] Rename 'all' to 'generic' for architecture agnostic IR
Summary:
A previous patch introduced `all` as a special architecture. I have
decided I do not like this name and have changed it to `generic`.
Added:
Modified:
clang/docs/ClangLinkerWrapper.rst
clang/test/Driver/linker-wrapper.c
llvm/lib/Object/OffloadBinary.cpp
Removed:
################################################################################
diff --git a/clang/docs/ClangLinkerWrapper.rst b/clang/docs/ClangLinkerWrapper.rst
index 6d7770b50e7260..3bef5584757351 100644
--- a/clang/docs/ClangLinkerWrapper.rst
+++ b/clang/docs/ClangLinkerWrapper.rst
@@ -79,6 +79,14 @@ linking is desired, simply do not run the binaries through the
``clang-linker-wrapper``. This will simply append the embedded device code so
that it can be linked later.
+Matching
+========
+
+The linker wrapper will link extracted device code that is compatible with each
+other. Generally, this requires that the target triple and architecture match.
+An exception is made when the architecture is listed as ``generic``, which will
+cause it be linked with any other device code with the same target triple.
+
Example
=======
diff --git a/clang/test/Driver/linker-wrapper.c b/clang/test/Driver/linker-wrapper.c
index 647629a5969bdc..7fd46778ac9102 100644
--- a/clang/test/Driver/linker-wrapper.c
+++ b/clang/test/Driver/linker-wrapper.c
@@ -173,7 +173,7 @@ __attribute__((visibility("protected"), used)) int x;
// AMD-TARGET-ID: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a:xnack- -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o
// RUN: clang-offload-packager -o %t-lib.out \
-// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=all
+// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=generic
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t-lib.out
// RUN: llvm-ar rcs %t.a %t.o
// RUN: clang-offload-packager -o %t1.out \
diff --git a/llvm/lib/Object/OffloadBinary.cpp b/llvm/lib/Object/OffloadBinary.cpp
index 58b9b39e0d2721..4ab6536dc90b52 100644
--- a/llvm/lib/Object/OffloadBinary.cpp
+++ b/llvm/lib/Object/OffloadBinary.cpp
@@ -356,7 +356,7 @@ bool object::areTargetsCompatible(const OffloadFile::TargetID &LHS,
return false;
// If the architecture is "all" we assume it is always compatible.
- if (LHS.second.equals("all") || RHS.second.equals("all"))
+ if (LHS.second.equals("generic") || RHS.second.equals("generic"))
return true;
// Only The AMDGPU target requires additional checks.
More information about the llvm-commits
mailing list