Files
RedBear-OS/local/recipes/dev/libclc/source/llvm/test/Linker/comdat-largest.ll
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

58 lines
1.5 KiB
LLVM

; RUN: rm -rf %t && split-file %s %t
; RUN: llvm-link %t/1.ll -S -o - | FileCheck %s --check-prefix=CHECK1
;; The source doesn't have comdat.
; RUN: llvm-link %t/2.ll -S -o - | FileCheck %s --check-prefix=CHECK2
;; The leader is an alias.
; RUN: llvm-link %t/3.ll %t/3-aux.ll -S -o - | FileCheck %s
; RUN: llvm-link %t/3-aux.ll %t/3.ll -S -o - | FileCheck %s
;--- 1.ll
$c = comdat any
@a = alias void (), ptr @f
define internal void @f() comdat($c) {
ret void
}
; CHECK1-DAG: $c = comdat any
; CHECK1-DAG: @a = alias void (), ptr @f
; CHECK1-DAG: define internal void @f() comdat($c)
$f2 = comdat largest
define linkonce_odr void @f2() comdat($f2) {
ret void
}
define void @f3() comdat($f2) {
ret void
}
; CHECK1-DAG: $f2 = comdat largest
; CHECK1-DAG: define linkonce_odr void @f2()
;--- 2.ll
$c = comdat largest
; CHECK2: @c = global i32 0, comdat
@c = global i32 0, comdat
;--- 3.ll
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
$foo = comdat largest
@foo = linkonce_odr unnamed_addr constant [1 x ptr] [ptr @bar], comdat($foo)
; CHECK: @foo = alias ptr, getelementptr ([2 x ptr], ptr @some_name, i32 0, i32 1)
declare void @bar() unnamed_addr
;--- 3-aux.ll
target datalayout = "e-m:w-p:32:32-i64:64-f80:32-n8:16:32-S32"
$foo = comdat largest
@zed = external constant i8
@some_name = private unnamed_addr constant [2 x ptr] [ptr @zed, ptr @bar], comdat($foo)
@foo = alias ptr, getelementptr([2 x ptr], ptr @some_name, i32 0, i32 1)
declare void @bar() unnamed_addr