summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitry Mikulin <dmitry.mikulin@sony.com>2019-10-17 00:55:38 +0000
committerDmitry Mikulin <dmitry.mikulin@sony.com>2019-10-17 00:55:38 +0000
commitb18fc6c363618bd0022635bb1d48203d9a9a03dd (patch)
tree9fdebf5c59fda801ea601935f02afd5d115a159a /lib
parentf57b0958e54edee6a15020c142aa39f48887de30 (diff)
downloadclang-b18fc6c363618bd0022635bb1d48203d9a9a03dd.tar.gz
Revert Tag CFI-generated data structures with "#pragma clang section" attributes.
This reverts r375022 (git commit e2692b3bc0327606748b6d291b9009d2c845ced5) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/CGExpr.cpp3
-rw-r--r--lib/CodeGen/CodeGenModule.cpp27
-rw-r--r--lib/CodeGen/CodeGenModule.h5
-rw-r--r--lib/Sema/SemaDecl.cpp19
4 files changed, 5 insertions, 49 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 570d160156..2bd1b0ba7e 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -2821,7 +2821,6 @@ llvm::Constant *CodeGenFunction::EmitCheckTypeDescriptor(QualType T) {
CGM.getModule(), Descriptor->getType(),
/*isConstant=*/true, llvm::GlobalVariable::PrivateLinkage, Descriptor);
GV->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
- CGM.setPragmaSectionAttributes(CurFuncDecl, GV);
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(GV);
// Remember the descriptor for this type.
@@ -2901,7 +2900,6 @@ llvm::Constant *CodeGenFunction::EmitCheckSourceLocation(SourceLocation Loc) {
}
auto FilenameGV = CGM.GetAddrOfConstantCString(FilenameString, ".src");
- CGM.setPragmaSectionAttributes(CurFuncDecl, cast<llvm::GlobalVariable>(FilenameGV.getPointer()));
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(
cast<llvm::GlobalVariable>(FilenameGV.getPointer()));
Filename = FilenameGV.getPointer();
@@ -3075,7 +3073,6 @@ void CodeGenFunction::EmitCheck(
new llvm::GlobalVariable(CGM.getModule(), Info->getType(), false,
llvm::GlobalVariable::PrivateLinkage, Info);
InfoPtr->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
- CGM.setPragmaSectionAttributes(CurFuncDecl, InfoPtr);
CGM.getSanitizerMetadata()->disableSanitizerForGlobal(InfoPtr);
Args.push_back(Builder.CreateBitCast(InfoPtr, Int8PtrTy));
ArgTypes.push_back(Int8PtrTy);
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index a4859e7fbb..8eb2176ca3 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -1699,8 +1699,11 @@ bool CodeGenModule::GetCPUAndFeaturesAttributes(GlobalDecl GD,
return AddedAttr;
}
-void CodeGenModule::setPragmaSectionAttributes(const Decl *D,
- llvm::GlobalObject *GO) {
+void CodeGenModule::setNonAliasAttributes(GlobalDecl GD,
+ llvm::GlobalObject *GO) {
+ const Decl *D = GD.getDecl();
+ SetCommonAttributes(GD, GO);
+
if (D) {
if (auto *GV = dyn_cast<llvm::GlobalVariable>(GO)) {
if (auto *SA = D->getAttr<PragmaClangBSSSectionAttr>())
@@ -1718,26 +1721,6 @@ void CodeGenModule::setPragmaSectionAttributes(const Decl *D,
if (!D->getAttr<SectionAttr>())
F->addFnAttr("implicit-section-name", SA->getName());
- if (auto *SA = D->getAttr<PragmaClangBSSSectionAttr>())
- F->addFnAttr("bss-section", SA->getName());
- if (auto *SA = D->getAttr<PragmaClangDataSectionAttr>())
- F->addFnAttr("data-section", SA->getName());
- if (auto *SA = D->getAttr<PragmaClangRodataSectionAttr>())
- F->addFnAttr("rodata-section", SA->getName());
- if (auto *SA = D->getAttr<PragmaClangRelroSectionAttr>())
- F->addFnAttr("relro-section", SA->getName());
- }
- }
-}
-
-void CodeGenModule::setNonAliasAttributes(GlobalDecl GD,
- llvm::GlobalObject *GO) {
- const Decl *D = GD.getDecl();
- SetCommonAttributes(GD, GO);
- setPragmaSectionAttributes(D, GO);
-
- if (D) {
- if (auto *F = dyn_cast<llvm::Function>(GO)) {
llvm::AttrBuilder Attrs;
if (GetCPUAndFeaturesAttributes(GD, Attrs)) {
// We know that GetCPUAndFeaturesAttributes will always have the
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h
index a6662da5f5..597b8d712c 100644
--- a/lib/CodeGen/CodeGenModule.h
+++ b/lib/CodeGen/CodeGenModule.h
@@ -1347,11 +1347,6 @@ public:
/// \param QT is the clang QualType of the null pointer.
llvm::Constant *getNullPointer(llvm::PointerType *T, QualType QT);
- /// Set section attributes requested by "#pragma clang section"
- /// \param D is the declaration to read semantic attributes from.
- /// \param GO is the global object to set section attributes.
- void setPragmaSectionAttributes(const Decl *D, llvm::GlobalObject *GO);
-
private:
llvm::Constant *GetOrCreateLLVMFunction(
StringRef MangledName, llvm::Type *Ty, GlobalDecl D, bool ForVTable,
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 658cff0212..62ec83967b 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -9062,25 +9062,6 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
Context, PragmaClangTextSection.SectionName,
PragmaClangTextSection.PragmaLocation, AttributeCommonInfo::AS_Pragma));
- if (D.isFunctionDefinition()) {
- if (PragmaClangBSSSection.Valid)
- NewFD->addAttr(PragmaClangBSSSectionAttr::CreateImplicit(
- Context, PragmaClangBSSSection.SectionName,
- PragmaClangBSSSection.PragmaLocation));
- if (PragmaClangDataSection.Valid)
- NewFD->addAttr(PragmaClangDataSectionAttr::CreateImplicit(
- Context, PragmaClangDataSection.SectionName,
- PragmaClangDataSection.PragmaLocation));
- if (PragmaClangRodataSection.Valid)
- NewFD->addAttr(PragmaClangRodataSectionAttr::CreateImplicit(
- Context, PragmaClangRodataSection.SectionName,
- PragmaClangRodataSection.PragmaLocation));
- if (PragmaClangRelroSection.Valid)
- NewFD->addAttr(PragmaClangRelroSectionAttr::CreateImplicit(
- Context, PragmaClangRelroSection.SectionName,
- PragmaClangRelroSection.PragmaLocation));
- }
-
// Apply an implicit SectionAttr if #pragma code_seg is active.
if (CodeSegStack.CurrentValue && D.isFunctionDefinition() &&
!NewFD->hasAttr<SectionAttr>()) {