cb424d7448
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).
58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
RUN: lld-link -lldmingw %S/Inputs/gnu-weak.o %S/Inputs/gnu-weak2.o -out:%t.exe
|
|
RUN: lld-link -lld-allow-duplicate-weak %S/Inputs/gnu-weak.o %S/Inputs/gnu-weak2.o -out:%t.exe
|
|
RUN: not lld-link %S/Inputs/gnu-weak.o %S/Inputs/gnu-weak2.o -out:%t.exe 2>&1 | FileCheck %s --check-prefix=DEFAULT-ERROR
|
|
|
|
DEFAULT-ERROR: error: duplicate symbol: weakfunc
|
|
|
|
|
|
GNU ld can handle several definitions of the same weak symbol, and
|
|
unless there is a strong definition of it, it just picks the first
|
|
weak definition encountered.
|
|
|
|
For each of the weak definitions, GNU tools produce a regular symbol
|
|
named .weak.<weaksymbol>.<othersymbol>, where the other symbol name is
|
|
another symbol defined close by.
|
|
|
|
This can't be reproduced by assembling with llvm-mc, as llvm-mc always
|
|
produces similar regular symbols named .weak.<weaksymbol>.default.
|
|
|
|
The bundled object files can be produced from test code that looks like
|
|
this:
|
|
|
|
$ cat gnu-weak.c
|
|
void weakfunc(void) __attribute__((weak));
|
|
void otherfunc(void);
|
|
|
|
__attribute__((weak)) void weakfunc() {
|
|
}
|
|
|
|
int main(int argc, char* argv[]) {
|
|
otherfunc();
|
|
weakfunc();
|
|
return 0;
|
|
}
|
|
void mainCRTStartup(void) {
|
|
main(0, (char**)0);
|
|
}
|
|
void __main(void) {
|
|
}
|
|
|
|
$ cat gnu-weak2.c
|
|
void weakfunc(void) __attribute__((weak));
|
|
|
|
__attribute__((weak)) void weakfunc() {
|
|
}
|
|
|
|
void otherfunc(void) {
|
|
}
|
|
|
|
$ x86_64-w64-mingw32-gcc -c -O2 gnu-weak.c
|
|
$ x86_64-w64-mingw32-gcc -c -O2 gnu-weak2.c
|
|
|
|
$ x86_64-w64-mingw32-nm gnu-weak.o | grep weakfunc
|
|
0000000000000000 T .weak.weakfunc.main
|
|
w weakfunc
|
|
$ x86_64-w64-mingw32-nm gnu-weak2.o | grep weakfunc
|
|
0000000000000000 T .weak.weakfunc.otherfunc
|
|
w weakfunc
|