Skip to content

Commit

Permalink
[PPC32] Do not discard .got2 even if --gc-sections is given
Browse files Browse the repository at this point in the history
Even though .got2 may not be referenced directly, we use that section
when processing relocations.
  • Loading branch information
rui314 committed Mar 10, 2024
1 parent 6356fa0 commit 8eae0a3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elf/gc-sections.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ static bool should_keep(const InputSection<E> &isec) {
u32 flags = isec.shdr().sh_flags;
std::string_view name = isec.name();

if constexpr (is_ppc32<E>)
if (name == ".got2")
return true;

return (flags & SHF_GNU_RETAIN) ||
type == SHT_NOTE ||
type == SHT_INIT_ARRAY ||
Expand Down

0 comments on commit 8eae0a3

Please sign in to comment.