Skip to content

Commit

Permalink
trampoline: Fix compilation error on Linux/hppa.
Browse files Browse the repository at this point in the history
* trampoline/trampoline.c (alloc_trampoline, is_trampoline): Use
'volatile' to block an invalid GCC optimization.
* callback/trampoline_r/trampoline.c (alloc_trampoline_r,
is_trampoline_r): Likewise.
* NEWS: Mention it.
  • Loading branch information
bhaible committed Aug 25, 2024
1 parent ab69a7e commit cb13cd6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2024-08-25 Bruno Haible <[email protected]>

trampoline: Fix compilation error on Linux/hppa.
* trampoline/trampoline.c (alloc_trampoline, is_trampoline): Use
'volatile' to block an invalid GCC optimization.
* callback/trampoline_r/trampoline.c (alloc_trampoline_r,
is_trampoline_r): Likewise.
* NEWS: Mention it.

2024-08-25 Bruno Haible <[email protected]>

vacall: Fix build failure on Linux/hppa.
Expand Down
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ New in 2.5:
(Previously, a build on these platforms failed.)
- loongarch64: Linux with lp64d ABI.
- riscv64: Linux with musl libc.
- hppa: Linux.
- powerpc: FreeBSD, NetBSD.
- powerpc64: FreeBSD.
- powerpc64le: FreeBSD.
Expand Down
9 changes: 6 additions & 3 deletions callback/trampoline_r/trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1076,8 +1076,9 @@ __TR_function alloc_trampoline_r (__TR_function address, void* data0, void* data
* .long <data>
* .long <address>
*/
{ /* work around a bug in gcc 3.* */
void* tramp_r_address = &tramp_r;
{ /* The 'volatile' below works around GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116481>. */
void* volatile tramp_r_address = &tramp_r;
*(long *) (function + 0) = ((long *) ((char*)tramp_r_address-2))[0];
*(long *) (function + 4) = (long) (function + 8);
*(long *) (function + 8) = (long) data;
Expand Down Expand Up @@ -1728,7 +1729,9 @@ int is_trampoline_r (void* function)
{
#if defined(is_tramp) && defined(tramp_data)
#ifdef __hppanew__
void* tramp_r_address = &tramp_r;
/* The 'volatile' below works around GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116481>. */
void* volatile tramp_r_address = &tramp_r;
if (!(((uintptr_t)function & 3) == (TRAMP_BIAS & 3))) return 0;
#endif
if (is_tramp(((char*)function - TRAMP_BIAS)))
Expand Down
9 changes: 6 additions & 3 deletions trampoline/trampoline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,9 @@ trampoline_function_t alloc_trampoline (trampoline_function_t address, void** va
* .long <data>
* .long <address>
*/
{ /* work around a bug in gcc 3.* */
void* tramp_address = &tramp;
{ /* The 'volatile' below works around GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116481>. */
void* volatile tramp_address = &tramp;
*(long *) (function + 0) = ((long *) ((char*)tramp_address-2))[0];
*(long *) (function + 4) = (long) (function + 8);
*(long *) (function + 8) = (long) variable;
Expand Down Expand Up @@ -1987,7 +1988,9 @@ int is_trampoline (void* function)
{
#ifdef is_tramp
#ifdef __hppanew__
void* tramp_address = &tramp;
/* The 'volatile' below works around GCC bug
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116481>. */
void* volatile tramp_address = &tramp;
if (!(((uintptr_t)function & 3) == (TRAMP_BIAS & 3))) return 0;
#endif
return ((is_tramp(((char*)function - TRAMP_BIAS))) ? 1 : 0);
Expand Down

0 comments on commit cb13cd6

Please sign in to comment.