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 2020-10-29 13:31:41 +09:00
parent d6ff4b4427
commit 979622e09d
2 changed files with 13 additions and 3 deletions

View File

@ -287,12 +287,13 @@ void ObjectFile::eliminate_duplicate_comdat_groups() {
}
}
static OutputSection bss(".bss", SHF_ALLOC, SHT_NOBITS);
void ObjectFile::convert_common_symbols() {
if (!has_common_symbol)
return;
static OutputSection *bss =
OutputSection::get_instance(".bss", SHF_WRITE | SHF_ALLOC, SHT_NOBITS);
for (int i = first_global; i < elf_syms.size(); i++) {
if (elf_syms[i].st_shndx != SHN_COMMON)
continue;
@ -305,14 +306,18 @@ void ObjectFile::convert_common_symbols() {
memset(shdr, 0, sizeof(*shdr));
shdr->sh_flags = SHF_ALLOC;
shdr->sh_type = SHT_NOBITS;
shdr->sh_size = elf_syms[i].st_size;
shdr->sh_addralign = 1;
auto *isec = new InputSection(this, *shdr, ".bss");
isec->output_section = &bss;
isec->output_section = bss;
sections.push_back(isec);
sym->input_section = isec;
sym->value = 0;
if (sym->name == "__new_exitfn_called")
llvm::outs() << "name=" << toString(this) << " " << sym->name << "\n";
}
}

View File

@ -153,6 +153,11 @@ static void bin_sections(std::vector<ObjectFile *> &files) {
for (InputSection *isec : file->sections) {
if (!isec)
continue;
if (toString(file) == "/usr/lib/x86_64-linux-gnu/libc.a:cxa_atexit.o")
llvm::outs() << "isec=" << toString(isec)
<< " " << toString(isec)
<< " " << (void *)isec->output_section << "\n";
OutputSection *osec = isec->output_section;
osec->sections.push_back(isec);
}