mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Use the true, decoded name of the archive member in getObjectType.
In ReadArchiveBuffer, make sure that MemberName is set in the case where getObjectType would want to return SVR4LongFilename. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12567 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
91ef460285
commit
60d6e54c72
@ -47,14 +47,12 @@ namespace {
|
|||||||
/// This is capable of parsing the variety of special sections used for various
|
/// This is capable of parsing the variety of special sections used for various
|
||||||
/// purposes.
|
/// purposes.
|
||||||
///
|
///
|
||||||
static enum ObjectType getObjectType(ar_hdr *H, unsigned char *MemberData,
|
static enum ObjectType getObjectType(ar_hdr *H, std::string MemberName,
|
||||||
unsigned Size) {
|
unsigned char *MemberData, unsigned Size) {
|
||||||
// Check for sections with special names...
|
// Check for sections with special names...
|
||||||
if (!memcmp(H->name, "__.SYMDEF ", 16))
|
if (MemberName == "__.SYMDEF " || MemberName == "__.SYMDEF SORTED")
|
||||||
return ArchiveSymbolTable;
|
return ArchiveSymbolTable;
|
||||||
if (!memcmp(H->name, "__.SYMDEF SORTED", 16))
|
else if (MemberName == "// ")
|
||||||
return ArchiveSymbolTable;
|
|
||||||
if (!memcmp(H->name, "// ", 16))
|
|
||||||
return SVR4LongFilename;
|
return SVR4LongFilename;
|
||||||
|
|
||||||
// Check to see if it looks like an llvm object file...
|
// Check to see if it looks like an llvm object file...
|
||||||
@ -113,6 +111,11 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
&& "SVR4-style long filename for archive member not found");
|
&& "SVR4-style long filename for archive member not found");
|
||||||
startp = &LongFilenames[NameIndex];
|
startp = &LongFilenames[NameIndex];
|
||||||
endp = strchr (startp, '/');
|
endp = strchr (startp, '/');
|
||||||
|
} else if (startp == endp && Hdr->name[1] == '/') {
|
||||||
|
// This is for the SVR4 long filename table (there might be other
|
||||||
|
// names starting with // but I don't know about them). Make sure that
|
||||||
|
// getObjectType sees it.
|
||||||
|
endp = &Hdr->name[sizeof (Hdr->name)];
|
||||||
}
|
}
|
||||||
if (!endp) {
|
if (!endp) {
|
||||||
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
||||||
@ -124,7 +127,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
std::string MemberName (startp, endp);
|
std::string MemberName (startp, endp);
|
||||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||||
|
|
||||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
switch (getObjectType(Hdr, MemberName, MemberData, MemberSize)) {
|
||||||
case SVR4LongFilename:
|
case SVR4LongFilename:
|
||||||
// If this is a long filename section, read all of the file names into the
|
// If this is a long filename section, read all of the file names into the
|
||||||
// LongFilenames vector.
|
// LongFilenames vector.
|
||||||
|
@ -47,14 +47,12 @@ namespace {
|
|||||||
/// This is capable of parsing the variety of special sections used for various
|
/// This is capable of parsing the variety of special sections used for various
|
||||||
/// purposes.
|
/// purposes.
|
||||||
///
|
///
|
||||||
static enum ObjectType getObjectType(ar_hdr *H, unsigned char *MemberData,
|
static enum ObjectType getObjectType(ar_hdr *H, std::string MemberName,
|
||||||
unsigned Size) {
|
unsigned char *MemberData, unsigned Size) {
|
||||||
// Check for sections with special names...
|
// Check for sections with special names...
|
||||||
if (!memcmp(H->name, "__.SYMDEF ", 16))
|
if (MemberName == "__.SYMDEF " || MemberName == "__.SYMDEF SORTED")
|
||||||
return ArchiveSymbolTable;
|
return ArchiveSymbolTable;
|
||||||
if (!memcmp(H->name, "__.SYMDEF SORTED", 16))
|
else if (MemberName == "// ")
|
||||||
return ArchiveSymbolTable;
|
|
||||||
if (!memcmp(H->name, "// ", 16))
|
|
||||||
return SVR4LongFilename;
|
return SVR4LongFilename;
|
||||||
|
|
||||||
// Check to see if it looks like an llvm object file...
|
// Check to see if it looks like an llvm object file...
|
||||||
@ -113,6 +111,11 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
&& "SVR4-style long filename for archive member not found");
|
&& "SVR4-style long filename for archive member not found");
|
||||||
startp = &LongFilenames[NameIndex];
|
startp = &LongFilenames[NameIndex];
|
||||||
endp = strchr (startp, '/');
|
endp = strchr (startp, '/');
|
||||||
|
} else if (startp == endp && Hdr->name[1] == '/') {
|
||||||
|
// This is for the SVR4 long filename table (there might be other
|
||||||
|
// names starting with // but I don't know about them). Make sure that
|
||||||
|
// getObjectType sees it.
|
||||||
|
endp = &Hdr->name[sizeof (Hdr->name)];
|
||||||
}
|
}
|
||||||
if (!endp) {
|
if (!endp) {
|
||||||
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
||||||
@ -124,7 +127,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
std::string MemberName (startp, endp);
|
std::string MemberName (startp, endp);
|
||||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||||
|
|
||||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
switch (getObjectType(Hdr, MemberName, MemberData, MemberSize)) {
|
||||||
case SVR4LongFilename:
|
case SVR4LongFilename:
|
||||||
// If this is a long filename section, read all of the file names into the
|
// If this is a long filename section, read all of the file names into the
|
||||||
// LongFilenames vector.
|
// LongFilenames vector.
|
||||||
|
@ -47,14 +47,12 @@ namespace {
|
|||||||
/// This is capable of parsing the variety of special sections used for various
|
/// This is capable of parsing the variety of special sections used for various
|
||||||
/// purposes.
|
/// purposes.
|
||||||
///
|
///
|
||||||
static enum ObjectType getObjectType(ar_hdr *H, unsigned char *MemberData,
|
static enum ObjectType getObjectType(ar_hdr *H, std::string MemberName,
|
||||||
unsigned Size) {
|
unsigned char *MemberData, unsigned Size) {
|
||||||
// Check for sections with special names...
|
// Check for sections with special names...
|
||||||
if (!memcmp(H->name, "__.SYMDEF ", 16))
|
if (MemberName == "__.SYMDEF " || MemberName == "__.SYMDEF SORTED")
|
||||||
return ArchiveSymbolTable;
|
return ArchiveSymbolTable;
|
||||||
if (!memcmp(H->name, "__.SYMDEF SORTED", 16))
|
else if (MemberName == "// ")
|
||||||
return ArchiveSymbolTable;
|
|
||||||
if (!memcmp(H->name, "// ", 16))
|
|
||||||
return SVR4LongFilename;
|
return SVR4LongFilename;
|
||||||
|
|
||||||
// Check to see if it looks like an llvm object file...
|
// Check to see if it looks like an llvm object file...
|
||||||
@ -113,6 +111,11 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
&& "SVR4-style long filename for archive member not found");
|
&& "SVR4-style long filename for archive member not found");
|
||||||
startp = &LongFilenames[NameIndex];
|
startp = &LongFilenames[NameIndex];
|
||||||
endp = strchr (startp, '/');
|
endp = strchr (startp, '/');
|
||||||
|
} else if (startp == endp && Hdr->name[1] == '/') {
|
||||||
|
// This is for the SVR4 long filename table (there might be other
|
||||||
|
// names starting with // but I don't know about them). Make sure that
|
||||||
|
// getObjectType sees it.
|
||||||
|
endp = &Hdr->name[sizeof (Hdr->name)];
|
||||||
}
|
}
|
||||||
if (!endp) {
|
if (!endp) {
|
||||||
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
// 4.4BSD/MacOSX *short* filenames are not guaranteed to have a
|
||||||
@ -124,7 +127,7 @@ static bool ReadArchiveBuffer(const std::string &ArchiveName,
|
|||||||
std::string MemberName (startp, endp);
|
std::string MemberName (startp, endp);
|
||||||
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
std::string FullMemberName = ArchiveName + "(" + MemberName + ")";
|
||||||
|
|
||||||
switch (getObjectType(Hdr, MemberData, MemberSize)) {
|
switch (getObjectType(Hdr, MemberName, MemberData, MemberSize)) {
|
||||||
case SVR4LongFilename:
|
case SVR4LongFilename:
|
||||||
// If this is a long filename section, read all of the file names into the
|
// If this is a long filename section, read all of the file names into the
|
||||||
// LongFilenames vector.
|
// LongFilenames vector.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user