Skip to content

Commit d374518

Browse files
author
Alex B
committed
[llvm-macho] Mark linker-generated data as belonging to best match object file
1 parent 775f26b commit d374518

File tree

3 files changed

+91
-116
lines changed

3 files changed

+91
-116
lines changed

lld/MachO/InputFiles.cpp

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -965,23 +965,21 @@ void ObjFile::parseLinkerOptions(SmallVectorImpl<StringRef> &LCLinkerOptions) {
965965
SmallVector<StringRef> macho::unprocessedLCLinkerOptions;
966966
ObjFile::ObjFile(MemoryBufferRef mb, uint32_t modTime, StringRef archiveName,
967967
bool lazy, bool forceHidden, bool compatArch,
968-
bool builtFromBitcode, bool isLinkerGenerated)
968+
bool builtFromBitcode)
969969
: InputFile(ObjKind, mb, lazy), modTime(modTime), forceHidden(forceHidden),
970-
builtFromBitcode(builtFromBitcode), isLinkerGenerated(isLinkerGenerated) {
970+
builtFromBitcode(builtFromBitcode) {
971971
this->archiveName = std::string(archiveName);
972972
this->compatArch = compatArch;
973-
if (!isLinkerGenerated) {
974-
if (lazy) {
975-
if (target->wordSize == 8)
976-
parseLazy<LP64>();
977-
else
978-
parseLazy<ILP32>();
979-
} else {
980-
if (target->wordSize == 8)
981-
parse<LP64>();
982-
else
983-
parse<ILP32>();
984-
}
973+
if (lazy) {
974+
if (target->wordSize == 8)
975+
parseLazy<LP64>();
976+
else
977+
parseLazy<ILP32>();
978+
} else {
979+
if (target->wordSize == 8)
980+
parse<LP64>();
981+
else
982+
parse<ILP32>();
985983
}
986984
}
987985

@@ -1105,8 +1103,6 @@ void ObjFile::parseDebugInfo() {
11051103
}
11061104

11071105
ArrayRef<data_in_code_entry> ObjFile::getDataInCode() const {
1108-
if (!mb.getBufferSize())
1109-
return {};
11101106
const auto *buf = reinterpret_cast<const uint8_t *>(mb.getBufferStart());
11111107
const load_command *cmd = findCommand(buf, LC_DATA_IN_CODE);
11121108
if (!cmd)
@@ -1117,8 +1113,6 @@ ArrayRef<data_in_code_entry> ObjFile::getDataInCode() const {
11171113
}
11181114

11191115
ArrayRef<uint8_t> ObjFile::getOptimizationHints() const {
1120-
if (!mb.getBufferSize())
1121-
return {};
11221116
const auto *buf = reinterpret_cast<const uint8_t *>(mb.getBufferStart());
11231117
if (auto *cmd =
11241118
findCommand<linkedit_data_command>(buf, LC_LINKER_OPTIMIZATION_HINT))

lld/MachO/InputFiles.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class ObjFile final : public InputFile {
161161
public:
162162
ObjFile(MemoryBufferRef mb, uint32_t modTime, StringRef archiveName,
163163
bool lazy = false, bool forceHidden = false, bool compatArch = true,
164-
bool builtFromBitcode = false, bool isLinkerGenerated = false);
164+
bool builtFromBitcode = false);
165165
ArrayRef<llvm::MachO::data_in_code_entry> getDataInCode() const;
166166
ArrayRef<uint8_t> getOptimizationHints() const;
167167
template <class LP> void parse();
@@ -181,7 +181,6 @@ class ObjFile final : public InputFile {
181181
const uint32_t modTime;
182182
bool forceHidden;
183183
bool builtFromBitcode;
184-
bool isLinkerGenerated;
185184
std::vector<ConcatInputSection *> debugSections;
186185
std::vector<CallGraphEntry> callGraph;
187186
llvm::DenseMap<ConcatInputSection *, FDE> fdes;

0 commit comments

Comments
 (0)