mirror of
https://github.com/rui314/mold.git
synced 2024-11-11 05:46:58 +03:00
[ELF] Refactor
This commit is contained in:
parent
301d45b2fa
commit
d71c33b3e8
@ -599,31 +599,6 @@ void DynamicSection<E>::copy_buf(Context<E> &ctx) {
|
||||
write_vector(ctx.buf + this->shdr.sh_offset, contents);
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
std::string_view replace_zdebug_prefix(Context<E> &ctx, std::string_view name) {
|
||||
if (name == ".zdebug_aranges")
|
||||
return ".debug_aranges";
|
||||
if (name == ".zdebug_frame")
|
||||
return ".debug_frame";
|
||||
if (name == ".zdebug_info")
|
||||
return ".debug_info";
|
||||
if (name == ".zdebug_line")
|
||||
return ".debug_line";
|
||||
if (name == ".zdebug_loc")
|
||||
return ".debug_loc";
|
||||
if (name == ".zdebug_pubnames")
|
||||
return ".debug_pubnames";
|
||||
if (name == ".zdebug_pubtypes")
|
||||
return ".debug_pubtypes";
|
||||
if (name == ".zdebug_ranges")
|
||||
return ".debug_ranges";
|
||||
if (name == ".zdebug_str")
|
||||
return ".debug_str";
|
||||
if (name == ".zdebug_types")
|
||||
return ".debug_types";
|
||||
return save_string(ctx, "."s + std::string(name.substr(2)));
|
||||
}
|
||||
|
||||
template <typename E>
|
||||
static std::string_view get_output_name(Context<E> &ctx, std::string_view name) {
|
||||
if (ctx.arg.unique &&
|
||||
@ -654,8 +629,30 @@ static std::string_view get_output_name(Context<E> &ctx, std::string_view name)
|
||||
return stem;
|
||||
}
|
||||
|
||||
if (name.starts_with(".zdebug_"))
|
||||
return replace_zdebug_prefix(ctx, name);
|
||||
if (name.starts_with(".zdebug_")) {
|
||||
if (name == ".zdebug_aranges")
|
||||
return ".debug_aranges";
|
||||
if (name == ".zdebug_frame")
|
||||
return ".debug_frame";
|
||||
if (name == ".zdebug_info")
|
||||
return ".debug_info";
|
||||
if (name == ".zdebug_line")
|
||||
return ".debug_line";
|
||||
if (name == ".zdebug_loc")
|
||||
return ".debug_loc";
|
||||
if (name == ".zdebug_pubnames")
|
||||
return ".debug_pubnames";
|
||||
if (name == ".zdebug_pubtypes")
|
||||
return ".debug_pubtypes";
|
||||
if (name == ".zdebug_ranges")
|
||||
return ".debug_ranges";
|
||||
if (name == ".zdebug_str")
|
||||
return ".debug_str";
|
||||
if (name == ".zdebug_types")
|
||||
return ".debug_types";
|
||||
return save_string(ctx, "."s + std::string(name.substr(2)));
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user