[Mlir-commits] [mlir] Populate the llvm::GlobalVariable ELF section, with the attribute from the ObjectAttrs (PR #117246)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Nov 21 14:03:07 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Renaud Kauffmann (Renaud-K)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/117246.diff
1 Files Affected:
- (modified) mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp (+7)
``````````diff
diff --git a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
index b023c4c126da30..3aeadeb283ff69 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
@@ -121,6 +121,13 @@ LogicalResult SelectObjectAttrImpl::embedBinary(
new llvm::GlobalVariable(*module, binary->getType(), true,
llvm::GlobalValue::LinkageTypes::InternalLinkage,
binary, getBinaryIdentifier(op.getName()));
+
+ if (object.getProperties()) {
+ if (auto section = mlir::dyn_cast_or_null<mlir::StringAttr>(
+ object.getProperties().get("section"))) {
+ serializedObj->setSection(section.getValue());
+ }
+ }
serializedObj->setLinkage(llvm::GlobalValue::LinkageTypes::InternalLinkage);
serializedObj->setAlignment(llvm::MaybeAlign(8));
serializedObj->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::None);
``````````
</details>
https://github.com/llvm/llvm-project/pull/117246
More information about the Mlir-commits
mailing list