From e5e2e0a66b033bfe9b75b5a6352d215e02729836 Mon Sep 17 00:00:00 2001 From: Sean Fertile Date: Mon, 28 Oct 2019 16:07:10 -0400 Subject: [PowerPC][XCOFF] Add support for zero initialized global values. For XCOFF, globals mapped into the .bss section are linked as COMMON definitions. This behaviour is incorrect for zero initialized data, so emit those to the .data section instead. Differential Revision: https://reviews.llvm.org/D69528 --- llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp') diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 4978f4b9500..f941b98890c 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1855,6 +1855,12 @@ MCSection *TargetLoweringObjectFileXCOFF::SelectSectionForGlobal( if (Kind.isData()) return DataSection; + // Zero initialized data must be emitted to the .data section because external + // linkage control sections that get mapped to the .bss section will be linked + // as tentative defintions, which is only appropriate for SectionKind::Common. + if (Kind.isBSS()) + return DataSection; + report_fatal_error("XCOFF other section types not yet implemented."); } -- cgit v1.2.3