PR28827 testcase

Alan Modra amodra@gmail.com
Mon Feb 7 05:32:31 GMT 2022


On Sun, Feb 06, 2022 at 08:05:38PM -0800, H.J. Lu wrote:
> On Linux/x86-64, I tried this with binutils-2_37-branch:
> 
> diff --git a/ld/ldlang.c b/ld/ldlang.c
> index 042b492d52b..4760d45721a 100644
> --- a/ld/ldlang.c
> +++ b/ld/ldlang.c
> @@ -6509,13 +6509,18 @@ lang_size_sections (bool *relax, bool check_regions)
> 
>    if (expld.dataseg.phase == exp_seg_end_seen)
>      {
> +      static int reset_counter;
> +
>        bool do_reset
>   = lang_size_relro_segment (relax, check_regions);
> 
>        if (do_reset)
>   {
> +   reset_counter++;
>     lang_reset_memory_regions ();
>     one_lang_size_sections_pass (relax, check_regions);
> +   if (reset_counter > 2)
> +     abort ();
>   }
> 
>        if (link_info.relro && expld.dataseg.relro_end)

Not there.  Here:

diff --git a/ld/ldlang.c b/ld/ldlang.c
index 37b64c89ee1..d7c6551217e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -6404,7 +6404,8 @@ lang_size_relro_segment (bool *relax, bool check_regions)
 	 script have increased padding over the original.  Revert.  */
       if (do_data_relro && expld.dataseg.relro_end > data_relro_end)
 	{
-	  expld.dataseg.base = data_initial_base;;
+	  expld.dataseg.base = data_initial_base;
+	  ASSERT (0);
 	  do_reset = true;
 	}
     }

Not hit in 2.37, multiple cases in mainline with your patches applied.
I saw iteration in ldelf_map_segments too.

> Is there a way to enable my patches just for x86?

Yes, but not in their current form.  I intend to apply a fix for
pr28824 that also cures pr28743, at the expense of a possible file
size increase.  This will regress pr18176.  It must, because pr18176.d
has a relro section that ends at 0x24e000 which isn't a multiple of
maxpagesize of 0x200000.  After that you are free to trade off
increased memory on x86 for reduced file size if that is important to
you.

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list