mirror of
https://github.com/rui314/mold.git
synced 2024-12-29 11:24:36 +03:00
wip
This commit is contained in:
parent
1827c07dab
commit
640e9ba2d5
3
main.cc
3
main.cc
@ -203,7 +203,8 @@ static void create_synthetic_sections() {
|
||||
add(out::got = new GotSection);
|
||||
add(out::gotplt = new GotPltSection);
|
||||
add(out::relplt = new RelPltSection);
|
||||
add(out::strtab = new StrtabSection);
|
||||
if (!config.strip_all)
|
||||
add(out::strtab = new StrtabSection);
|
||||
add(out::shstrtab = new ShstrtabSection);
|
||||
add(out::plt = new PltSection);
|
||||
add(out::pltgot = new PltGotSection);
|
||||
|
@ -109,6 +109,11 @@ ObjectFile::ObjectFile(MemoryMappedFile *mb, std::string archive_name,
|
||||
is_alive = !is_in_lib;
|
||||
}
|
||||
|
||||
static bool is_debug_section(const ElfShdr &shdr, std::string_view name) {
|
||||
return !(shdr.sh_flags & SHF_ALLOC) &&
|
||||
(name.starts_with(".debug") || name.starts_with(".zdebug"));
|
||||
}
|
||||
|
||||
void ObjectFile::initialize_sections() {
|
||||
// Read sections
|
||||
for (i64 i = 0; i < elf_sections.size(); i++) {
|
||||
@ -156,6 +161,8 @@ void ObjectFile::initialize_sections() {
|
||||
std::string_view name = shstrtab.data() + shdr.sh_name;
|
||||
if (name == ".note.gnu.property")
|
||||
continue;
|
||||
if (config.strip_all && is_debug_section(shdr, name))
|
||||
continue;
|
||||
|
||||
this->sections[i] = InputSection::create(*this, &shdr, name, i);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user