Files
RedBear-OS/local/recipes/dev/libclc/source/lld/test/MachO/objc-classrefs-dedup.s
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

50 lines
1.4 KiB
ArmAsm

# REQUIRES: x86
# RUN: rm -rf %t; split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/defs.s -o %t/defs.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/refs1.s -o %t/refs1.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/refs2.s -o %t/refs2.o
# RUN: %lld -lSystem -dylib %t/defs.o -o %t/libdefs.dylib
# RUN: %lld -lSystem -dylib --icf=all %t/refs1.o %t/refs2.o %t/libdefs.dylib -o %t/out
# RUN: llvm-otool -o %t/out | FileCheck %s
## Check that we only have 3 (unique) entries, of which two are bound at runtime
## (i.e. they are entries that have a static value of 0x0).
# CHECK: Contents of (__DATA,__objc_classrefs) section
# CHECK-NEXT: 0000000000001008 0x0 _OBJC_CLASS_$_Foo
# CHECK-NEXT: 0000000000001010 0x0 _OBJC_CLASS_$_Bar
# CHECK-NEXT: 0000000000001018 0x1000 _OBJC_CLASS_$_Baz
# CHECK-EMPTY:
#--- defs.s
.globl _OBJC_CLASS_$_Foo, _OBJC_CLASS_$_Bar
.section __DATA,__objc_data
_OBJC_CLASS_$_Foo:
.quad 123
_OBJC_CLASS_$_Bar:
.quad 456
.subsections_via_symbols
#--- refs1.s
.globl _OBJC_CLASS_$_Baz
.section __DATA,__objc_data
_OBJC_CLASS_$_Baz:
.quad 789
.section __DATA,__objc_classrefs
.quad _OBJC_CLASS_$_Foo
.quad _OBJC_CLASS_$_Bar
.quad _OBJC_CLASS_$_Baz
.quad _OBJC_CLASS_$_Baz
.subsections_via_symbols
#--- refs2.s
.section __DATA,__objc_classrefs
.quad _OBJC_CLASS_$_Foo
.quad _OBJC_CLASS_$_Bar
.subsections_via_symbols