Skip to content

Commit f5fd0de

Browse files
committed
[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`.
1 parent afa413a commit f5fd0de

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

clang/docs/ClangLinkerWrapper.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ linking is desired, simply do not run the binaries through the
7979
``clang-linker-wrapper``. This will simply append the embedded device code so
8080
that it can be linked later.
8181

82+
Matching
83+
========
84+
85+
The linker wrapper will link extracted device code that is compatible with each
86+
other. Generally, this requires that the target triple and architecture match.
87+
An exception is made when the architecture is listed as ``generic``, which will
88+
cause it be linked with any other device code with the same target triple.
89+
8290
Example
8391
=======
8492

clang/test/Driver/linker-wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ __attribute__((visibility("protected"), used)) int x;
173173
// AMD-TARGET-ID: clang{{.*}} -o {{.*}}.img --target=amdgcn-amd-amdhsa -mcpu=gfx90a:xnack- -O2 -Wl,--no-undefined {{.*}}.o {{.*}}.o
174174

175175
// RUN: clang-offload-packager -o %t-lib.out \
176-
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=all
176+
// RUN: --image=file=%t.elf.o,kind=openmp,triple=amdgcn-amd-amdhsa,arch=generic
177177
// RUN: %clang -cc1 %s -triple x86_64-unknown-linux-gnu -emit-obj -o %t.o -fembed-offload-object=%t-lib.out
178178
// RUN: llvm-ar rcs %t.a %t.o
179179
// RUN: clang-offload-packager -o %t1.out \

llvm/lib/Object/OffloadBinary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ bool object::areTargetsCompatible(const OffloadFile::TargetID &LHS,
356356
return false;
357357

358358
// If the architecture is "all" we assume it is always compatible.
359-
if (LHS.second.equals("all") || RHS.second.equals("all"))
359+
if (LHS.second.equals("generic") || RHS.second.equals("generic"))
360360
return true;
361361

362362
// Only The AMDGPU target requires additional checks.

0 commit comments

Comments
 (0)