Commit fa8bedce authored by wolfgang.thaller@gmx.net's avatar wolfgang.thaller@gmx.net
Browse files

Handle Weak Definitions in the Darwin Linker

The __i686.get_pc_thunk symbols generated by gcc's PIC code generator are weak definitions that appear in every object file, so we need to deal with them.

MERGE TO STABLE.
parent 2b817fc5
......@@ -4179,12 +4179,17 @@ static int ocGetNames_MachO(ObjectCode* oc)
if(nlist[i].n_type & N_EXT)
{
char *nm = image + symLC->stroff + nlist[i].n_un.n_strx;
ghciInsertStrHashTable(oc->fileName, symhash, nm,
image
+ sections[nlist[i].n_sect-1].offset
- sections[nlist[i].n_sect-1].addr
+ nlist[i].n_value);
oc->symbols[curSymbol++] = nm;
if((nlist[i].n_desc & N_WEAK_DEF) && lookupSymbol(nm))
; // weak definition, and we already have a definition
else
{
ghciInsertStrHashTable(oc->fileName, symhash, nm,
image
+ sections[nlist[i].n_sect-1].offset
- sections[nlist[i].n_sect-1].addr
+ nlist[i].n_value);
oc->symbols[curSymbol++] = nm;
}
}
else
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment