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

34 lines
1.0 KiB
ArmAsm

# REQUIRES: x86
# RUN: rm -rf %t && split-file %s %t
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/main.s -o %t/main.o
# RUN: llvm-mc -filetype=obj -triple=x86_64 %t/wrap.s -o %t/wrap.o
# RUN: ld.lld -shared --soname=fixed %t/wrap.o -o %t/wrap.so
## GNU ld does not wrap a defined symbol in an object file
## https://sourceware.org/bugzilla/show_bug.cgi?id=26358
## We choose to wrap defined symbols so that LTO, non-LTO and relocatable links
## behave the same. The 'call bar' in main.o will reference __wrap_bar. We cannot
## easily distinguish the case from cases where bar is not referenced, so we
## export __wrap_bar whenever bar is defined, regardless of whether it is indeed
## referenced.
# RUN: ld.lld -shared %t/main.o --wrap bar -o %t1.so
# RUN: llvm-objdump -d %t1.so | FileCheck %s
# RUN: ld.lld %t/main.o %t/wrap.so --wrap bar -o %t1
# RUN: llvm-objdump -d %t1 | FileCheck %s
# CHECK: <_start>:
# CHECK-NEXT: callq {{.*}} <__wrap_bar@plt>
#--- main.s
.globl _start, bar
_start:
call bar
bar:
#--- wrap.s
.globl __wrap_bar
__wrap_bar:
retq