Skip to content

Commit b40739a

Browse files
Revert "[LLVM][Clang][AArch64] Implement AArch64 build attributes (#118771)"
This reverts commit d7fb4a2. Buildbots failing: https://lab.llvm.org/buildbot/#/builders/169/builds/7671 https://lab.llvm.org/buildbot/#/builders/65/builds/11046
1 parent 7bf188f commit b40739a

28 files changed

+22
-1437
lines changed

llvm/include/llvm/BinaryFormat/ELF.h

-2
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,6 @@ enum : unsigned {
11581158
SHT_ARM_ATTRIBUTES = 0x70000003U,
11591159
SHT_ARM_DEBUGOVERLAY = 0x70000004U,
11601160
SHT_ARM_OVERLAYSECTION = 0x70000005U,
1161-
// Support for AArch64 build attributes
1162-
SHT_AARCH64_ATTRIBUTES = 0x70000003U,
11631161
// Special aarch64-specific section for MTE support, as described in:
11641162
// https://github.com/ARM-software/abi-aa/blob/main/pauthabielf64/pauthabielf64.rst#section-types
11651163
SHT_AARCH64_AUTH_RELR = 0x70000004U,

llvm/include/llvm/MC/MCELFStreamer.h

+2-23
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MCELFStreamer : public MCObjectStreamer {
9696
// This structure holds all attributes, accounting for their string /
9797
// numeric value, so we can later emit them in declaration order, keeping
9898
// all in the same vector.
99-
enum Types {
99+
enum {
100100
HiddenAttribute = 0,
101101
NumericAttribute,
102102
TextAttribute,
@@ -105,17 +105,6 @@ class MCELFStreamer : public MCObjectStreamer {
105105
unsigned Tag;
106106
unsigned IntValue;
107107
std::string StringValue;
108-
AttributeItem(Types Ty, unsigned Tg, unsigned IV, std::string SV)
109-
: Type(Ty), Tag(Tg), IntValue(IV), StringValue(SV) {}
110-
};
111-
112-
/// ELF object attributes subsection support
113-
struct AttributeSubSection {
114-
bool IsActive;
115-
StringRef VendorName;
116-
unsigned IsOptional;
117-
unsigned ParameterType;
118-
SmallVector<AttributeItem, 64> Content;
119108
};
120109

121110
// Attributes that are added and managed entirely by target.
@@ -130,23 +119,13 @@ class MCELFStreamer : public MCObjectStreamer {
130119
unsigned Type, MCSection *&AttributeSection) {
131120
createAttributesSection(Vendor, Section, Type, AttributeSection, Contents);
132121
}
133-
void
134-
emitAttributesSection(MCSection *&AttributeSection, const Twine &Section,
135-
unsigned Type,
136-
SmallVector<AttributeSubSection, 64> &SubSectionVec) {
137-
createAttributesWithSubsection(AttributeSection, Section, Type,
138-
SubSectionVec);
139-
}
140122

141123
private:
142124
AttributeItem *getAttributeItem(unsigned Attribute);
143-
size_t calculateContentSize(SmallVector<AttributeItem, 64> &AttrsVec) const;
125+
size_t calculateContentSize(SmallVector<AttributeItem, 64> &AttrsVec);
144126
void createAttributesSection(StringRef Vendor, const Twine &Section,
145127
unsigned Type, MCSection *&AttributeSection,
146128
SmallVector<AttributeItem, 64> &AttrsVec);
147-
void createAttributesWithSubsection(
148-
MCSection *&AttributeSection, const Twine &Section, unsigned Type,
149-
SmallVector<AttributeSubSection, 64> &SubSectionVec);
150129

151130
// GNU attributes that will get emitted at the end of the asm file.
152131
SmallVector<AttributeItem, 64> GNUAttributes;

llvm/include/llvm/Support/AArch64BuildAttributes.h

-75
This file was deleted.

llvm/lib/MC/MCELFStreamer.cpp

+2-63
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,8 @@ MCELFStreamer::getAttributeItem(unsigned Attribute) {
696696
return nullptr;
697697
}
698698

699-
size_t MCELFStreamer::calculateContentSize(
700-
SmallVector<AttributeItem, 64> &AttrsVec) const {
699+
size_t
700+
MCELFStreamer::calculateContentSize(SmallVector<AttributeItem, 64> &AttrsVec) {
701701
size_t Result = 0;
702702
for (const AttributeItem &Item : AttrsVec) {
703703
switch (Item.Type) {
@@ -783,67 +783,6 @@ void MCELFStreamer::createAttributesSection(
783783
AttrsVec.clear();
784784
}
785785

786-
void MCELFStreamer::createAttributesWithSubsection(
787-
MCSection *&AttributeSection, const Twine &Section, unsigned Type,
788-
SmallVector<AttributeSubSection, 64> &SubSectionVec) {
789-
// <format-version: 'A'>
790-
// [ <uint32: subsection-length> NTBS: vendor-name
791-
// <bytes: vendor-data>
792-
// ]*
793-
// vendor-data expends to:
794-
// <uint8: optional> <uint8: parameter type> <attribute>*
795-
if (0 == SubSectionVec.size()) {
796-
return;
797-
}
798-
799-
// Switch section to AttributeSection or get/create the section.
800-
if (AttributeSection) {
801-
switchSection(AttributeSection);
802-
} else {
803-
AttributeSection = getContext().getELFSection(Section, Type, 0);
804-
switchSection(AttributeSection);
805-
806-
// Format version
807-
emitInt8(0x41);
808-
}
809-
810-
for (AttributeSubSection &SubSection : SubSectionVec) {
811-
// subsection-length + vendor-name + '\0'
812-
const size_t VendorHeaderSize = 4 + SubSection.VendorName.size() + 1;
813-
// optional + parameter-type
814-
const size_t VendorParameters = 1 + 1;
815-
const size_t ContentsSize = calculateContentSize(SubSection.Content);
816-
817-
emitInt32(VendorHeaderSize + VendorParameters + ContentsSize);
818-
emitBytes(SubSection.VendorName);
819-
emitInt8(0); // '\0'
820-
emitInt8(SubSection.IsOptional);
821-
emitInt8(SubSection.ParameterType);
822-
823-
for (AttributeItem &Item : SubSection.Content) {
824-
emitULEB128IntValue(Item.Tag);
825-
switch (Item.Type) {
826-
default:
827-
assert(0 && "Invalid attribute type");
828-
break;
829-
case AttributeItem::NumericAttribute:
830-
emitULEB128IntValue(Item.IntValue);
831-
break;
832-
case AttributeItem::TextAttribute:
833-
emitBytes(Item.StringValue);
834-
emitInt8(0); // '\0'
835-
break;
836-
case AttributeItem::NumericAndTextAttributes:
837-
emitULEB128IntValue(Item.IntValue);
838-
emitBytes(Item.StringValue);
839-
emitInt8(0); // '\0'
840-
break;
841-
}
842-
}
843-
}
844-
SubSectionVec.clear();
845-
}
846-
847786
MCStreamer *llvm::createELFStreamer(MCContext &Context,
848787
std::unique_ptr<MCAsmBackend> &&MAB,
849788
std::unique_ptr<MCObjectWriter> &&OW,

llvm/lib/Support/AArch64BuildAttributes.cpp

-117
This file was deleted.

llvm/lib/Support/CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ add_llvm_component_library(LLVMSupport
144144
APInt.cpp
145145
APSInt.cpp
146146
ARMBuildAttrs.cpp
147-
AArch64BuildAttributes.cpp
148147
ARMAttributeParser.cpp
149148
ARMWinEH.cpp
150149
Allocator.cpp

0 commit comments

Comments
 (0)