* [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708]
@ 2022-05-24 16:45 Wilco Dijkstra
2022-05-25 7:20 ` Richard Sandiford
0 siblings, 1 reply; 4+ messages in thread
From: Wilco Dijkstra @ 2022-05-24 16:45 UTC (permalink / raw)
To: Richard Sandiford, Kyrylo Tkachov; +Cc: GCC Patches
Increase the priority of the init_have_lse_atomics constructor so it runs
before other constructors. This improves chances that rr works when LSE
atomics are supported.
Regress and bootstrap pass, OK for commit?
2022-05-24 Wilco Dijkstra <wdijkstr@arm.com>
libgcc/
PR libgcc/105708
* config/aarch64/lse-init.c: Increase constructor priority.
---
diff --git a/libgcc/config/aarch64/lse-init.c b/libgcc/config/aarch64/lse-init.c
index fc875b7fe80e947623e570eac130e7a14b516551..988882d91dfeed77f299aa610d72091499271490 100644
--- a/libgcc/config/aarch64/lse-init.c
+++ b/libgcc/config/aarch64/lse-init.c
@@ -38,7 +38,7 @@ _Bool __aarch64_have_lse_atomics
unsigned long int __getauxval (unsigned long int);
-static void __attribute__((constructor))
+static void __attribute__((constructor (90)))
init_have_lse_atomics (void)
{
unsigned long hwcap = __getauxval (AT_HWCAP);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708]
2022-05-24 16:45 [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708] Wilco Dijkstra
@ 2022-05-25 7:20 ` Richard Sandiford
2022-05-25 10:42 ` Wilco Dijkstra
0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2022-05-25 7:20 UTC (permalink / raw)
To: Wilco Dijkstra; +Cc: Kyrylo Tkachov, GCC Patches
Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> Increase the priority of the init_have_lse_atomics constructor so it runs
> before other constructors. This improves chances that rr works when LSE
> atomics are supported.
Can you add a comment above the function explaining why we chose 90
in particular? I see 100 was originally suggested in the PR.
Thanks,
Richard
> Regress and bootstrap pass, OK for commit?
>
> 2022-05-24 Wilco Dijkstra <wdijkstr@arm.com>
>
> libgcc/
> PR libgcc/105708
> * config/aarch64/lse-init.c: Increase constructor priority.
>
> ---
> diff --git a/libgcc/config/aarch64/lse-init.c b/libgcc/config/aarch64/lse-init.c
> index fc875b7fe80e947623e570eac130e7a14b516551..988882d91dfeed77f299aa610d72091499271490 100644
> --- a/libgcc/config/aarch64/lse-init.c
> +++ b/libgcc/config/aarch64/lse-init.c
> @@ -38,7 +38,7 @@ _Bool __aarch64_have_lse_atomics
>
> unsigned long int __getauxval (unsigned long int);
>
> -static void __attribute__((constructor))
> +static void __attribute__((constructor (90)))
> init_have_lse_atomics (void)
> {
> unsigned long hwcap = __getauxval (AT_HWCAP);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708]
2022-05-25 7:20 ` Richard Sandiford
@ 2022-05-25 10:42 ` Wilco Dijkstra
2022-05-25 11:57 ` Richard Sandiford
0 siblings, 1 reply; 4+ messages in thread
From: Wilco Dijkstra @ 2022-05-25 10:42 UTC (permalink / raw)
To: Richard Sandiford; +Cc: Kyrylo Tkachov, GCC Patches
Hi Richard,
I've added a comment - as usual it's just a number. A quick grep in gcc and
glibc showed that priorities 98-101 are used, so I just went a bit below so it
has a higher priority than typical initializations.
Cheers,
Wilco
Here is v2:
Increase the priority of the init_have_lse_atomics constructor so it runs
before other constructors. This improves chances that rr works when LSE
atomics are supported.
Regress and bootstrap pass, OK for commit?
2022-05-24 Wilco Dijkstra <wdijkstr@arm.com>
libgcc/
PR libgcc/105708
* config/aarch64/lse-init.c: Increase constructor priority.
---
diff --git a/libgcc/config/aarch64/lse-init.c b/libgcc/config/aarch64/lse-init.c
index fc875b7fe80e947623e570eac130e7a14b516551..33b97c8d766895cf0101a851e1dc4ed6a1a053d9 100644
--- a/libgcc/config/aarch64/lse-init.c
+++ b/libgcc/config/aarch64/lse-init.c
@@ -38,7 +38,9 @@ _Bool __aarch64_have_lse_atomics
unsigned long int __getauxval (unsigned long int);
-static void __attribute__((constructor))
+/* Use a higher priority to ensure it runs before user constructors
+ and library constructors with priority 100. */
+static void __attribute__((constructor (90)))
init_have_lse_atomics (void)
{
unsigned long hwcap = __getauxval (AT_HWCAP);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708]
2022-05-25 10:42 ` Wilco Dijkstra
@ 2022-05-25 11:57 ` Richard Sandiford
0 siblings, 0 replies; 4+ messages in thread
From: Richard Sandiford @ 2022-05-25 11:57 UTC (permalink / raw)
To: Wilco Dijkstra; +Cc: Kyrylo Tkachov, GCC Patches
Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
> Hi Richard,
>
> I've added a comment - as usual it's just a number. A quick grep in gcc and
> glibc showed that priorities 98-101 are used, so I just went a bit below so it
> has a higher priority than typical initializations.
Thanks. OK for trunk, and for backports after a trial period.
Richard
> Cheers,
> Wilco
>
> Here is v2:
>
> Increase the priority of the init_have_lse_atomics constructor so it runs
> before other constructors. This improves chances that rr works when LSE
> atomics are supported.
>
> Regress and bootstrap pass, OK for commit?
>
> 2022-05-24 Wilco Dijkstra <wdijkstr@arm.com>
>
> libgcc/
> PR libgcc/105708
> * config/aarch64/lse-init.c: Increase constructor priority.
>
> ---
>
> diff --git a/libgcc/config/aarch64/lse-init.c b/libgcc/config/aarch64/lse-init.c
> index fc875b7fe80e947623e570eac130e7a14b516551..33b97c8d766895cf0101a851e1dc4ed6a1a053d9 100644
> --- a/libgcc/config/aarch64/lse-init.c
> +++ b/libgcc/config/aarch64/lse-init.c
> @@ -38,7 +38,9 @@ _Bool __aarch64_have_lse_atomics
>
> unsigned long int __getauxval (unsigned long int);
>
> -static void __attribute__((constructor))
> +/* Use a higher priority to ensure it runs before user constructors
> + and library constructors with priority 100. */
> +static void __attribute__((constructor (90)))
> init_have_lse_atomics (void)
> {
> unsigned long hwcap = __getauxval (AT_HWCAP);
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-05-25 11:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 16:45 [PATCH] AArch64: Prioritise init_have_lse_atomics constructor [PR 105708] Wilco Dijkstra
2022-05-25 7:20 ` Richard Sandiford
2022-05-25 10:42 ` Wilco Dijkstra
2022-05-25 11:57 ` Richard Sandiford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).