[Git][reproducible-builds/diffoscope][master] Add support for llvm-16

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon Jul 24 08:10:37 UTC 2023



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
80967c67 by Gianfranco Costamagna at 2023-07-22T10:57:47+02:00
Add support for llvm-16

- - - - -


8 changed files:

- tests/comparators/test_elf.py
- tests/comparators/test_macho.py
- tests/comparators/test_rlib.py
- + tests/data/elfmix_mach_o_expected_diff__text_16
- + tests/data/macho_llvm_expected_diff__stub_helper_16
- + tests/data/macho_llvm_expected_diff__stubs_16
- + tests/data/macho_llvm_expected_diff__text_16
- + tests/data/rlib_llvm_dis_expected_diff_16


Changes:

=====================================
tests/comparators/test_elf.py
=====================================
@@ -39,6 +39,7 @@ from ..utils.tools import (
     skip_if_tool_version_is,
     skip_unless_tool_is_at_least,
 )
+from .test_rlib import llvm_version
 
 
 obj1 = load_fixture("test1.o")
@@ -194,7 +195,11 @@ def test_libmix_differences(libmix_differences):
     assert_diff(x86_o, "elfmix_disassembly_expected_diff")
     assert_diff(src_c, "elfmix_src_c_expected_diff")
 
-    mach_o_filenames = ["elfmix_mach_o_expected_diff__text"]
+    if llvm_version() < "16":
+        mach_o_filenames = ["elfmix_mach_o_expected_diff__text"]
+    else:
+        mach_o_filenames = ["elfmix_mach_o_expected_diff__text_16"]
+
     for idx, diff in enumerate(mach_o.details):
         assert_diff(diff, mach_o_filenames[idx])
 


=====================================
tests/comparators/test_macho.py
=====================================
@@ -116,14 +116,25 @@ def test_llvm_diff(obj_differences):
     # Sections
     arch_differences = obj_differences[-1].details
     assert len(arch_differences) == 7
-    filenames = [
-        "macho_llvm_expected_diff__text",
-        "macho_llvm_expected_diff__stubs",
-        "macho_llvm_expected_diff__stub_helper",
-        "macho_llvm_expected_diff__cstring",
-        "macho_llvm_expected_diff__unwind_info",
-        "macho_llvm_expected_diff__eh_frame",
-        "macho_llvm_expected_diff__la_symbol_ptr",
-    ]
+    if llvm_version() < "16":
+        filenames = [
+            "macho_llvm_expected_diff__text",
+            "macho_llvm_expected_diff__stubs",
+            "macho_llvm_expected_diff__stub_helper",
+            "macho_llvm_expected_diff__cstring",
+            "macho_llvm_expected_diff__unwind_info",
+            "macho_llvm_expected_diff__eh_frame",
+            "macho_llvm_expected_diff__la_symbol_ptr",
+        ]
+    else:
+        filenames = [
+            "macho_llvm_expected_diff__text_16",
+            "macho_llvm_expected_diff__stubs_16",
+            "macho_llvm_expected_diff__stub_helper_16",
+            "macho_llvm_expected_diff__cstring",
+            "macho_llvm_expected_diff__unwind_info",
+            "macho_llvm_expected_diff__eh_frame",
+            "macho_llvm_expected_diff__la_symbol_ptr",
+        ]
     for idx, diff in enumerate(arch_differences):
         assert_diff(diff, filenames[idx])


=====================================
tests/comparators/test_rlib.py
=====================================
@@ -86,6 +86,9 @@ def rlib_dis_expected_diff():
     if actual_ver >= "15.0":
         diff_file = "rlib_llvm_dis_expected_diff_15"
 
+    if actual_ver >= "16.0":
+        diff_file = "rlib_llvm_dis_expected_diff_16"
+
     return get_data(diff_file)
 
 


=====================================
tests/data/elfmix_mach_o_expected_diff__text_16
=====================================
@@ -0,0 +1,9 @@
+@@ -1,7 +1,7 @@
+ Contents of (__TEXT,__text) section
+ _return42_or_3:
+ 	pushq	%rbp
+ 	movq	%rsp, %rbp
+-	movl	$0x2a, %eax
++	movl	$0x2b, %eax
+ 	popq	%rbp
+ 	retq


