forked from OSchip/llvm-project
Fix ELF parsing where undefined symbols were being added to the symbol table with the incorrect symbol type.
llvm-svn: 174984
This commit is contained in:
parent
f72d06a919
commit
92dd5cfe04
|
@ -750,37 +750,41 @@ ParseSymbols(Symtab *symtab,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (symbol.getType())
|
// If a symbol is undefined do not process it further even if it has a STT type
|
||||||
|
if (symbol_type != eSymbolTypeUndefined)
|
||||||
{
|
{
|
||||||
default:
|
switch (symbol.getType())
|
||||||
case STT_NOTYPE:
|
{
|
||||||
// The symbol's type is not specified.
|
default:
|
||||||
break;
|
case STT_NOTYPE:
|
||||||
|
// The symbol's type is not specified.
|
||||||
|
break;
|
||||||
|
|
||||||
case STT_OBJECT:
|
case STT_OBJECT:
|
||||||
// The symbol is associated with a data object, such as a variable,
|
// The symbol is associated with a data object, such as a variable,
|
||||||
// an array, etc.
|
// an array, etc.
|
||||||
symbol_type = eSymbolTypeData;
|
symbol_type = eSymbolTypeData;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STT_FUNC:
|
case STT_FUNC:
|
||||||
// The symbol is associated with a function or other executable code.
|
// The symbol is associated with a function or other executable code.
|
||||||
symbol_type = eSymbolTypeCode;
|
symbol_type = eSymbolTypeCode;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STT_SECTION:
|
case STT_SECTION:
|
||||||
// The symbol is associated with a section. Symbol table entries of
|
// The symbol is associated with a section. Symbol table entries of
|
||||||
// this type exist primarily for relocation and normally have
|
// this type exist primarily for relocation and normally have
|
||||||
// STB_LOCAL binding.
|
// STB_LOCAL binding.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STT_FILE:
|
case STT_FILE:
|
||||||
// Conventionally, the symbol's name gives the name of the source
|
// Conventionally, the symbol's name gives the name of the source
|
||||||
// file associated with the object file. A file symbol has STB_LOCAL
|
// file associated with the object file. A file symbol has STB_LOCAL
|
||||||
// binding, its section index is SHN_ABS, and it precedes the other
|
// binding, its section index is SHN_ABS, and it precedes the other
|
||||||
// STB_LOCAL symbols for the file, if it is present.
|
// STB_LOCAL symbols for the file, if it is present.
|
||||||
symbol_type = eSymbolTypeObjectFile;
|
symbol_type = eSymbolTypeObjectFile;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol_type == eSymbolTypeInvalid)
|
if (symbol_type == eSymbolTypeInvalid)
|
||||||
|
|
Loading…
Reference in New Issue