<rdar://problem/11537498>

Fixed an issue with the symbol table parsing of files that have STAB entries in them where there are two N_SO entries where the first has a directory, and the second contains a full path:

[     0] 00000002 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/'
[     1] 0000001e 64 (N_SO         ) 00     0000   0000000000000000 '/Volumes/data/src/Source/main.m'
[     2] 00000047 66 (N_OSO        ) 09     0001   000000004fc642d2 '/tmp/main.o'
[     3] 00000001 2e (N_BNSYM      ) 01     0000   0000000000003864
[     4] 000000bd 24 (N_FUN        ) 01     0000   0000000000003864 '_main'
[     5] 00000001 24 (N_FUN        ) 00     0000   00000000000000ae
[     6] 00000001 4e (N_ENSYM      ) 01     0000   00000000000000ae
[     7] 00000001 64 (N_SO         ) 01     0000   0000000000000000

We now correctly combine entries 0 and 1 into a single entry.

llvm-svn: 157712
This commit is contained in:
Greg Clayton 2012-05-30 20:20:34 +00:00
parent 04ed2e46a1
commit 177b855ed7
1 changed files with 20 additions and 2 deletions

View File

@ -1665,10 +1665,28 @@ ObjectFileMachO::ParseSymtab (bool minimize)
{
// We use the current number of symbols in the symbol table in lieu of
// using nlist_idx in case we ever start trimming entries out
if (symbol_name[0] == '/')
N_SO_index = sym_idx;
const bool N_SO_has_full_path = symbol_name[0] == '/';
if (N_SO_has_full_path)
{
if (minimize && (N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms))
{
// We have two consecutive N_SO entries where the first contains a directory
// and the second contains a full path.
sym[sym_idx - 1].GetMangled().SetValue(symbol_name, false);
m_nlist_idx_to_sym_idx[nlist_idx] = sym_idx - 1;
add_nlist = false;
}
else
{
// This is the first entry in a N_SO that contains a directory or
// a full path to the source file
N_SO_index = sym_idx;
}
}
else if (minimize && (N_SO_index == sym_idx - 1) && ((sym_idx - 1) < num_syms))
{
// This is usually the second N_SO entry that contains just the filename,
// so here we combine it with the first one if we are minimizing the symbol table
const char *so_path = sym[sym_idx - 1].GetMangled().GetDemangledName().AsCString();
if (so_path && so_path[0])
{