=====================================
tests/data/macho_llvm_expected_diff__stub_helper_16
=====================================
@@ -0,0 +1,11 @@
+@@ -1,7 +1,7 @@
+ Contents of (__TEXT,__stub_helper) section
+-	leaq	0xa9(%rip), %r11
++	leaq	0x91(%rip), %r11
+ 	pushq	%r11
+-	jmpq	*0x99(%rip) ## literal pool symbol address: dyld_stub_binder
++	jmpq	*0x81(%rip) ## literal pool symbol address: dyld_stub_binder
+ 	nop
+ 	pushq	$0x0
+-	jmp	0x100000f58
++	jmp	0x100000f70


=====================================
tests/data/macho_llvm_expected_diff__stubs_16
=====================================
@@ -0,0 +1,4 @@
+@@ -1,2 +1,2 @@
+ Contents of (__TEXT,__stubs) section
+-	jmpq	*0xb8(%rip) ## literal pool symbol address: _printf
++	jmpq	*0xa0(%rip) ## literal pool symbol address: _printf


=====================================
tests/data/macho_llvm_expected_diff__text_16
=====================================
@@ -0,0 +1,20 @@
+@@ -1,16 +1,15 @@
+ Contents of (__TEXT,__text) section
+ _main:
+ 	pushq	%rbp
+ 	movq	%rsp, %rbp
+ 	subq	$0x10, %rsp
+-	leaq	0x43(%rip), %rdi ## literal pool for: "%s %s\n"
+-	leaq	0x43(%rip), %rsi ## literal pool for: "17:31:50"
+-	leaq	0x45(%rip), %rdx ## literal pool for: "Wed Dec  2 17:31:49 2015"
++	leaq	0x3b(%rip), %rdi ## literal pool for: "%s\n"
++	leaq	0x38(%rip), %rsi ## literal pool for: "15:52:34"
+ 	movb	$0x0, %al
+-	callq	0x100000f52 ## symbol stub for: _printf
++	callq	0x100000f6a ## symbol stub for: _printf
+ 	xorl	%ecx, %ecx
+ 	movl	%eax, -0x4(%rbp)
+ 	movl	%ecx, %eax
+ 	addq	$0x10, %rsp
+ 	popq	%rbp
+ 	retq


=====================================
tests/data/rlib_llvm_dis_expected_diff_16
=====================================
@@ -0,0 +1,36 @@
+@@ -42,32 +42,32 @@
+ entry-block:
+   %out.i.i = alloca ptr, align 8
+   %4 = icmp ult i64 %3, 17
+   br i1 %4, label %then-block-195-.i, label %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i
+ 
+ then-block-195-.i:                                ; preds = %entry-block
+   %5 = tail call ptr @realloc(ptr %0, i64 %2) #2
+-  br label %_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit
++  br label %_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit
+ 
+ _ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i: ; preds = %entry-block
+   %6 = bitcast ptr %out.i.i to ptr
+   call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
+   store ptr null, ptr %out.i.i, align 8
+   %7 = call i32 @posix_memalign(ptr nonnull %out.i.i, i64 %3, i64 %2) #2
+   %8 = icmp eq i32 %7, 0
+   %9 = load ptr, ptr %out.i.i, align 8
+   %sret_slot.0.i.i = select i1 %8, ptr %9, ptr null
+   call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
+   %10 = icmp ule i64 %2, %1
+   %11 = select i1 %10, i64 %2, i64 %1
+   call void @llvm.memmove.p0.p0.i64(ptr align 1 %sret_slot.0.i.i, ptr align 1 %0, i64 %11, i1 false) #2
+   call void @free(ptr %0) #2
+-  br label %_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit
++  br label %_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit
+ 
+-_ZN12alloc_system3imp10reallocate17h4a0811c9ec086854E.exit: ; preds = %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i, %then-block-195-.i
++_ZN12alloc_system3imp10reallocate1l44a0811c9ec086854E.exit: ; preds = %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i, %then-block-195-.i
+   %sret_slot.0.i = phi ptr [ %5, %then-block-195-.i ], [ %sret_slot.0.i.i, %_ZN12alloc_system3imp8allocate17h8ba7625cc4a820e8E.exit.i ]
+   ret ptr %sret_slot.0.i
+ }
+ 
+ ; Function Attrs: nounwind memory(none) uwtable
+ define i64 @__rust_reallocate_inplace(ptr nocapture readnone %0, i64 %1, i64 %2, i64 %3) unnamed_addr #1 {
+ entry-block:



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/80967c6735a5e386f6e915901b29893b1706a4cd

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/80967c6735a5e386f6e915901b29893b1706a4cd
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20230724/999f2d5d/attachment.htm>


More information about the rb-commits mailing list