binutils Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
hppa64

hppa64: Re-enable -gc-section support on hppa*64*-*-hpux*

-gc-section support is re-enabled for HP-UX on hppa64 by handling relocations with invalid offsets.

-gc-section support has been re-enabled for hppa64--hpux. The linker now allocates 16 bytes at the start of the .data section and remaps relocations with invalid offsets to this area. This resolves issues with the HP dynamic linker and allows unused sections to be garbage collected.

In Details

The HP-UX dynamic linker has issues with relocations that have invalid offsets. This commit allocates 16 bytes at the beginning of the .data section and remaps invalid offsets to this area, resolving the dynamic linker issue and allowing elf_backend_can_gc_sections to be set to one for HP-UX.

For Context

The -gc-sections option tells the linker to remove unused code and data sections, reducing the final executable size. This commit re-enables this optimization for HP-UX on hppa64. It addresses a problem with relocation offsets that prevented garbage collection, resolving compatibility issues with the HP dynamic linker and allowing unused sections to be removed.

Filed Under: ldhppa64hpux-gc-sectionsrelocation