Skip to content

Commit 5978c92

Browse files
committed
[MachO] Update LLD to use 64-bit offsets with DataExtractor (3/5)
Differential Revision: https://reviews.llvm.org/D65639 llvm-svn: 368032
1 parent b5abc42 commit 5978c92

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -832,10 +832,10 @@ dataExtractorFromSection(const NormalizedFile &normalizedFile,
832832

833833
// FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE
834834
// inspection" code if possible.
835-
static uint32_t getCUAbbrevOffset(llvm::DataExtractor abbrevData,
835+
static uint64_t getCUAbbrevOffset(llvm::DataExtractor abbrevData,
836836
uint64_t abbrCode) {
837837
uint64_t curCode;
838-
uint32_t offset = 0;
838+
uint64_t offset = 0;
839839
while ((curCode = abbrevData.getULEB128(&offset)) != abbrCode) {
840840
// Tag
841841
abbrevData.getULEB128(&offset);
@@ -853,13 +853,13 @@ static uint32_t getCUAbbrevOffset(llvm::DataExtractor abbrevData,
853853
static Expected<const char *>
854854
getIndexedString(const NormalizedFile &normalizedFile,
855855
llvm::dwarf::Form form, llvm::DataExtractor infoData,
856-
uint32_t &infoOffset, const Section &stringsSection) {
856+
uint64_t &infoOffset, const Section &stringsSection) {
857857
if (form == llvm::dwarf::DW_FORM_string)
858858
return infoData.getCStr(&infoOffset);
859859
if (form != llvm::dwarf::DW_FORM_strp)
860860
return llvm::make_error<GenericError>(
861861
"string field encoded without DW_FORM_strp");
862-
uint32_t stringOffset = infoData.getU32(&infoOffset);
862+
uint64_t stringOffset = infoData.getU32(&infoOffset);
863863
llvm::DataExtractor stringsData =
864864
dataExtractorFromSection(normalizedFile, stringsSection);
865865
return stringsData.getCStr(&stringOffset);
@@ -875,7 +875,7 @@ readCompUnit(const NormalizedFile &normalizedFile,
875875
StringRef path) {
876876
// FIXME: Cribbed from llvm-dwp -- should share "lightweight CU DIE
877877
// inspection" code if possible.
878-
uint32_t offset = 0;
878+
uint64_t offset = 0;
879879
llvm::dwarf::DwarfFormat Format = llvm::dwarf::DwarfFormat::DWARF32;
880880
auto infoData = dataExtractorFromSection(normalizedFile, info);
881881
uint32_t length = infoData.getU32(&offset);
@@ -897,7 +897,7 @@ readCompUnit(const NormalizedFile &normalizedFile,
897897

898898
uint32_t abbrCode = infoData.getULEB128(&offset);
899899
auto abbrevData = dataExtractorFromSection(normalizedFile, abbrev);
900-
uint32_t abbrevOffset = getCUAbbrevOffset(abbrevData, abbrCode);
900+
uint64_t abbrevOffset = getCUAbbrevOffset(abbrevData, abbrCode);
901901
uint64_t tag = abbrevData.getULEB128(&abbrevOffset);
902902
if (tag != llvm::dwarf::DW_TAG_compile_unit)
903903
return llvm::make_error<GenericError>("top level DIE is not a compile unit");

0 commit comments

Comments
 (0)