Skip to content

Commit

Permalink
Fix patcher for ppc and aarch64
Browse files Browse the repository at this point in the history
Prevent the compiler from reordering the instructions in the patcher by
marking the assembly code as clobbering memory.

Thanks @pinskia for the patch and for bringing the discussion on the gcc
bugzilla.

Fixes open-mpi#13014.

Signed-off-by: George Bosilca <[email protected]>
  • Loading branch information
bosilca committed Jan 9, 2025
1 parent 285f6b1 commit 94f092e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions opal/mca/patcher/patcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
* Reference: "64-bit PowerPC ELF Application Binary Interface Supplement 1.9" */
# define OPAL_PATCHER_BEGIN \
unsigned long toc_save; \
asm volatile("std 2, %0" : "=m"(toc_save)); \
asm volatile("nop; nop; nop; nop; nop");
# define OPAL_PATCHER_END asm volatile("ld 2, %0" : : "m"(toc_save));
asm volatile("std 2, %0" : "=m"(toc_save) :: "memory"); \
asm volatile("nop; nop; nop; nop; nop"::: "memory");
# define OPAL_PATCHER_END asm volatile("ld 2, %0" : : "m"(toc_save) : "memory");

#else /* !__PPC64__ */

Expand Down

0 comments on commit 94f092e

Please sign in to comment.