From f3d7904d20120fb6e4b33cd391b916ca6701e03e Mon Sep 17 00:00:00 2001 From: Javed Absar Date: Thu, 11 May 2017 12:28:08 +0000 Subject: [IR] Allow attributes with global variables This patch extends llvm-ir to allow attributes to be set on global variables. An RFC was sent out earlier by my colleague James Molloy: http://lists.llvm.org/pipermail/cfe-dev/2017-March/053100.html A key part of that proposal was to extend LLVM-IR to carry attributes on global variables. This generic feature could be useful for multiple purposes. In our present context, it would be useful to carry user specified sections for bss/rodata/data. Reviewed by: Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D32009 llvm-svn: 302794 --- llvm/lib/IR/Globals.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'llvm/lib/IR/Globals.cpp') diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 5f338f58d94..5fbf51e0089 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -338,6 +338,7 @@ void GlobalVariable::copyAttributesFrom(const GlobalValue *Src) { if (const GlobalVariable *SrcVar = dyn_cast(Src)) { setThreadLocalMode(SrcVar->getThreadLocalMode()); setExternallyInitialized(SrcVar->isExternallyInitialized()); + setAttributes(SrcVar->getAttributes()); } } -- cgit v1.2.3