- // this atom is did not exist orginally, tell ld about it
- newAtoms.push_back(atom);
+ // an atom of this name was not in the allAtoms list the linker gave us
+ if ( deadllvmAtoms.find(name) != deadllvmAtoms.end() ) {
+ // this corresponding to an atom that the linker coalesced away. Ignore it
+ // Make sure there any dependent atoms are also marked dead
+ std::vector<ObjectFile::Reference*>& refs = atom->getReferences();
+ for (std::vector<ObjectFile::Reference*>::iterator ri=refs.begin(), re=refs.end(); ri != re; ++ri) {
+ ObjectFile::Reference* ref = *ri;
+ if ( ref->getKind() == 2 /*kGroupSubordinate*/ ) { // FIX FIX
+ ObjectFile::Atom* targ = &ref->getTarget();
+ deadllvmAtoms[targ->getName()] = (Atom*)atom;
+ }
+ }
+ }
+ else
+ {
+ // this is something new that lto conjured up, tell ld its new
+ newAtoms.push_back(atom);
+ }