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).
108 lines
6.7 KiB
ArmAsm
108 lines
6.7 KiB
ArmAsm
# REQUIRES: x86
|
|
|
|
# Tests handling of the comdat selection type.
|
|
# (Except associative which is tested in associative-comdat.s and
|
|
# comdat-selection-associate-largest.s instead.)
|
|
|
|
# Create obj files with each selection type.
|
|
# RUN: sed -e s/SEL/discard/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.discard.obj
|
|
# RUN: sed -e s/SEL/discard/ -e s/.long/.short/ -e s/1/2/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.discard.short.2.obj
|
|
# RUN: sed -e s/SEL/one_only/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.one_only.obj
|
|
# RUN: sed -e s/SEL/same_size/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.same_size.obj
|
|
# RUN: sed -e s/SEL/same_size/ -e s/.long/.short/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.same_size.short.obj
|
|
# RUN: sed -e s/SEL/same_contents/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.same_contents.obj
|
|
# RUN: sed -e s/SEL/same_contents/ -e s/.long/.short/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.same_contents.short.obj
|
|
# RUN: sed -e s/SEL/same_contents/ -e s/1/2/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.same_contents.2.obj
|
|
# RUN: sed -e s/SEL/largest/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.largest.obj
|
|
# RUN: sed -e s/SEL/largest/ -e s/.long/.short/ -e s/1/2/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.largest.short.2.obj
|
|
# RUN: sed -e s/SEL/newest/ %s | llvm-mc -triple x86_64-pc-win32 -filetype=obj -o %t.newest.obj
|
|
|
|
.section .text$nm, "", SEL, symbol
|
|
.globl symbol
|
|
symbol:
|
|
.long 1
|
|
|
|
# First, pass each selection type twice. All should link fine except for
|
|
# one_only which should report a duplicate symbol error and newest which
|
|
# link.exe (and hence lld-link) doesn't understand.
|
|
|
|
# RUN: cp %t.discard.obj %t.obj && lld-link /dll /noentry /nodefaultlib %t.discard.obj %t.obj
|
|
# RUN: cp %t.one_only.obj %t.obj && not lld-link /dll /noentry /nodefaultlib %t.one_only.obj %t.obj 2>&1 | FileCheck --check-prefix=ONEONE %s
|
|
# ONEONE: lld-link: error: duplicate symbol: symbol
|
|
# RUN: cp %t.same_size.obj %t.obj && lld-link /dll /noentry /nodefaultlib %t.same_size.obj %t.obj
|
|
# RUN: cp %t.same_contents.obj %t.obj && lld-link /dll /noentry /nodefaultlib %t.same_contents.obj %t.obj
|
|
# RUN: cp %t.largest.obj %t.obj && lld-link /dll /noentry /nodefaultlib %t.largest.obj %t.obj
|
|
# RUN: cp %t.newest.obj %t.obj && env LLD_IN_TEST=1 not lld-link /dll /noentry /nodefaultlib %t.newest.obj %t.obj 2>&1 | FileCheck --check-prefix=NEWNEW %s
|
|
# NEWNEW: lld-link: error: unknown comdat type 7 for symbol
|
|
|
|
# /force doesn't affect errors about unknown comdat types.
|
|
# RUN: cp %t.newest.obj %t.obj && env LLD_IN_TEST=1 not lld-link /force /dll /noentry /nodefaultlib %t.newest.obj %t.obj 2>&1 | FileCheck --check-prefix=NEWNEWFORCE %s
|
|
# NEWNEWFORCE: lld-link: error: unknown comdat type 7 for symbol
|
|
|
|
# Check that same_size, same_contents, largest do what they're supposed to.
|
|
|
|
# Check that the "same_size" selection produces an error if passed two symbols
|
|
# with different size.
|
|
# RUN: not lld-link /dll /noentry /nodefaultlib %t.same_size.obj %t.same_size.short.obj 2>&1 | FileCheck --check-prefix=SAMESIZEDUPE %s
|
|
# SAMESIZEDUPE: lld-link: error: duplicate symbol: symbol
|
|
|
|
# Check that the "same_contents" selection produces an error if passed two
|
|
# symbols with different contents.
|
|
# RUN: not lld-link /dll /noentry /nodefaultlib %t.same_contents.obj %t.same_contents.2.obj 2>&1 | FileCheck --check-prefix=SAMECONTENTSDUPE1 %s
|
|
# SAMECONTENTSDUPE1: lld-link: error: duplicate symbol: symbol
|
|
# RUN: not lld-link /dll /noentry /nodefaultlib %t.same_contents.obj %t.same_contents.2.obj 2>&1 | FileCheck --check-prefix=SAMECONTENTSDUPE2 %s
|
|
# SAMECONTENTSDUPE2: lld-link: error: duplicate symbol: symbol
|
|
|
|
# Check that the "largest" selection picks the larger comdat (independent of
|
|
# the order the .obj files are passed on the commandline).
|
|
# RUN: lld-link /opt:noref /include:symbol /dll /noentry /nodefaultlib %t.largest.obj %t.largest.short.2.obj /out:%t.exe
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=LARGEST1 %s
|
|
# LARGEST1: Contents of section .text:
|
|
# LARGEST1: 180001000 01000000 ....
|
|
|
|
# FIXME: Make this pass when /opt:noref is passed.
|
|
# RUN: lld-link /include:symbol /dll /noentry /nodefaultlib %t.largest.short.2.obj %t.largest.obj /out:%t.exe
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=LARGEST2 %s
|
|
# LARGEST2: Contents of section .text:
|
|
# LARGEST2: 180001000 01000000 ....
|
|
|
|
|
|
# Test linking the same symbol with different comdat selection types.
|
|
# link.exe generally rejects this, except for "largest" which is allowed to
|
|
# combine with everything (https://bugs.llvm.org/show_bug.cgi?id=40094#c7).
|
|
# lld-link rejects all comdat selection type mismatches. Spot-test just a few
|
|
# combinations.
|
|
|
|
# RUN: not lld-link /verbose /dll /noentry /nodefaultlib %t.discard.obj %t.one_only.obj 2>&1 | FileCheck --check-prefix=DISCARDONE %s
|
|
# DISCARDONE: lld-link: conflicting comdat type for symbol: 2 in
|
|
# DISCARDONE: lld-link: error: duplicate symbol: symbol
|
|
# RUN: lld-link /verbose /force /dll /noentry /nodefaultlib %t.discard.obj %t.one_only.obj 2>&1 | FileCheck --check-prefix=DISCARDONEFORCE %s
|
|
# DISCARDONEFORCE: lld-link: conflicting comdat type for symbol: 2 in
|
|
# DISCARDONEFORCE: lld-link: warning: duplicate symbol: symbol
|
|
|
|
# Make sure the error isn't depending on the order of .obj files.
|
|
# RUN: not lld-link /verbose /dll /noentry /nodefaultlib %t.one_only.obj %t.discard.obj 2>&1 | FileCheck --check-prefix=ONEDISCARD %s
|
|
# ONEDISCARD: lld-link: conflicting comdat type for symbol: 1 in
|
|
# ONEDISCARD: lld-link: error: duplicate symbol: symbol
|
|
|
|
# RUN: not lld-link /verbose /dll /noentry /nodefaultlib %t.same_contents.obj %t.same_size.obj 2>&1 | FileCheck --check-prefix=CONTENTSSIZE %s
|
|
# CONTENTSSIZE: lld-link: conflicting comdat type for symbol: 4 in
|
|
# CONTENTSSIZE: lld-link: error: duplicate symbol: symbol
|
|
|
|
# Check that linking one 'discard' and one 'largest' has the effect of
|
|
# 'largest'.
|
|
# RUN: lld-link /dll /noentry /nodefaultlib %t.discard.short.2.obj %t.largest.obj
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=DISCARDLARGEST %s
|
|
# DISCARDLARGEST: Contents of section .text:
|
|
# DISCARDLARGEST: 180001000 01000000 ....
|
|
# RUN: lld-link /dll /noentry /nodefaultlib %t.largest.obj %t.discard.short.2.obj
|
|
# RUN: llvm-objdump -s %t.exe | FileCheck --check-prefix=LARGESTDISCARD %s
|
|
# LARGESTDISCARD: Contents of section .text:
|
|
# LARGESTDISCARD: 180001000 01000000 ....
|
|
|
|
|
|
# These cases are accepted by link.exe but not by lld-link.
|
|
# RUN: not lld-link /verbose /dll /noentry /nodefaultlib %t.largest.obj %t.one_only.obj 2>&1 | FileCheck --check-prefix=LARGESTONE %s
|
|
# LARGESTONE: lld-link: conflicting comdat type for symbol: 6 in
|
|
# LARGESTONE: lld-link: error: duplicate symbol: symbol
|