mirror of
https://github.com/rui314/mold.git
synced 2024-11-11 16:58:12 +03:00
wip
This commit is contained in:
parent
c5b23ea8f5
commit
b31480fec8
15
main.cc
15
main.cc
@ -380,13 +380,16 @@ static void scan_rels() {
|
||||
// Exit if there was a relocation that refers an undefined symbol.
|
||||
Error::checkpoint();
|
||||
|
||||
// Export symbols referenced by DSOs.
|
||||
tbb::parallel_for_each(out::dsos, [&](SharedFile *file) {
|
||||
for (Symbol *sym : file->undefs)
|
||||
if (sym->file && !sym->file->is_dso)
|
||||
sym->is_exported = true;
|
||||
});
|
||||
if (!config.shared) {
|
||||
// Export symbols referenced by DSOs.
|
||||
tbb::parallel_for_each(out::dsos, [&](SharedFile *file) {
|
||||
for (Symbol *sym : file->undefs)
|
||||
if (sym->file && !sym->file->is_dso)
|
||||
sym->is_exported = true;
|
||||
});
|
||||
}
|
||||
|
||||
// Add imported or exported symbols to .dynsym.
|
||||
tbb::parallel_for_each(out::objs, [&](ObjectFile *file) {
|
||||
for (Symbol *sym : std::span(file->symbols).subspan(file->first_global))
|
||||
if (sym->file == file)
|
||||
|
@ -607,13 +607,19 @@ void ObjectFile::mark_live_objects(std::function<void(ObjectFile *)> feeder) {
|
||||
if (sym.traced)
|
||||
SyncOut() << "trace: " << *this << ": reference to " << sym;
|
||||
|
||||
if (esym.st_bind != STB_WEAK && sym.file && !sym.file->is_alive.exchange(true)) {
|
||||
if (!sym.file->is_dso)
|
||||
feeder((ObjectFile *)sym.file);
|
||||
if (sym.file) {
|
||||
if (sym.file->is_dso) {
|
||||
sym.file->is_alive = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (sym.traced)
|
||||
SyncOut() << "trace: " << *this << " keeps " << *sym.file
|
||||
<< " for " << sym;
|
||||
ObjectFile *obj = (ObjectFile *)sym.file;
|
||||
if (esym.st_bind != STB_WEAK && !obj->is_alive.exchange(true)) {
|
||||
feeder(obj);
|
||||
if (sym.traced)
|
||||
SyncOut() << "trace: " << *this << " keeps " << *obj
|
||||
<< " for " << sym;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user