1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2021-01-10 14:09:50 +09:00
parent aece9bd436
commit 0be42acf12
2 changed files with 7 additions and 19 deletions

25
main.cc
View File

@ -255,16 +255,6 @@ static void bin_sections() {
static void check_duplicate_symbols() {
Timer t("check_undef_syms");
auto is_error = [](ObjectFile *file, int i) {
const ElfSym &esym = file->elf_syms[i];
Symbol &sym = *file->symbols[i];
bool is_weak = (esym.st_bind == STB_WEAK);
bool is_eliminated =
!esym.is_abs() && !esym.is_common() && !file->sections[esym.st_shndx];
return esym.is_defined() && !is_weak && !is_eliminated && sym.file != file;
};
std::atomic_bool has_error = false;
tbb::parallel_for_each(out::objs, [&](ObjectFile *file) {
@ -279,21 +269,18 @@ static void check_duplicate_symbols() {
!esym.is_abs() && !esym.is_common() && !file->sections[esym.st_shndx];
if (esym.is_defined() && !is_weak && !is_eliminated && sym.file != file) {
std::cerr << "duplicate symbol: " << *file << ": " << *sym.file << ": "
<< sym.name << "\n";
has_error = true;
return;
}
}
});
for (ObjectFile *file : out::objs)
for (int i = file->first_global; i < file->elf_syms.size(); i++)
if (is_error(file, i))
std::cerr << "duplicate symbol: " << *file
<< ": " << *file->symbols[i]->file << ": "
<< file->symbols[i]->name << "\n";
if (has_error)
if (has_error) {
for (ObjectFile *file : out::objs)
std::cerr << file->err_out.str();
_exit(1);
}
}
static void set_isec_offsets() {

1
mold.h
View File

@ -751,6 +751,7 @@ public:
int first_global = 0;
const bool is_in_archive;
std::atomic_bool has_error = false;
std::ostringstream err_out;
u64 num_dynrel = 0;
u64 reldyn_offset = 0;