diff mbox series

[1/2] Map ABI/VERSION of rtld to ABI/VERSION of ld [BZ #28132]

Message ID 20210802042940.932692-1-hjl.tools@gmail.com
State New
Headers show
Series [1/2] Map ABI/VERSION of rtld to ABI/VERSION of ld [BZ #28132] | expand

Commit Message

H.J. Lu Aug. 2, 2021, 4:29 a.m. UTC
Since the module name of ld is rtld, map ABI/VERSION of rtld to ABI/VERSION
of ld.  This fixes BZ #28132.
---
 scripts/abi-versions.awk | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Carlos O'Donell Oct. 6, 2022, 4:38 p.m. UTC | #1
On Sun, Aug 01, 2021 at 09:29:39PM -0700, H.J. Lu via Libc-alpha wrote:
> Since the module name of ld is rtld, map ABI/VERSION of rtld to ABI/VERSION
> of ld.  This fixes BZ #28132.

Reviewing old patches that are still outstanding as part of the queue
review in patchwork. Hopefully we catch up to the point where I'm not
reviewing year old patches in the queue. However, some of these patches
are interesting and valuable so I'm reviving them to review potential
solutions.

In scripts/gen-libc-modules.awk we have this code:
 21   if (name == "ld")
 22     name = "rtld"

This means we are already handling this processing in other places. A
clean solution needs to consider:

scripts/abi-version.awk (no changes, should just use rtld)
scripts/gen-libc-modules.awk (ld vs rtld)
shlib-versions (ld=...)

It feels like we need to refactor from the top just use rtld everywhere
we accidentally used ld as our identifier.

> ---
>  scripts/abi-versions.awk | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/scripts/abi-versions.awk b/scripts/abi-versions.awk
> index c369793459..09c9432f5c 100644
> --- a/scripts/abi-versions.awk
> +++ b/scripts/abi-versions.awk
> @@ -27,6 +27,11 @@ $2 == "=" {
>  
>    printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
>    printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;
> +  if (libid == "ld") {
> +    # The module name of ld is rtld.
> +    printf "#define ABI_rtld_%s\tABI_ld_%s\n", oldid, oldid
> +    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", oldid, oldid
> +  }
>  
>    next;
>  }
> @@ -38,6 +43,11 @@ $2 == "=" {
>  
>    printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
>    printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
> +  if (libid == "ld") {
> +    # The module name of ld is rtld.
> +    printf "#define ABI_rtld_%s\tABI_ld_%s\n", versid, versid
> +    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", versid, versid
> +  }
>    next;
>  }
>  
> -- 
> 2.31.1
>
H.J. Lu Oct. 6, 2022, 6:46 p.m. UTC | #2
On Thu, Oct 6, 2022 at 9:39 AM Carlos O'Donell <carlos@redhat.com> wrote:
>
> On Sun, Aug 01, 2021 at 09:29:39PM -0700, H.J. Lu via Libc-alpha wrote:
> > Since the module name of ld is rtld, map ABI/VERSION of rtld to ABI/VERSION
> > of ld.  This fixes BZ #28132.
>
> Reviewing old patches that are still outstanding as part of the queue
> review in patchwork. Hopefully we catch up to the point where I'm not
> reviewing year old patches in the queue. However, some of these patches
> are interesting and valuable so I'm reviving them to review potential
> solutions.
>
> In scripts/gen-libc-modules.awk we have this code:
>  21   if (name == "ld")
>  22     name = "rtld"
>
> This means we are already handling this processing in other places. A
> clean solution needs to consider:
>
> scripts/abi-version.awk (no changes, should just use rtld)
> scripts/gen-libc-modules.awk (ld vs rtld)
> shlib-versions (ld=...)
>
> It feels like we need to refactor from the top just use rtld everywhere
> we accidentally used ld as our identifier.

Since LD_SO is defined in lib-names.h, change ld.so to rtld.so requires
scripts/lib-names.awk change.   It is a much bigger and messy change.

> > ---
> >  scripts/abi-versions.awk | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > diff --git a/scripts/abi-versions.awk b/scripts/abi-versions.awk
> > index c369793459..09c9432f5c 100644
> > --- a/scripts/abi-versions.awk
> > +++ b/scripts/abi-versions.awk
> > @@ -27,6 +27,11 @@ $2 == "=" {
> >
> >    printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
> >    printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;
> > +  if (libid == "ld") {
> > +    # The module name of ld is rtld.
> > +    printf "#define ABI_rtld_%s\tABI_ld_%s\n", oldid, oldid
> > +    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", oldid, oldid
> > +  }
> >
> >    next;
> >  }
> > @@ -38,6 +43,11 @@ $2 == "=" {
> >
> >    printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
> >    printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
> > +  if (libid == "ld") {
> > +    # The module name of ld is rtld.
> > +    printf "#define ABI_rtld_%s\tABI_ld_%s\n", versid, versid
> > +    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", versid, versid
> > +  }
> >    next;
> >  }
> >
> > --
> > 2.31.1
> >
>


--
H.J.
H.J. Lu Oct. 6, 2022, 7:52 p.m. UTC | #3
On Thu, Oct 6, 2022 at 11:46 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Oct 6, 2022 at 9:39 AM Carlos O'Donell <carlos@redhat.com> wrote:
> >
> > On Sun, Aug 01, 2021 at 09:29:39PM -0700, H.J. Lu via Libc-alpha wrote:
> > > Since the module name of ld is rtld, map ABI/VERSION of rtld to ABI/VERSION
> > > of ld.  This fixes BZ #28132.
> >
> > Reviewing old patches that are still outstanding as part of the queue
> > review in patchwork. Hopefully we catch up to the point where I'm not
> > reviewing year old patches in the queue. However, some of these patches
> > are interesting and valuable so I'm reviving them to review potential
> > solutions.
> >
> > In scripts/gen-libc-modules.awk we have this code:
> >  21   if (name == "ld")
> >  22     name = "rtld"
> >
> > This means we are already handling this processing in other places. A
> > clean solution needs to consider:
> >
> > scripts/abi-version.awk (no changes, should just use rtld)
> > scripts/gen-libc-modules.awk (ld vs rtld)
> > shlib-versions (ld=...)
> >
> > It feels like we need to refactor from the top just use rtld everywhere
> > we accidentally used ld as our identifier.
>
> Since LD_SO is defined in lib-names.h, change ld.so to rtld.so requires
> scripts/lib-names.awk change.   It is a much bigger and messy change.
>

We change all internal usages to rtld by

diff --git a/elf/dl-compat.c b/elf/dl-compat.c
index 05c986a8be..6691ad1cc9 100644
--- a/elf/dl-compat.c
+++ b/elf/dl-compat.c
@@ -22,7 +22,7 @@
 /* The GLIBC_2.35 symbol version is present naturally for later ports.
    Use OTHER_SHLIB_COMPAT because the module is called rtld, but the
    ABI version uses ld.  */
-#if OTHER_SHLIB_COMPAT (ld, GLIBC_2_0, GLIBC_2_35)
+#if OTHER_SHLIB_COMPAT (rtld, GLIBC_2_0, GLIBC_2_35)
 void
 attribute_compat_text_section
 __attribute_used__
@@ -30,6 +30,6 @@ __rtld_version_placeholder_1 (void)
 {
 }

-compat_symbol (ld, __rtld_version_placeholder_1,
+compat_symbol (rtld, __rtld_version_placeholder_1,
                __rtld_version_placeholder, GLIBC_2_34);
 #endif
diff --git a/scripts/abi-versions.awk b/scripts/abi-versions.awk
index c369793459..5d229b2977 100644
--- a/scripts/abi-versions.awk
+++ b/scripts/abi-versions.awk
@@ -25,6 +25,8 @@ $2 == "=" {
   gsub(/[^A-Za-z0-9_ ]/, "_");
   oldid = $1; newid = $3;

+  if (libid == "ld")
+    libid = "rtld";
   printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
   printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;

@@ -36,6 +38,8 @@ $2 == "=" {
   gsub(/[^A-Za-z0-9_ ]/, "_");
   versid = $1;

+  if (libid == "ld")
+    libid = "rtld";
   printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
   printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
   next;
diff mbox series

Patch

diff --git a/scripts/abi-versions.awk b/scripts/abi-versions.awk
index c369793459..09c9432f5c 100644
--- a/scripts/abi-versions.awk
+++ b/scripts/abi-versions.awk
@@ -27,6 +27,11 @@  $2 == "=" {
 
   printf "#define ABI_%s_%s\tABI_%s_%s\n", libid, oldid, libid, newid;
   printf "#define VERSION_%s_%s\t%s\n", libid, oldid, new;
+  if (libid == "ld") {
+    # The module name of ld is rtld.
+    printf "#define ABI_rtld_%s\tABI_ld_%s\n", oldid, oldid
+    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", oldid, oldid
+  }
 
   next;
 }
@@ -38,6 +43,11 @@  $2 == "=" {
 
   printf "#define ABI_%s_%s\t%d\t/* support %s */\n", libid, versid, ++n, vers;
   printf "#define VERSION_%s_%s\t%s\n", libid, versid, vers;
+  if (libid == "ld") {
+    # The module name of ld is rtld.
+    printf "#define ABI_rtld_%s\tABI_ld_%s\n", versid, versid
+    printf "#define VERSION_rtld_%s\tVERSION_ld_%s\n", versid, versid
+  }
   next;
 }