[llvm] 9e0dbd2 - [Target] Remove `startswith` for adding `SHF_EXCLUDE` to offload section

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 8 06:57:27 PDT 2022


Author: Joseph Huber
Date: 2022-06-08T09:56:51-04:00
New Revision: 9e0dbd2a2a4adee04b31e0cfa172fc36dd4ac313

URL: https://github.com/llvm/llvm-project/commit/9e0dbd2a2a4adee04b31e0cfa172fc36dd4ac313
DIFF: https://github.com/llvm/llvm-project/commit/9e0dbd2a2a4adee04b31e0cfa172fc36dd4ac313.diff

LOG: [Target] Remove `startswith` for adding `SHF_EXCLUDE` to offload section

Summary:
We use the special section name `.llvm.offloading` to store device
imagees in the host object file. We want these to be stripped by the
linker as they are not used after linking so we use the `SHF_EXCLUDE`
flag to instruct the linker to drop them. We used to do this for all
sections that started with `.llvm.offloading` when we encoded metadata
in the section name itself. Now we embed a special binary containing the
metadata, we should only add the flag on this name specifically.

Added: 
    

Modified: 
    llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
index ed2a15d5eb4c..ccbfc165344d 100644
--- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
@@ -449,7 +449,7 @@ static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K) {
       Name == ".llvmbc" || Name == ".llvmcmd")
     return SectionKind::getMetadata();
 
-  if (Name.startswith(".llvm.offloading"))
+  if (Name == ".llvm.offloading")
     return SectionKind::getExclude();
 
   if (Name.empty() || Name[0] != '.') return K;


        


More information about the llvm-commits mailing list