Patchwork [4/4] linux: Make profil_counter a compat_symbol (BZ#17726)

login
register
mail settings
Submitter Adhemerval Zanella Netto
Date Aug. 15, 2019, 9:18 p.m.
Message ID <20190815211843.22799-4-adhemerval.zanella@linaro.org>
Download mbox | patch
Permalink /patch/34133/
State New
Headers show

Comments

Adhemerval Zanella Netto - Aug. 15, 2019, 9:18 p.m.
As indicated by Joseph's comment on BZ#17726, this symbol is most
likely a historical ABI accident.  This patch make it on both arm
and sparc ABIs a compat_symbol.

Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn
sparc64-linux-gnu to see if the symbol is still present.

	* gmon/Versions (libc) [GLIBC_2.31]: New entry.
	* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
	Make a compat_symbol.
	* sysdeps/unix/sysv/linux/sparc/profil-counter.h
	(__profil_counter_global): Likewise.
---
 gmon/Versions                                  | 2 ++
 sysdeps/unix/sysv/linux/arm/profil-counter.h   | 5 ++++-
 sysdeps/unix/sysv/linux/sparc/profil-counter.h | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)
Adhemerval Zanella Netto - Aug. 19, 2019, 8:31 p.m.
I will push shortly if no one opposes it.

On 15/08/2019 18:18, Adhemerval Zanella wrote:
> As indicated by Joseph's comment on BZ#17726, this symbol is most
> likely a historical ABI accident.  This patch make it on both arm
> and sparc ABIs a compat_symbol.
> 
> Checked against a build arm-linux-gnueabihf, sparcv9-linux-gnu, adn
> sparc64-linux-gnu to see if the symbol is still present.
> 
> 	* gmon/Versions (libc) [GLIBC_2.31]: New entry.
> 	* sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter):
> 	Make a compat_symbol.
> 	* sysdeps/unix/sysv/linux/sparc/profil-counter.h
> 	(__profil_counter_global): Likewise.
> ---
>  gmon/Versions                                  | 2 ++
>  sysdeps/unix/sysv/linux/arm/profil-counter.h   | 5 ++++-
>  sysdeps/unix/sysv/linux/sparc/profil-counter.h | 5 ++++-
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/gmon/Versions b/gmon/Versions
> index d0b63334f2..cc705bd978 100644
> --- a/gmon/Versions
> +++ b/gmon/Versions
> @@ -19,4 +19,6 @@ libc {
>    GLIBC_2.2.3 {
>      sprofil;
>    }
> +  GLIBC_2.31 {
> +  }
>  }
> diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h
> index 040c7aa59a..df393332e2 100644
> --- a/sysdeps/unix/sysv/linux/arm/profil-counter.h
> +++ b/sysdeps/unix/sysv/linux/arm/profil-counter.h
> @@ -30,5 +30,8 @@ __profil_counter (int signo, siginfo_t *_si, void *scp)
>    asm volatile ("");
>  }
>  #ifndef __profil_counter
> -weak_alias (__profil_counter, profil_counter)
> +# include <shlib-compat.h>
> +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
> +compat_symbol (libc, __profil_counter, profil_counter, GLIBC_2_0);
> +# endif
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/profil-counter.h b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
> index ad06a4fe06..01271103bb 100644
> --- a/sysdeps/unix/sysv/linux/sparc/profil-counter.h
> +++ b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
> @@ -21,6 +21,8 @@
>  #include <sysdeps/unix/sysv/linux/profil-counter.h>
>  
>  #ifndef __profil_counter
> +# include <shlib-compat.h>
> +# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
>  void
>  __profil_counter_global (int signo, struct sigcontext *si)
>  {
> @@ -30,5 +32,6 @@ __profil_counter_global (int signo, struct sigcontext *si)
>    profil_count (si->si_regs.pc);
>  #endif
>  }
> -weak_alias (__profil_counter_global, profil_counter)
> +compat_symbol (libc, __profil_counter_global, profil_counter, GLIBC_2_0);
> +# endif
>  #endif
>
Florian Weimer - Aug. 20, 2019, 10:51 a.m.
* Adhemerval Zanella:

> I will push shortly if no one opposes it.

I thought the consensus was to remove the symbol instead?

Thanks,
Florian
Adhemerval Zanella Netto - Aug. 20, 2019, 12:16 p.m.
On 20/08/2019 07:51, Florian Weimer wrote:
> * Adhemerval Zanella:
> 
>> I will push shortly if no one opposes it.
> 
> I thought the consensus was to remove the symbol instead?

I will re-check the thread again, but I recall that Joseph opposed the symbol 
removal in this specific case.

Patch

diff --git a/gmon/Versions b/gmon/Versions
index d0b63334f2..cc705bd978 100644
--- a/gmon/Versions
+++ b/gmon/Versions
@@ -19,4 +19,6 @@  libc {
   GLIBC_2.2.3 {
     sprofil;
   }
+  GLIBC_2.31 {
+  }
 }
diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h
index 040c7aa59a..df393332e2 100644
--- a/sysdeps/unix/sysv/linux/arm/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/arm/profil-counter.h
@@ -30,5 +30,8 @@  __profil_counter (int signo, siginfo_t *_si, void *scp)
   asm volatile ("");
 }
 #ifndef __profil_counter
-weak_alias (__profil_counter, profil_counter)
+# include <shlib-compat.h>
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
+compat_symbol (libc, __profil_counter, profil_counter, GLIBC_2_0);
+# endif
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/profil-counter.h b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
index ad06a4fe06..01271103bb 100644
--- a/sysdeps/unix/sysv/linux/sparc/profil-counter.h
+++ b/sysdeps/unix/sysv/linux/sparc/profil-counter.h
@@ -21,6 +21,8 @@ 
 #include <sysdeps/unix/sysv/linux/profil-counter.h>
 
 #ifndef __profil_counter
+# include <shlib-compat.h>
+# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_31)
 void
 __profil_counter_global (int signo, struct sigcontext *si)
 {
@@ -30,5 +32,6 @@  __profil_counter_global (int signo, struct sigcontext *si)
   profil_count (si->si_regs.pc);
 #endif
 }
-weak_alias (__profil_counter_global, profil_counter)
+compat_symbol (libc, __profil_counter_global, profil_counter, GLIBC_2_0);
+# endif
 #endif