[Bug 276961] buildworld artifacts not reproducible between native and cross build

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 11 Feb 2024 00:21:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276961

            Bug ID: 276961
           Summary: buildworld artifacts not reproducible between native
                    and cross build
           Product: Base System
           Version: 13.3-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: misc
          Assignee: bugs@FreeBSD.org
          Reporter: emaste@freebsd.org

Created attachment 248338
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=248338&action=edit
list of differing artifacts

On stable/13 cperciva discovered a number of artifacts produced by buildworld
that differ between native (e.g. i386 buildworld in i386 jail) and cross (e.g.
i386 buildworld on amd64 with TARGET/TARGET_ARCH set) builds.

PR276960 describes one example. Other cases are different stack layouts or
instruction ordering, pointing to nondeterminism in Clang. This example is a
disassembly of mkfs.o, responsible for the difference in makefs:

- objdump --line-numbers --disassemble --demangle --reloc --no-show-raw-insn
--section=.text {}
@@ -24590,15 +24590,15 @@
              movl    $0x0, 0x42ca00    
              movl    $0x0, 0x42cccc    
              movl    $0x1, 0x42cec0    
              movl    $0x1, 0x42cec4    
              xorl    %eax, %eax
              movl    $0x2000, %ecx           # imm = 0x2000
              jmp     0x41e7fa <ffs_mkfs+0x79a>
+             movl    %ebx, 0x2c(%esp)  
-             movl    %ebx, 0x30(%esp)  
              movl    $0x19540119, 0x42ced0   # imm = 0x19540119
              movl    $0x0, 0x42cd60    
              movl    $0x10000, 0x42cd5c      # imm = 0x10000   
              movl    0x4(%esp), %eax   
              movl    %eax, %ecx
              shrl    $0x3, %ecx
              movl    %ecx, %edi
@@ -24611,15 +24611,15 @@
              movl    $0x10000, %ecx          # imm = 0x10000
              movl    0x8(%esp), %edx   
              cmpl    $0x1, 0x70(%edx)  
              movl    %esi, 0x20(%esp)  
              movl    %edi, (%esp)
              jne     0x41e7f6 <ffs_mkfs+0x796>
              orb     $0x2, 0x42ce94    
+             movl    0x2c(%esp), %ebx  
-             movl    0x30(%esp), %ebx  
              movl    0x14(%esp), %edx  
              addl    %ecx, %edx
              adcl    %eax, %ebx
              addl    $0x2000, %edx           # imm = 0x2000
              adcl    $0x0, %ebx
              movl    0xc(%esp), %esi   
              movl    %esi, %eax
@@ -24749,57 +24749,57 @@
              leal    (%ebx,%ecx), %edx 
              leal    (%eax,%edx), %ecx 
              decl    %ecx
              movl    %ecx, %eax
              xorl    %edx, %edx
              divl    %ebx
              subl    %edx, %ecx
+             movl    %ecx, 0x2c(%esp)  
-             movl    %ecx, 0x3c(%esp)  
              movl    %ebx, 0x28(%esp)  
              movl    0xc(%esp), %eax   
              addl    %ebx, %eax
              decl    %eax
              movl    %eax, 0x38(%esp)  
              movl    0x42ca28, %eax    
              addl    %eax, %eax
              leal    (%eax,%eax,2), %eax
              movl    %eax, 0x34(%esp)  
              movl    0x42c9a4, %eax    
              addl    $-0x8, %eax
+             movl    %eax, 0x48(%esp)  
+             movl    0x42c9a8, %eax    
              movl    %eax, 0x40(%esp)  
-             movl    0x42c9a8, %eax    
-             movl    %eax, 0x44(%esp)  
              negl    %eax
+             movl    %eax, 0x30(%esp)  
-             movl    %eax, 0x2c(%esp)  
              movl    %edi, (%esp)
              leal    -0x1(%edi), %eax  
              movl    %eax, 0x4(%esp)   
              movl    0x42ce98, %eax    
+             movl    %eax, 0x3c(%esp)  
-             movl    %eax, 0x48(%esp)  
              leal    (,%eax,4), %eax   
              movl    %eax, 0x50(%esp)  
              movl    %esi, %edx
              movl    0x14(%esp), %ecx

-- 
You are receiving this mail because:
You are the assignee for the bug.