Skip to content

Commit 34bb244

Browse files
author
Alex B
committed
[lld-macho] Fix '-merge-objc-categories' win64 build
1 parent 1abc844 commit 34bb244

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lld/MachO/InputSection.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ struct StringPiece {
192192
// Only set if deduplicating literals
193193
uint32_t hash : 31;
194194
// Offset from the start of the containing output section.
195-
uint64_t outSecOff : 56;
196-
LinkerOptReason linkerOptimizeReason : 8;
195+
uint64_t outSecOff : 48;
196+
// Have to declare the 'linkerOptimizeReason' and 'live' as uint64_t so that
197+
// the MSVC compiler will merge the storage of it and 'outSecOff' above.
198+
uint64_t /*LinkerOptReason*/ linkerOptimizeReason : 8;
197199

198200
bool shouldOmitFromOutput() const {
199201
return !live || linkerOptimizeReason != LinkerOptReason::NotOptimized;

lld/MachO/ObjC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ bool ObjcCategoryMerger::parseCatInfoToExtInfo(InfoInputCategory &catInfo,
786786

787787
if (extInfo.baseClassName.empty()) {
788788
llvm::StringRef classPrefix("_OBJC_CLASS_$_");
789-
if (!classSym->getName().startswith(classPrefix))
789+
if (!classSym->getName().starts_with(classPrefix))
790790
return registerError(
791791
"Base class symbol does not start with '_OBJC_CLASS_$_'");
792792

@@ -1137,7 +1137,7 @@ bool ObjcCategoryMerger::collectAndValidateCategoriesData() {
11371137

11381138
for (const Reloc &r : catListCisec->relocs) {
11391139
auto *sym = cast<Defined>(r.referent.get<Symbol *>());
1140-
if (!sym || !sym->getName().startswith("__OBJC_$_CATEGORY_"))
1140+
if (!sym || !sym->getName().starts_with("__OBJC_$_CATEGORY_"))
11411141
continue; // Only support ObjC categories (no swift + @objc)
11421142

11431143
auto *catBodyIsec =

0 commit comments

Comments
 (0)