Commit: Release the matching_objstack when it is no longer needed.

Alan Modra amodra@gmail.com
Tue Jan 20 04:01:21 GMT 2026


On Mon, Jan 19, 2026 at 03:52:57PM +0000, Nick Clifton wrote:
> Hi Guys,
> 
>   I am applying the patch below to supplement Alan's patch that puts all
>   of the matching data onto an objstack (e6357caf7579).  The patch just
>   adds a final release of the data once it is no longer needed, closing
>   off a memory leak.

Note that reset_resolved_wilds does reinitialise the obstack, which
means you alloc a page.  Ideally that wouldn't happen.

> 
> Cheers
>   Nick
>   
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index 26bd52240c1..0ef33e8a4e6 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -8713,6 +8713,9 @@ lang_process (void)
>  
>    ldemul_finish ();
>  
> +  /* We should not need the wildcard information any more.  */
> +  reset_resolved_wilds ();
> +
>    /* Convert absolute symbols to section relative.  */
>    ldexp_finalize_syms ();
>  

-- 
Alan Modra


More information about the Binutils mailing list