summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
-rw-r--r--clang/test/CodeGen/align-systemz.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 17b7ddc7683..b30885d4cdb 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1777,6 +1777,8 @@ CodeGenModule::GetOrCreateLLVMGlobal(StringRef MangledName,
// handling.
GV->setConstant(isTypeConstant(D->getType(), false));
+ GV->setAlignment(getContext().getDeclAlign(D).getQuantity());
+
setLinkageAndVisibilityForGV(GV, D);
if (D->getTLSKind()) {
diff --git a/clang/test/CodeGen/align-systemz.c b/clang/test/CodeGen/align-systemz.c
index 277492c0601..68a21e39ab3 100644
--- a/clang/test/CodeGen/align-systemz.c
+++ b/clang/test/CodeGen/align-systemz.c
@@ -12,3 +12,16 @@ char c;
struct test s;
// CHECK-DAG: @s = common global %struct.test zeroinitializer, align 2
+extern char ec;
+// CHECK-DAG: @ec = external global i8, align 2
+
+extern struct test es;
+// CHECK-DAG: @es = external global %struct.test, align 2
+
+// Dummy function to make sure external symbols are used.
+void func (void)
+{
+ c = ec;
+ s = es;
+}
+
OpenPOWER on IntegriCloud