Skip to content

Commit 94f092e

Browse files
committed
Fix patcher for ppc and aarch64
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 #13014. Signed-off-by: George Bosilca <[email protected]>
1 parent 285f6b1 commit 94f092e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

opal/mca/patcher/patcher.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
* Reference: "64-bit PowerPC ELF Application Binary Interface Supplement 1.9" */
3131
# define OPAL_PATCHER_BEGIN \
3232
unsigned long toc_save; \
33-
asm volatile("std 2, %0" : "=m"(toc_save)); \
34-
asm volatile("nop; nop; nop; nop; nop");
35-
# define OPAL_PATCHER_END asm volatile("ld 2, %0" : : "m"(toc_save));
33+
asm volatile("std 2, %0" : "=m"(toc_save) :: "memory"); \
34+
asm volatile("nop; nop; nop; nop; nop"::: "memory");
35+
# define OPAL_PATCHER_END asm volatile("ld 2, %0" : : "m"(toc_save) : "memory");
3636

3737
#else /* !__PPC64__ */
3838

0 commit comments

Comments
 (0)