Forwarded from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95692 :
  
  
    
        
           | 
           #    define OPAL_PATCHER_BEGIN                      \  | 
        
    
   
 
The inline-asm needs to clobber memory to avoid moving the END before a different restore the r2.
That is BEGIN should be:
asm volatile ("std 2, %0" : "=m" (toc_save) :: "memory");
asm volatile ("nop; nop; nop; nop; nop" ::: "memory");;
 
While END should be:
asm volatile ("ld  2, %0" : : "m" (toc_save) : "memory");;