mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	x86_64 MULADDC assembly: add missing constraints about memory
MULADDC_CORE reads from (%%rsi) and writes to (%%rdi). This fragment is repeated up to 16 times, and %%rsi and %%rdi are s and d on entry respectively. Hence the complete asm statement reads 16 64-bit words from memory starting at s, and writes 16 64-bit words starting at d. Without any declaration of modified memory, Clang 12 and Clang 13 generated non-working code for mbedtls_mpi_mod_exp. The constraints make the unit tests pass with Clang 12. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
		
							parent
							
								
									cacec723c8
								
							
						
					
					
						commit
						d337fbc4cb
					
				
							
								
								
									
										3
									
								
								ChangeLog.d/muladdc-amd64-memory.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								ChangeLog.d/muladdc-amd64-memory.txt
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					Bugfix
 | 
				
			||||||
 | 
					   * Fix missing constraints on x86_64 assembly code for bignum multiplication
 | 
				
			||||||
 | 
					     that broke some bignum operations with (at least) Clang 12. Fixes #4786.
 | 
				
			||||||
@ -225,8 +225,8 @@
 | 
				
			|||||||
        "addq   $8, %%rdi\n"
 | 
					        "addq   $8, %%rdi\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define MULADDC_STOP                        \
 | 
					#define MULADDC_STOP                        \
 | 
				
			||||||
        : "+c" (c), "+D" (d), "+S" (s)      \
 | 
					        : "+c" (c), "+D" (d), "+S" (s), "+m" (*(uint64_t (*)[16]) d) \
 | 
				
			||||||
        : "b" (b)                           \
 | 
					        : "b" (b), "m" (*(const uint64_t (*)[16]) s)                 \
 | 
				
			||||||
        : "rax", "rdx", "r8"                                         \
 | 
					        : "rax", "rdx", "r8"                                         \
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user