
For a default visibility external linkage definition, dso_local is set for ELF -fno-pic/-fpie and COFF and Mach-O. Since default clang -cc1 for ELF is similar to -fpic ("PIC Level" is not set), this nuance causes unneeded binary format differences. To make emitted IR similar, ELF -cc1 -fpic will default to -fno-semantic-interposition, which sets dso_local for default visibility external linkage definitions. To make this flip smooth and enable future (dso_local as definition default), this patch replaces (function) `define ` with `define{{.*}} `, (variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `.
27 lines
758 B
C++
27 lines
758 B
C++
// REQUIRES: xcore-registered-target
|
|
|
|
// RUN: %clang_cc1 -triple xcore-unknown-unknown -fno-signed-char -fno-common -emit-llvm -o - -x c++ %s | FileCheck %s
|
|
|
|
// CHECK: target triple = "xcore-unknown-unknown"
|
|
|
|
|
|
// C++ constants are not placed into the ".cp.rodata" section.
|
|
// CHECK: @cgx = external constant i32
|
|
extern const int cgx;
|
|
int fcgx() { return cgx;}
|
|
// CHECK: @g1 ={{.*}} global i32 0, align 4
|
|
int g1;
|
|
// CHECK: @cg1 ={{.*}} constant i32 0, align 4
|
|
extern const int cg1 = 0;
|
|
|
|
// Regression test for a bug in lib/CodeGen/CodeGenModule.cpp which called
|
|
// getLanguageLinkage() via a null 'VarDecl*'. This was an XCore specific
|
|
// conditional call to GV->setSection(".cp.rodata").
|
|
class C {
|
|
public:
|
|
~C(){};
|
|
};
|
|
C c;
|
|
|
|
// CHECK: "frame-pointer"="none"
|