Files
RedBear-OS/local/recipes/dev/libclc/source/lld/test/ELF/shared-lazy.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

70 lines
2.4 KiB
ArmAsm

# REQUIRES: x86
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o && ld.lld a.o -shared -o a.so
# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o && ld.lld b.o -shared -o b.so
# RUN: llvm-ar rc a.a a.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref.s -o ref.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref2.s -o ref2.o
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux weakref2.s -o weakref2.o
# RUN: ld.lld a.a b.so ref.o -shared -o 1.so
# RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
# RUN: ld.lld a.so a.a ref.o -shared -o 1.so
# RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
## The definitions from a.so are used and we don't extract a member from the
## archive.
# CHECK: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x1
# CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
## The extracted x1 is defined as STB_GLOBAL.
# RUN: ld.lld ref.o a.a b.so -o 2.so -shared
# RUN: llvm-readelf --dyn-symbols 2.so | FileCheck %s --check-prefix=CHECK2
# RUN: ld.lld a.a ref.o b.so -o 2.so -shared
# RUN: llvm-readelf --dyn-symbols 2.so | FileCheck %s --check-prefix=CHECK2
# CHECK2: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] x1
# CHECK2-NEXT: {{.*}} 0 NOTYPE WEAK DEFAULT [[#]] x2
## The extracted x2 is defined as STB_WEAK. x1 is not referenced by any relocatable object file.
# RUN: ld.lld a.a ref2.o b.so -o 2.so -shared
# RUN: llvm-readelf --dyn-syms 2.so | FileCheck %s --check-prefix=CHECK2
# RUN: ld.lld a.a a.so ref2.o -o 3.so -shared
# RUN: llvm-readelf --dyn-syms 3.so | FileCheck %s --check-prefix=CHECK3
# RUN: ld.lld a.so a.a ref2.o -o 3.so -shared
# RUN: llvm-readelf --dyn-syms 3.so | FileCheck %s --check-prefix=CHECK3
# CHECK3: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
# CHECK3-EMPTY:
# RUN: ld.lld a.a weakref2.o a.so -o 4.so -shared
# RUN: llvm-readelf --dyn-syms 4.so | FileCheck %s --check-prefix=CHECK4
# CHECK4: 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND x2
# CHECK4-EMPTY:
# RUN: ld.lld a.a --as-needed a.so -o noneeded.so -shared
# RUN: llvm-readelf -d noneeded.so | FileCheck %s --check-prefix=NONEEDED
# NONEEDED-NOT: NEEDED
#--- a.s
.global x1
x1:
.weak x2
x2:
#--- b.s
.globl x1, x2
x1:
x2:
.byte 0
.size x1, .-x1
.size x2, .-x2
#--- ref.s
.globl x1
.globl x2
#--- ref2.s
.globl x2
#--- weakref2.s
.weak x2