binutils Newspaper
JUNE 15, 2026
hppa64 Committed

Hppa64: Disable -gc-section support on HPUX

Garbage collection of sections is now disabled for hppa64 HP-UX due to dynamic linker errors with R_PARISC_NONE relocations.

The HP-UX dynamic linker on hppa64 generates an error when encountering dynamic relocations of type R_PARISC_NONE, which can occur in garbage collected sections. This change disables -gc-section support for hppa64 HP-UX to avoid these errors. The patch modifies bfd/elf64-hppa.c and updates several testsuite files to xfail on hppa64--hpux.

In the Thread 1 participant
  1. John David Anglin <dave.anglin@bell.net> proposer

    Disables -gc-section support for hppa64 HP-UX due to dynamic linker issues with R_PARISC_NONE relocations.

    “The HP-UX dynamic linker on hppa generates an error if it detects a dynamic relocation with the R_PARISC_NONE type. As a result, there is no way to handle relocations in sections that are garbage collected. Although these can mostly be avoided, I think it best to disable -gc-section support.”

In Details

The HP-UX dynamic linker's inability to handle R_PARISC_NONE relocations within garbage-collected sections necessitates disabling -gc-section support for hppa64. This involves modifying elf64-hppa.c to disable section garbage collection and updating testsuite files to exclude HP-UX targets. The BFD_ASSERT is reworked to only trigger on HP-UX, and elf_backend_can_gc_sections is set to zero.

For Context

-gc-sections is a linker flag that instructs the linker to remove unused sections from the final executable, reducing its size. This is achieved by marking sections as eligible for garbage collection. Relocations are adjustments the linker makes to addresses within the code to ensure they point to the correct locations after linking. HP-UX's dynamic linker has problems with a specific type of relocation (R_PARISC_NONE) when combined with garbage collection, leading to errors. To avoid these errors, support for -gc-sections is disabled specifically for HP-UX on hppa64 architecture.

Filed Under: binutilshppa64hpuxgc-sectionsrelocation