binutils Newspaper
JUNE 15, 2026
hppa64 Committed

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

-gc-section support is re-enabled for hppa64-*-hpux targets by allocating space in .data to handle invalid relocation offsets.

John David Anglin re-enables -gc-section support for hppa64-*-hpux targets. The change allocates 16 bytes at the start of the .data section for the linker to handle relocations with invalid offsets. This resolves issues with the HP dynamic linker and allows for garbage collection of unused sections.

In Details

The -gc-section flag enables garbage collection of unused sections during linking. This patch re-enables this feature for hppa64-*-hpux targets by allocating space to handle invalid relocation offsets. The HP-UX dynamic linker requires valid relocation offsets, and this change provides a workaround.

For Context

The -gc-section option tells the linker to remove unused code and data from the final executable, reducing its size. This patch fixes a problem that prevented this optimization from working correctly on HP-UX systems. The fix involves reserving some space in the data section to handle certain types of relocation issues.

Filed Under: binutilsldhppa64hpux-gc-section