Skip to content

Commit 7954143

Browse files
author
Alex B
committed
[lld-macho] Address Feedback #1
1 parent 80a9e0e commit 7954143

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

lld/MachO/SyntheticSections.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -807,10 +807,7 @@ void StubHelperSection::setUp() {
807807
}
808808

809809
ObjCSelRefsSection::ObjCSelRefsSection()
810-
: SyntheticSection(segment_names::data, section_names::objcSelrefs) {
811-
flags = S_ATTR_NO_DEAD_STRIP;
812-
align = target->wordSize;
813-
}
810+
: SyntheticSection(segment_names::data, section_names::objcSelrefs) {}
814811

815812
void ObjCSelRefsSection::initialize() {
816813
// Do not fold selrefs without ICF.
@@ -864,8 +861,7 @@ ConcatInputSection *ObjCSelRefsSection::makeSelRef(StringRef methName) {
864861
return objcSelref;
865862
}
866863

867-
ConcatInputSection *
868-
ObjCSelRefsSection::getSelRefForMethName(StringRef methName) {
864+
ConcatInputSection *ObjCSelRefsSection::getSelRef(StringRef methName) {
869865
auto it = methnameToSelref.find(CachedHashStringRef(methName));
870866
if (it == methnameToSelref.end())
871867
return nullptr;
@@ -894,9 +890,8 @@ StringRef ObjCStubsSection::getMethname(Symbol *sym) {
894890
void ObjCStubsSection::addEntry(Symbol *sym) {
895891
StringRef methname = getMethname(sym);
896892
// We create a selref entry for each unique methname.
897-
if (!in.objcSelRefs->getSelRefForMethName(methname)) {
893+
if (!in.objcSelRefs->getSelRef(methname))
898894
in.objcSelRefs->makeSelRef(methname);
899-
}
900895

901896
auto stubSize = config->objcStubsMode == ObjCStubsMode::fast
902897
? target->objcStubsFastSize
@@ -945,7 +940,7 @@ void ObjCStubsSection::writeTo(uint8_t *buf) const {
945940
Defined *sym = symbols[i];
946941

947942
auto methname = getMethname(sym);
948-
InputSection *selRef = in.objcSelRefs->getSelRefForMethName(methname);
943+
InputSection *selRef = in.objcSelRefs->getSelRef(methname);
949944
assert(selRef != nullptr && "no selref for methname");
950945
auto selrefAddr = selRef->getVA(0);
951946
target->writeObjCMsgSendStub(buf + stubOffset, sym, in.objcStubs->addr,

lld/MachO/SyntheticSections.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class ObjCSelRefsSection final : public SyntheticSection {
326326
bool isNeeded() const override { return false; }
327327
void writeTo(uint8_t *buf) const override {}
328328

329-
ConcatInputSection *getSelRefForMethName(StringRef methName);
329+
ConcatInputSection *getSelRef(StringRef methName);
330330
ConcatInputSection *makeSelRef(StringRef methName);
331331

332332
private:

0 commit comments

Comments
 (0)