Compare commits

...

25 commits

Author SHA1 Message Date
9efe0f6180 Remove old sync-upstream.yml, superseded by Cold-Air-Networks/mirror-sync 2026-08-01 19:39:30 -08:00
23004a1d7d ci: add manual sync-from-upstream workflow 2026-08-01 19:09:38 -08:00
Arun Thangamani
b32d4f0c45
[mlir][x86] Decouple Accumulator from ADD-Based Vector Contractions (over loops) (#204327)
This path transforms `vector.contract(A, B, Acc)` into
`vector.contract(A, B, 0) + Acc` to decouple the contraction computation
from the accumulator update for contractions over the loop.
2026-08-02 07:33:00 +05:30
Fangrui Song
676d48fb49
[ELF,SPARC] Handle GOTDATA relocations (#213497)
A PIC data reference forms the symbol's GOT offset with
R_SPARC_GOTDATA_OP_HIX22 and R_SPARC_GOTDATA_OP_LOX10 and loads through
it, with R_SPARC_GOTDATA_OP marking the load:

```
sethi %gdop_hix22(sym), %g1
xor   %g1, %gdop_lox10(sym), %g1
ldx   [%l7 + %g1], %g1, %gdop(sym)
```

When the symbol is neither preemptible nor absolute, optimize the load
to `add %l7, %g1, %g1` over the symbol's GOT-relative address. An
absolute symbol keeps the GOT load, as it can be arbitrarily far from
.got and we don't want the X86_64::relaxOpt complexity.

Co-authored-by: Kirill A. Korinsky <kirill@korins.ky>
Co-authored-by: LemonBoy <thatlemon@gmail.com>
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2026-08-01 18:17:35 -07:00
Marc Auberer
303e63dbd8
[JITLink] Remove LTmp workaround now that LLVM requires C++17 (#213428)
C++17 guarantees the postfix-expression naming the called function is
sequenced before evaluation of its arguments, so
L->linkPhase1(std::move(L)) is well-formed without the LTmp indirection.
This should also be implemented by MSVC now. See here (P0145R3 and
P0400R0):

https://learn.microsoft.com/ar-sa/cpp/overview/visual-cpp-language-conformance?view=msvc-170
Disclaimer: As I have no LLVM Windows machine with MSVC at hand, I was
not able to test it myself.

Co-authored-by: Claude <noreply@anthropic.com>
2026-08-02 10:32:48 +10:00
Med Ismail Bennani
1ac9b999f8
[lldb] Reimplement PythonCallable::GetArgInfo without executing Python code (#213378)
`b05a5d0a` added an arity-trimming step to the shared
`ScriptedPythonInterface::Dispatch`: extensions are now allowed to
define methods with trailing parameters as optional
(`num_children(self)` vs. `num_children(self, max_count)`), so before
calling into a method, `Dispatch` needs to know how many positional
arguments it actually accepts and drop any trailing ones we'd otherwise
pass.

That check calls `PythonCallable::GetArgInfo`, which ran a whole
embedded Python script through `inspect.signature` on every call, since
every scripted-extension dispatch goes through it.

For the common case `GetArgInfo()` actually needs to handle fast (plain
Python functions/methods, classes used as constructors, and callable
instances defining `__call__`, i.e. everything `Dispatch<T>()` and
`CreatePluginObject()` ever pass it), the answer is available as plain
data attributes, with no Python bytecode execution required:
`__func__`/`__self__` to unwrap bound methods, and `__code__`'s
`co_argcount`/`co_flags` for the actual positional-argument count and
varargs bit. For a class, that means `__init__` -- except a class may
customize `__new__` instead and leave `__init__` untouched, in which
case `object.__init__` becomes lenient about extra arguments.

Anything else still lacking `__code__` can fall back to the original
`inspect.signature()`-based implementation, now exposed as
`PythonCallable::GetArgInfoFromInspectSignature()` so it can be used
separately.

rdar://183776556

---------

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-08-01 16:23:21 -07:00
Vitaly Buka
11038cc161
Revert "[llvm][AArch64] Add pipeliner remarks" (#213485)
Reverts llvm/llvm-project#213157

Reverting to fix build bots.
2026-08-01 21:01:42 +00:00
forking-google-bazel-bot[bot]
dbe7da3642
[Bazel] Fixes 350089d (#213482)
This fixes 350089d0cb (#213456).

Buildkite error link:
https://buildkite.com/llvm-project/upstream-bazel/builds?commit=350089d0cb1652e6ff44888f46d6487db5e696e6

Co-authored-by: Google Bazel Bot <google-bazel-bot@google.com>
2026-08-01 13:24:17 -07:00
Maksim Levental
e3bde09850
[mlir-c] Add structural operation equivalence (#206537)
Exposes `OperationEquivalence` through the MLIR C API so callers can compare operations structurally rather than by handle identity.

Assisted by: Claude
2026-08-01 12:59:13 -07:00
Peter Rong
84afdb4771
[lld][MachO] Avoid quadratic iteration over already-folded symbols during ICF (#213339)
`ConcatInputSection::foldIdentical()` clears the folded functions
`originalUnwindEntry`.
However, it cleared every symbol: with N members, the repeated clearing
is **O(N²)**.
This is redundant: we should only remove the incoming `copy->symbols`.

This patch moves the removing loop ahead and adds more clear comments on
why we need to skip the first element.
Also added a new `lld/test/MachO/icf-scale-same-class.s` with 500K
identical functions as a stress test, which would've taken minutes to
link, and less than a second with the patch.

Testing on real-world app (IRPGO instrumentation + ICF) find that we
achieved a 19x speed up (1:14:42 -> 3:55)
2026-08-01 12:44:24 -07:00
Ramkumar Ramachandra
278261413b
[InstSimplify] Defer to ConstantFold in simplifyInstrinsic (#205061)
Defer to ConstantFolding on all-constant operands, in
llvm::simplifyIntrinsic. The patch adds a context-function argument to
ConstantFoldIntrinsic for strictfp information, which is used by a new
canConstantFoldIntrinsic under canConstantFoldCallTo: it was
necessitated by exposing the constant-folder via
llvm::simplifyIntrinsic. The patch only has impact on passes that use
simplifyIntrinsic via InstSimplifyFolder, other than InstCombine, which
already constant-folds intrinsics.
2026-08-01 19:24:50 +00:00
Florian Hahn
8cb8e872e7
[llubi] Truncate struct field offsets exceeding the pointer index width (#213471)
Update computeGEP to implicitly truncate struct field offsets. This
fixes crashes in the new test, where the field offset does not fit in
the index width.

Related https://github.com/llvm/llvm-project/pull/213436

PR: https://github.com/llvm/llvm-project/pull/213471
2026-08-01 19:10:45 +00:00
Nico Weber
4671437fb0
[libc] Add missing LIBC_INLINE to functions defined in .h files (#213442) 2026-08-01 14:48:45 -04:00
Nico Weber
350089d0cb
[libc] Fix LLVM_LIBC_FUNCTION on 32-bit x86 Windows (#213456)
Previously, trying to compile libm with LIBC_COPT_PUBLIC_PACKAGING
defined failed on 32-bit Windows with

    error: alias must point to a defined variable or function

This is because 32-bit Windows adds a leading underscore to __cdecl C
functions, making the alias declaration not find its target symbol name.
The same problem exists on Apple platforms, which as solution don't emit
the alias for the C++ LIBC_NAMESPACE:: symbol.

Do the same on 32-bit Windows as on Apple platforms: Emit only
the underscore-prefixed symbol, not the LIBC_NAMESPACE:: alias.
2026-08-01 14:48:20 -04:00
Jianhui Li
007c684208
[mlir][xegpu] Add xegpu.lane_shuffle op (#210777)
Add a lane-level XeGPU operation that re-distributes a subgroup's
fragments across its lanes without changing the element type.

The op takes a 1D vector — the fragment held by one lane — and returns a
fragment of the same type. A pack/unpack mode selects the direction:
viewing the subgroup as an S x N element grid (S = subgroup size, N =
elements per lane), pack moves element j of lane i from logical position
j*S + i to i*N + j, so a lane's elements end up at consecutive
positions; unpack is the reverse.
  
This implements xegpu.convert_layout semantics at the lane level when
lane_layout is unchanged but lane_data differs.
  
assisted-by-claude

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-01 11:40:14 -07:00
Florian Hahn
6545f29f64
[IR] Truncate struct field offsets exceeding the pointer index width. (#213436)
Update accumulateConstantOffset and collectOffset to implicitly truncate
struct field offsets. This fixes crashes in the new tests, where the
field offset does not fit in the index width.

PR: https://github.com/llvm/llvm-project/pull/213436
2026-08-01 20:09:01 +02:00
Fangrui Song
bd9aa3ca57
[ELF] Retain .rela.dyn for PPC64 PI long-branch thunks (#212078)
PPC64PILongBranchThunk adds a relative relocation, which runs after
removeUnusedSyntheticSections. With no other dynamic relocation
.rela.dyn is incorrectly removed.

Extract the .rela.auth.dyn condition (#96496, #195649) to `mayGrowLate`
and add a .branch_lt check.
2026-08-01 17:55:34 +00:00
Charles Zablit
6dfd733723
[lldb][Windows] Improve error messages in PlatformWindows.cpp (#213011)
The reason for the failure is known but is not in the log. Add a helper
function to map the error to a string and log it.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2026-08-01 18:03:40 +02:00
Charles Zablit
67a20745d6
[lldb] Introduce the require decorator (#212753)
Currently, it is unclear if a test that is skipped is either:
- Unsupported because it will never run (macosx tests should not run on
Windows).
- Skipped because it's supposed to work but does not yet.
`@expectedFailure` is not always an option because a test might be
timing out and waiting 600s for it to fail is not acceptable.

This patch introduces 2 new decorators to differentiate those tests:
- `@requireX` meaning the tests require X to run (e.g `@requireDarwin`).
- `@requireNotX` meaning the tests requires anything but `X` to run (e.g
`@requireNotDarwin`).

In the tests results summary, this introduces a new category: `skipped`
tests:
- `@requireX` -> `UNSUPPORTED`
- `@skipIfX` -> `SKIPPED`

Here is how they can and cannot be stacked:

This will never run:
```py3
@requireDarwin
@requireWindows
def test():
    ...
```

This will not run on Linux, because `@requireWindows` is not satisfied.
```py3
@requireNotDarwin
@requireWindows
def test():
    ...
```

For "require Darwin or Windows", you need:
```py3
@requirePlatform(["darwin", "windows"])
def test():
    ...
```

For "require Darwin on ARM64 or Windows on ARM64", you need:
```py3
@requireARM64
@requirePlatform(["darwin", "windows"])
def test():
    ...
```

This patch also converts the tests in
`lldb/tests/API/{macosx,linux,windows}` to use these decorators. Patches
to convert the rest of the tests will follow.
2026-08-01 18:03:29 +02:00
Nico Weber
bd427e721e
[gn] add ClangIncludeCleanerTests (#213073) 2026-08-01 11:43:52 -04:00
Nico Weber
308cb96d70
[gn build] Port b94b699857 (#213458) 2026-08-01 11:43:32 -04:00
David Green
eeb1e687b2
[AArch64][GlobalISel] Update a number of select tests to concrete types. NFC (#213454) 2026-08-01 16:03:53 +01:00
Florian Hahn
78909083d7
[ConstraintElim] Remove const op restriction from tightenBoundUsingNe. (#213440)
Remove the constant operand restriction for the bounds tightening logic
added in https://github.com/llvm/llvm-project/pull/213049.

The condition is not needed for correctness, and there are a number of
cases in practice where results can be improved:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/839


Compile-time impact in the noise

https://llvm-compile-time-tracker.com/compare.php?from=60f965b1f62c0c77bcdb2997ea9bb6603aa0d002&to=1f7190605cc3a13cd992eaad3053b599cd5e4ed0&stat=instructions:u

PR: https://github.com/llvm/llvm-project/pull/213440
2026-08-01 17:01:45 +02:00
Vachan
efe31d6dfe
[InstSimplify] Fold zext(X) | sext(X) --> sext(X) and zext(X) & sext(X) --> zext(X) (#213313)
fix #213247

alive2: https://alive2.llvm.org/ce/z/G6se2o
godbolt: https://godbolt.org/z/M3nz5Tvcn
2026-08-01 14:46:08 +00:00
Zorojuro
36b6f48f88
[libc] Add conversion tests between emulated and native f128 (#213422)
Adds conversion tests between emulated and native float128 type, which
would be later used in f128 functions .
2026-08-01 19:36:57 +05:30
185 changed files with 2861 additions and 1403 deletions

View file

@ -17,6 +17,12 @@
#include "src/__support/macros/config.h"
#include "src/__support/macros/properties/architectures.h"
#include "src/__support/macros/properties/compiler.h"
#include "src/__support/macros/properties/os.h"
#if defined(__APPLE__) || (defined(LIBC_TARGET_OS_IS_WINDOWS) && \
defined(LIBC_TARGET_ARCH_IS_X86_32))
#define LIBC_TARGET_USES_LEADING_UNDERSCORE
#endif
#ifndef LLVM_LIBC_FUNCTION_ATTR
#define LLVM_LIBC_FUNCTION_ATTR
@ -44,25 +50,24 @@
#define LLVM_LIBC_ATTR(name) EXPAND_THEN_SECOND(LLVM_LIBC_FUNCTION_ATTR_##name)
// At the moment, [[gnu::alias()]] is not supported on MacOS, and it is needed
// to cleanly export and alias the C++ symbol `LIBC_NAMESPACE::func` with the C
// symbol `func`. So for public packaging on MacOS, we will only export the C
// symbol. Moreover, a C symbol `func` in macOS is mangled as `_func`.
// Export both `func` and `LIBC_NAMESPACE::func` using an alias symbol.
// This does not work on platfors with LIBC_TARGET_USES_LEADING_UNDERSCORE
// so there this only exports `_func`.
#if defined(LIBC_COPT_PUBLIC_PACKAGING) && !defined(LIBC_COMPILER_IS_MSVC)
#ifndef __APPLE__
#ifndef LIBC_TARGET_USES_LEADING_UNDERSCORE
#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
LLVM_LIBC_ATTR(name) \
LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) \
__##name##_impl__ asm(c_alias); \
decltype(LIBC_NAMESPACE::name) name [[gnu::alias(c_alias)]]; \
type __##name##_impl__ arglist
#else // __APPLE__
#else // LIBC_TARGET_USES_LEADING_UNDERSCORE
#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
LLVM_LIBC_ATTR(name) \
LLVM_LIBC_FUNCTION_ATTR decltype(LIBC_NAMESPACE::name) name asm( \
"_" c_alias); \
type name arglist
#endif // __APPLE__
#endif // LIBC_TARGET_USES_LEADING_UNDERSCORE
#else // LIBC_COPT_PUBLIC_PACKAGING
#define LLVM_LIBC_FUNCTION_IMPL_4(type, name, arglist, c_alias) \
@ -78,25 +83,23 @@
GET_FIFTH(__VA_ARGS__, LLVM_LIBC_FUNCTION_IMPL_4, LLVM_LIBC_FUNCTION_IMPL_3, \
GET_NOTHING)(__VA_ARGS__)
// At the moment, [[gnu::alias()]] is not supported on MacOS, and it is needed
// to cleanly export and alias the C++ symbol `LIBC_NAMESPACE::func` with the C
// symbol `func`. So for public packaging on MacOS, we will only export the C
// symbol. Moreover, a C symbol `func` in macOS is mangled as `_func`.
// See comment on LLVM_LIBC_FUNCTION_IMPL_4 for why this checks
// LIBC_TARGET_USES_LEADING_UNDERSCORE.
#if defined(LIBC_COPT_PUBLIC_PACKAGING) && !defined(LIBC_COMPILER_IS_MSVC)
#ifndef __APPLE__
#ifndef LIBC_TARGET_USES_LEADING_UNDERSCORE
#define LLVM_LIBC_VARIABLE_IMPL(type, name) \
LLVM_LIBC_ATTR(name) \
extern LLVM_LIBC_VARIABLE_ATTR decltype(LIBC_NAMESPACE::name) \
__##name##_impl__ asm(#name); \
extern decltype(LIBC_NAMESPACE::name) name [[gnu::alias(#name)]]; \
type __##name##_impl__
#else // __APPLE__
#else // LIBC_TARGET_USES_LEADING_UNDERSCORE
#define LLVM_LIBC_VARIABLE_IMPL(type, name) \
LLVM_LIBC_ATTR(name) \
extern LLVM_LIBC_VARIABLE_ATTR decltype(LIBC_NAMESPACE::name) name asm( \
"_" #name); \
type name
#endif // __APPLE__
#endif // LIBC_TARGET_USES_LEADING_UNDERSCORE
#else // LIBC_COPT_PUBLIC_PACKAGING
#define LLVM_LIBC_VARIABLE_IMPL(type, name) type name
#endif // LIBC_COPT_PUBLIC_PACKAGING

View file

@ -126,13 +126,13 @@ LIBC_INLINE DoubleDouble poly_approx_dd(const DoubleDouble &dx) {
}
#ifdef DEBUGDEBUG
std::ostream &operator<<(std::ostream &OS, const DFloat128 &r) {
LIBC_INLINE std::ostream &operator<<(std::ostream &OS, const DFloat128 &r) {
OS << (r.sign == Sign::NEG ? "-(" : "(") << r.mantissa.val[0] << " + "
<< r.mantissa.val[1] << " * 2^64) * 2^" << r.exponent << "\n";
return OS;
}
std::ostream &operator<<(std::ostream &OS, const DoubleDouble &r) {
LIBC_INLINE std::ostream &operator<<(std::ostream &OS, const DoubleDouble &r) {
OS << std::hexfloat << "(" << r.hi << " + " << r.lo << ")"
<< std::defaultfloat << "\n";
return OS;

View file

@ -108,8 +108,9 @@ LIBC_INLINE double tan_eval(const DoubleDouble &u, DoubleDouble &result) {
// Calculation a / b = a * (1/b) for DFloat128.
// Using the initial approximation of q ~ (1/b), then apply 2 Newton-Raphson
// iterations, before multiplying by a.
[[maybe_unused]] DFloat128 newton_raphson_div(const DFloat128 &a, DFloat128 b,
double q) {
[[maybe_unused]] LIBC_INLINE DFloat128 newton_raphson_div(const DFloat128 &a,
DFloat128 b,
double q) {
DFloat128 q0(q);
LIBC_BIT_CAST_CONSTEXPR_VAR DFloat128 TWO(2.0);
b.sign = (b.sign == Sign::POS) ? Sign::NEG : Sign::POS;

View file

@ -49,6 +49,7 @@ add_fp_unittest(
libc.hdr.limits_macros
libc.src.__support.FPUtil.fenv_impl
libc.src.__support.FPUtil.float128
libc.src.__support.macros.properties.types
)
# TODO: Temporally disable bfloat16 test until MPCommon target is updated

View file

@ -9,6 +9,7 @@
#include "hdr/limits_macros.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/float128.h"
#include "src/__support/macros/properties/types.h"
#include "test/UnitTest/FPMatcher.h"
#include "test/UnitTest/Test.h"
@ -142,3 +143,25 @@ TEST(LlvmLibcFloat128Test, FromIntegralTypes) {
ASSERT_EQ(static_cast<unsigned>(Float128(2147483648.0)), 2147483648U);
EXPECT_EQ(LIBC_NAMESPACE::fputil::test_except(FE_INVALID), 0);
}
#ifdef LIBC_TYPES_HAS_FLOAT128
TEST(LlvmLibcFloat128Test, NativeFloat128Conversion) {
// native to emulated float128
ASSERT_TRUE(Float128(static_cast<float128>(0.0)) == Float128(0.0));
ASSERT_TRUE(Float128(static_cast<float128>(1.5)) == Float128(1.5));
ASSERT_TRUE(Float128(static_cast<float128>(-1.5)) == Float128(-1.5));
ASSERT_TRUE(Float128(static_cast<float128>(1e300)) == Float128(1e300));
// emulated to native float128
ASSERT_TRUE(static_cast<float128>(Float128(0.0)) ==
static_cast<float128>(0.0));
ASSERT_TRUE(static_cast<float128>(Float128(3.14)) ==
static_cast<float128>(3.14));
ASSERT_TRUE(static_cast<float128>(Float128(-3.14)) ==
static_cast<float128>(-3.14));
ASSERT_TRUE(static_cast<float128>(FPBits::inf(Sign::POS).get_val()) ==
static_cast<float128>(FPBits::inf(Sign::POS).get_val()));
ASSERT_TRUE(static_cast<float128>(Float128(1e-300)) ==
static_cast<float128>(1e-300));
}
#endif // LIBC_TYPES_HAS_FLOAT128

View file

@ -166,6 +166,20 @@ void SPARCV9::scanSectionImpl(InputSectionBase &sec, Relocs<RelTy> rels,
expr = R_GOT_OFF;
break;
// Optimize the GOT load to an add of the symbol's GOT-relative address if
// applicable. Exclude absolute symbol, which can be arbitrarily far. %l7
// points at .got, which must be retained.
case R_SPARC_GOTDATA_OP_HIX22:
case R_SPARC_GOTDATA_OP_LOX10:
case R_SPARC_GOTDATA_OP:
if (sym.isPreemptible || isAbsolute(sym)) {
expr = R_GOT_OFF;
} else {
ctx.in.got->hasGotOffRel.store(true, std::memory_order_relaxed);
expr = R_GOTREL;
}
break;
// TLS LE relocations:
case R_SPARC_TLS_LE_HIX22:
case R_SPARC_TLS_LE_LOX10:
@ -322,6 +336,24 @@ void SPARCV9::relocate(uint8_t *loc, const Relocation &rel,
// T-simm13
write32be(loc, (read32be(loc) & ~0x00001fff) | (val & 0x000003ff) | 0x1C00);
break;
case R_SPARC_GOTDATA_OP_HIX22: {
// V-imm22. sethi encodes the complement of a negative value, which the
// paired xor undoes, so the encodable range is 33 bits.
checkInt(ctx, loc, val, 33, rel);
uint64_t v = int64_t(val) < 0 ? ~val : val;
write32be(loc, (read32be(loc) & ~0x003fffff) | ((v >> 10) & 0x003fffff));
break;
}
case R_SPARC_GOTDATA_OP_LOX10:
// T-simm13. Only a negative value needs the sign extension bits.
write32be(loc, (read32be(loc) & ~0x00001fff) | (val & 0x000003ff) |
(int64_t(val) < 0 ? 0x1c00 : 0));
break;
case R_SPARC_GOTDATA_OP:
// ldx [%rs1 + %rs2], %rd -> add %rs1, %rs2, %rd
if (rel.expr == R_GOTREL)
write32be(loc, (read32be(loc) & 0x3e07c01f) | 0x80000000);
break;
default:
llvm_unreachable("unknown relocation");
}

View file

@ -770,6 +770,10 @@ struct Ctx : CommonLinkerContext {
unsigned scriptSymOrderCounter = 1;
llvm::DenseMap<const Symbol *, unsigned> scriptSymOrder;
// Used to assert removeUnusedSyntheticSections-removed sections cannot become
// needed again.
SmallVector<SyntheticSection *, 0> removedSyntheticSections;
// The set of TOC entries (.toc + addend) for which we should not apply
// toc-indirect to toc-relative relaxation. const Symbol * refers to the
// STT_SECTION symbol associated to the .toc input section.

View file

@ -1747,6 +1747,17 @@ template <class ELFT> void Writer<ELFT>::optimizeBasicBlockJumps() {
is->trim();
}
// Sections that finalizeAddressDependentContent may add to.
static bool mayGrowLate(Ctx &ctx, SyntheticSection *sec) {
if (sec != ctx.in.relaDyn.get())
return false;
// Relocations may move here from .relr.auth.dyn.
if (ctx.in.relrAuthDyn && ctx.in.relrAuthDyn->isNeeded())
return true;
// PPC64PILongBranchThunk adds a relative relocation for its .branch_lt entry.
return ctx.in.ppc64LongBranchTarget && ctx.arg.picThunk;
}
// In order to allow users to manipulate linker-synthesized sections,
// we had to add synthetic sections to the input section list early,
// even before we make decisions whether they are needed. This allows
@ -1758,7 +1769,8 @@ template <class ELFT> void Writer<ELFT>::optimizeBasicBlockJumps() {
//
// To deal with the above problem, this function is called after
// scanRelocations is called to remove synthetic sections that turn
// out to be empty.
// out to be empty. It runs before finalizeAddressDependentContent, which may
// add to a section mayGrowLate reports.
static void removeUnusedSyntheticSections(Ctx &ctx) {
// All input synthetic sections that can be empty are placed after
// all regular ones. Reverse iterate to find the first synthetic section
@ -1773,17 +1785,13 @@ static void removeUnusedSyntheticSections(Ctx &ctx) {
auto end =
std::remove_if(start, ctx.inputSections.end(), [&](InputSectionBase *s) {
auto *sec = cast<SyntheticSection>(s);
if (sec->getParent() && sec->isNeeded())
return false;
// .relr.auth.dyn relocations may be moved to .rela.dyn in
// finalizeAddressDependentContent, making .rela.dyn no longer empty.
// Conservatively keep .rela.dyn. .relr.auth.dyn can be made empty, but
// we would fail to remove it here.
if (ctx.arg.emachine == EM_AARCH64 && ctx.arg.relrPackDynRelocs &&
sec == ctx.in.relaDyn.get() && ctx.in.relrAuthDyn &&
ctx.in.relrAuthDyn->isNeeded())
if ((sec->getParent() && sec->isNeeded()) || mayGrowLate(ctx, sec))
return false;
unused.insert(sec);
// LinkerScript::discard clears the parent. Losing later additions to
// such a section is intended.
if (sec->getParent())
ctx.removedSyntheticSections.push_back(sec);
return true;
});
ctx.inputSections.erase(end, ctx.inputSections.end());
@ -2117,6 +2125,10 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
// values. They also might change after adding the thunks.
finalizeAddressDependentContent();
// A section dropped as unneeded must have stayed unneeded.
assert(llvm::none_of(ctx.removedSyntheticSections,
[](SyntheticSection *sec) { return sec->isNeeded(); }));
// All information needed for OutputSection part of Map file is available.
if (errCount(ctx))
return;

View file

@ -204,16 +204,20 @@ void ConcatInputSection::foldIdentical(ConcatInputSection *copy,
for (auto &copySym : copy->symbols)
copySym->identicalCodeFoldingKind = foldKind;
symbols.insert(symbols.end(), copy->symbols.begin(), copy->symbols.end());
copy->symbols.clear();
// Remove duplicate compact unwind info for symbols at the same address.
if (symbols.empty())
if (copy->symbols.empty())
return;
for (auto it = symbols.begin() + 1; it != symbols.end(); ++it) {
auto *it = copy->symbols.begin();
// The first symbol in the merged section (symbols.front()) must keep its
// unwind entry. If this section is empty, the copy's first symbol becomes the
// new front, so we skip clearing it.
if (symbols.empty())
++it;
for (; it != copy->symbols.end(); ++it) {
assert((*it)->value == 0);
(*it)->originalUnwindEntry = nullptr;
}
symbols.insert(symbols.end(), copy->symbols.begin(), copy->symbols.end());
copy->symbols.clear();
}
void ConcatInputSection::writeTo(uint8_t *buf) {

View file

@ -11,11 +11,20 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
# RUN: ld.lld -pie -T %t.lds %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC %s
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC-PI -DOFF0=a0b0 -DOFF1=a0b8 %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
## --pic-veneer selects PI long-branch thunks in a non-PIC link.
# RUN: ld.lld --pic-veneer -T %t.lds %t.o -o %t
# RUN: llvm-readelf -r %t | FileCheck --check-prefix=SEC-PI -DOFF0=a010 -DOFF1=a018 %s
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# SEC: There are no relocations in this file.
# SEC-PI: Relocation section '.rela.dyn' {{.*}} contains 2 entries:
# SEC-PI: {{0+}}[[OFF0]] {{[0-9a-f]+}} R_PPC64_RELATIVE a004
# SEC-PI-NEXT: {{0+}}[[OFF1]] {{[0-9a-f]+}} R_PPC64_RELATIVE a010
# CHECK-LABEL: <_start>:
# CHECK-NEXT: 2000: bt 2, 0x2040
# CHECK-NEXT: bt+ 2, 0x2040

View file

@ -28,16 +28,16 @@
# RUN: llvm-readelf -s %t | FileCheck %s --check-prefix=SYMBOL-GLOBAL
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# SYMBOL: 2: 0000000010010000 0 NOTYPE LOCAL DEFAULT 5 callee1_stother0_default
# SYMBOL-NEXT: 3: 0000000010010004 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 5 caller1
# SYMBOL-NEXT: 4: 0000000010020000 0 NOTYPE LOCAL DEFAULT 6 func_local
# SYMBOL-NEXT: 5: 0000000010020004 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 6 callee2_stother1_default
# SYMBOL-NEXT: 6: 000000001002000c 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 6 caller2
# SYMBOL-NEXT: 7: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 7 caller3
# SYMBOL-NEXT: 8: 0000000010040000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 8 caller4
# SYMBOL-NEXT: 9: 0000000010040008 0 NOTYPE LOCAL DEFAULT 9 func_extern
# SYMBOL-NEXT: 10: 000000001004000c 0 NOTYPE LOCAL HIDDEN 9 callee3_stother0_hidden
# SYMBOL-NEXT: 11: 0000000010040010 0 NOTYPE LOCAL HIDDEN [<other: 0x22>] 9 callee4_stother1_hidden
# SYMBOL: 2: 0000000010010000 0 NOTYPE LOCAL DEFAULT 6 callee1_stother0_default
# SYMBOL-NEXT: 3: 0000000010010004 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 6 caller1
# SYMBOL-NEXT: 4: 0000000010020000 0 NOTYPE LOCAL DEFAULT 7 func_local
# SYMBOL-NEXT: 5: 0000000010020004 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 7 callee2_stother1_default
# SYMBOL-NEXT: 6: 000000001002000c 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 7 caller2
# SYMBOL-NEXT: 7: 0000000010030000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 8 caller3
# SYMBOL-NEXT: 8: 0000000010040000 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 9 caller4
# SYMBOL-NEXT: 9: 0000000010040008 0 NOTYPE LOCAL DEFAULT 10 func_extern
# SYMBOL-NEXT: 10: 000000001004000c 0 NOTYPE LOCAL HIDDEN 10 callee3_stother0_hidden
# SYMBOL-NEXT: 11: 0000000010040010 0 NOTYPE LOCAL HIDDEN [<other: 0x22>] 10 callee4_stother1_hidden
# SYMBOL-GLOBAL: 2: 0000000010010004 0 NOTYPE LOCAL DEFAULT [<other: 0x20>] 1 caller1
# SYMBOL-GLOBAL-NEXT: 3: 0000000010020000 0 NOTYPE LOCAL DEFAULT 2 func_local

View file

@ -0,0 +1,141 @@
# REQUIRES: sparc
## Test R_SPARC_GOTDATA_OP_HIX22, R_SPARC_GOTDATA_OP_LOX10 and R_SPARC_GOTDATA_OP.
## The GOT load is optimized to an add of the symbol's GOT-relative address
## unless the symbol is preemptible or absolute.
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=sparcv9 a.s -o a.o
# RUN: llvm-mc -filetype=obj -triple=sparcv9 b.s -o b.o
# RUN: llvm-mc -filetype=obj -triple=sparcv9 c.s -o c.o
# RUN: llvm-mc -filetype=obj -triple=sparcv9 ifunc.s -o ifunc.o
# RUN: ld.lld -shared a.o c.o -o a.so
# RUN: llvm-readelf -S -r a.so | FileCheck %s --check-prefix=RELOC
# RUN: llvm-objdump -d -j .text --no-show-raw-insn --no-print-imm-hex a.so | FileCheck %s
# RELOC: [ 8] .got PROGBITS 0000000000200390 {{[0-9a-f]+}} 000020
# RELOC: Relocation section '.rela.dyn' {{.*}} contains 1 entries:
# RELOC: 0000000000200398 {{.*}} R_SPARC_GLOB_DAT {{.*}} foo + 0
## foo is preemptible, so the GOT load stays.
## .got[1] - _GLOBAL_OFFSET_TABLE_ = 0x200398 - 0x200390 = 8.
# CHECK-LABEL: <_start>:
# CHECK-NEXT: sethi 0, %l1
# CHECK-NEXT: xor %l1, 8, %l1
# CHECK-NEXT: ldx [%l7+%l1], %l2
## hid0 - _GLOBAL_OFFSET_TABLE_ = 0x3003b0 - 0x200390 = 0x100020.
# CHECK-NEXT: sethi 1024, %g1
# CHECK-NEXT: xor %g1, 32, %g1
# CHECK-NEXT: add %l7, %g1, %g1
## hid1 - _GLOBAL_OFFSET_TABLE_ = 0x1002ec - 0x200390 = -0x1000a4. sethi holds
## the complement, which the sign-extended xor operand undoes.
# CHECK-NEXT: sethi 1024, %o2
# CHECK-NEXT: xor %o2, -164, %o2
# CHECK-NEXT: add %i0, %o2, %i5
## An undefined symbol and an absolute symbol both have an absolute address, so
## neither is optimized.
# CHECK-NEXT: sethi 0, %l1
# CHECK-NEXT: xor %l1, 16, %l1
# CHECK-NEXT: ldx [%l7+%l1], %l2
# CHECK-NEXT: sethi 0, %g4
# CHECK-NEXT: xor %g4, 24, %g4
# CHECK-NEXT: ldx [%l7+%g4], %o3
## foo is not preemptible in an executable and is optimized as well. undefweak
## and absolute keep the GOT load in every mode.
# RUN: ld.lld a.o c.o -o a
# RUN: llvm-objdump -d -j .text --no-show-raw-insn --no-print-imm-hex a | FileCheck %s --check-prefix=NOPIE
# NOPIE-LABEL: <_start>:
# NOPIE-NEXT: sethi 1024, %l1
# NOPIE-NEXT: xor %l1, -4, %l1
# NOPIE-NEXT: add %l7, %l1, %l2
# NOPIE: sethi 0, %l1
# NOPIE-NEXT: xor %l1, 8, %l1
# NOPIE-NEXT: ldx [%l7+%l1], %l2
# NOPIE-NEXT: sethi 0, %g4
# NOPIE-NEXT: xor %g4, 16, %g4
# NOPIE-NEXT: ldx [%l7+%g4], %o3
## .got holds nothing but the header, yet must be kept: %l7 points at it.
# RUN: ld.lld -shared b.o -o b.so
# RUN: llvm-readelf -S b.so | FileCheck %s --check-prefix=HEADER
# HEADER: [ 7] .got PROGBITS 00000000002002b8 {{[0-9a-f]+}} 000008
# RUN: not ld.lld -shared ifunc.o 2>&1 | FileCheck %s --check-prefix=IFUNC --implicit-check-not=error:
# IFUNC: error: {{.*}}relocation R_SPARC_WDISP19 out of range
## The optimization is decided before addresses are known, so an out-of-range
## offset is an error rather than a fallback to the GOT load. The offset is
## reported as signed, not as the complement the sethi encodes. Only hid0, in
## .data, is out of range; the other symbols stay next to .got.
# RUN: not ld.lld -shared a.o c.o --section-start=.text=0x10000 --section-start=.got=0x20000 \
# RUN: --section-start=.data=0x200000000 2>&1 | FileCheck %s --check-prefix=ERR -DVAL=8589803520 --implicit-check-not=error:
# RUN: not ld.lld -shared a.o c.o --section-start=.data=0x10000 --section-start=.text=0x200000000 \
# RUN: --section-start=.got=0x200020000 2>&1 | FileCheck %s --check-prefix=ERR -DVAL=-8590000128 --implicit-check-not=error:
# ERR: error: a.o:(.text+0xc): relocation R_SPARC_GOTDATA_OP_HIX22 out of range: [[VAL]] is not in [-4294967296, 4294967295]; references 'hid0'
#--- a.s
.text
.globl _start
_start:
sethi %gdop_hix22(foo), %l1
xor %l1, %gdop_lox10(foo), %l1
ldx [%l7 + %l1], %l2, %gdop(foo)
sethi %gdop_hix22(hid0), %g1
xor %g1, %gdop_lox10(hid0), %g1
ldx [%l7 + %g1], %g1, %gdop(hid0)
## The add keeps rs1, rs2 and rd of the load, and ld is optimized like ldx.
sethi %gdop_hix22(hid1), %o2
xor %o2, %gdop_lox10(hid1), %o2
ld [%i0 + %o2], %i5, %gdop(hid1)
sethi %gdop_hix22(undefweak), %l1
xor %l1, %gdop_lox10(undefweak), %l1
ldx [%l7 + %l1], %l2, %gdop(undefweak)
sethi %gdop_hix22(absolute), %g4
xor %g4, %gdop_lox10(absolute), %g4
ldx [%l7 + %g4], %o3, %gdop(absolute)
.globl foo, hid0, hid1
.hidden hid0, hid1
foo:
hid1:
nop
.weak undefweak
.hidden undefweak
.data
hid0:
.xword 0
#--- b.s
.globl _start
_start:
sethi %gdop_hix22(local), %l1
xor %l1, %gdop_lox10(local), %l1
ldx [%l7 + %l1], %l2, %gdop(local)
local:
nop
#--- c.s
## Separate file to test %gdop_lox10(absolute) relocations in a.s
.globl absolute
.hidden absolute
absolute = 0x1234
#--- ifunc.s
.globl _start
_start:
sethi %gdop_hix22(ifunc), %l1
xor %l1, %gdop_lox10(ifunc), %l1
ldx [%l7 + %l1], %l2, %gdop(ifunc)
.globl ifunc
.hidden ifunc
.type ifunc, @gnu_indirect_function
ifunc:
nop

View file

@ -0,0 +1,37 @@
# REQUIRES: x86
# RUN: rm -rf %t*
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
# RUN: %lld -lSystem --icf=all -o %t %t.o
# RUN: llvm-objdump --macho --section-headers %t | FileCheck %s --check-prefix=SECT
# RUN: llvm-objdump --macho --syms %t | FileCheck %s --check-prefix=SYMS
## Every body folds into one, so __text holds a single 6-byte body plus _main
## rather than the 3 MiB (0x30000d) the unfolded copies occupy.
# SECT: Idx Name Size
# SECT-NEXT: 0 __text 00000009
## The sentinels bracket the group, so checking that the first and last members
## of the class share an address covers the whole run of folds.
# SYMS-DAG: [[#%.16x,F:]] g F __TEXT,__text _f_first
# SYMS-DAG: [[#F]] g F __TEXT,__text _f_last
.subsections_via_symbols
.text
.p2align 2
.globl _f_first
_f_first:; movl $7, %eax; ret
## 64 Ki identical function landing in one equivalence class.
.rept 65536
.globl _f\+
_f\+:; movl $$7, %eax; ret
.endr
.globl _f_last
_f_last:; movl $7, %eax; ret
.globl _main
_main:
ret

View file

@ -137,6 +137,35 @@ the test should be run or not.
@skipTestIfFn(checking_function_name)
```
### Skipped versus unsupported
A test that doesn't run does so for one of two very different reasons, and the
decorator you pick says which:
* The test **can never** run in this configuration. A test for Mach-O debug
maps has nothing to say on Linux; a test that calls `fork()` has nothing to
say on Windows. Use the `require*` family. These are reported as
**UNSUPPORTED**.
* The test **ought to** run in this configuration but doesn't work yet. Use the
`skipIf*` / `skipUnless*` family. These are reported as **SKIPPED**, which
keeps them visible as work still to be done.
```python
@requireDarwin # inherently Darwin-only: reported UNSUPPORTED elsewhere
@skipIfWindows # ought to work on Windows, currently broken: reported SKIPPED
```
The `require*` decorators mirror the `skip*` ones one-for-one:
`requireDarwin` / `requireNotDarwin`, `requireLinux` / `requireNotLinux`,
`requireWindows` / `requireNotWindows`, plus `requirePOSIX`, `requireSignals`,
`requireNotWasm`, `requireDarwinHost`, and the general
`requirePlatform(oslist)` / `requireNotPlatform(oslist)`.
Reach for `require*` when the test is tied to a platform-specific file format,
API, or OS feature. If the test is merely untested or broken somewhere, keep
`skipIf*` so nobody mistakes a bug for a design decision.
In addition to providing a lot more flexibility when it comes to writing the
test, the API test also allow for much more complex scenarios when it comes to
building inferiors. Every test has its own `Makefile`, most of them only a

View file

@ -30,6 +30,7 @@ from lldbsuite.support import temp_file
from lldbsuite.test import lldbplatform
from lldbsuite.test import lldbplatformutil
from lldbsuite.test.cpu_feature import CPUFeature
from lldbsuite.test.skip_reason import UnsupportedReason
class DecorateMode:
@ -1123,6 +1124,126 @@ def skipUnlessPlatform(oslist):
)
##############################################################################
# Platform *requirement* decorators.
#
# These express "this test can only ever run here", as opposed to the skipIf /
# skipUnless family which means "this test ought to run here but is broken".
# Tests turned off by a `require*` decorator are reported as UNSUPPORTED; tests
# turned off by a `skip*` decorator are reported as SKIPPED. See
# `lldbsuite.test.skip_reason` for how the distinction is carried.
#
# Reach for these when the test is inherently tied to a platform: it debugs a
# platform-specific file format, drives a platform-specific API, or exercises
# an OS feature that simply doesn't exist elsewhere. If the test is merely
# untested or broken somewhere, keep using skipIf / skipUnless so it stays
# visible as work to be done.
##############################################################################
def requirePlatform(oslist):
"""Mark the item as runnable only on the listed target platforms.
Unlike `skipUnlessPlatform`, other platforms are reported as UNSUPPORTED
rather than SKIPPED.
"""
return unittest.skipUnless(
lldbplatformutil.getPlatform() in oslist,
UnsupportedReason("requires one of %s" % (", ".join(oslist))),
)
def requireNotPlatform(oslist):
"""Mark the item as inherently inapplicable to the listed target platforms.
Unlike `skipIfPlatform`, the listed platforms are reported as UNSUPPORTED
rather than SKIPPED.
"""
return unittest.skipIf(
lldbplatformutil.getPlatform() in oslist,
UnsupportedReason("unsupported on %s" % (", ".join(oslist))),
)
def requireDarwin(func):
"""Mark the item as inherently Darwin-only (Mach-O, debug maps, Darwin
kernel/runtime APIs, ...). Non-Darwin targets report UNSUPPORTED."""
return requirePlatform(lldbplatform.translate(lldbplatform.darwin_all))(func)
def requireNotDarwin(func):
"""Mark the item as inherently inapplicable to Darwin targets."""
return requireNotPlatform(lldbplatform.translate(lldbplatform.darwin_all))(func)
def requireLinux(func):
"""Mark the item as inherently Linux-only (procfs, Linux-specific syscalls,
...). Other targets report UNSUPPORTED."""
return requirePlatform(["linux"])(func)
def requireNotLinux(func):
"""Mark the item as inherently inapplicable to Linux targets."""
return requireNotPlatform(["linux"])(func)
def requireWindows(func):
"""Mark the item as inherently Windows-only (PE/COFF, Win32 APIs, ...).
Other targets report UNSUPPORTED."""
return requirePlatform(["windows"])(func)
def requireNotWindows(func):
"""Mark the item as inherently inapplicable to Windows targets.
Use this for tests built on POSIX-only concepts: fork/exec semantics,
POSIX signals, ptrace, ELF/Mach-O specifics, shell pipelines, and so on.
"""
return requireNotPlatform(["windows"])(func)
def requirePOSIX(func):
"""Mark the item as requiring a POSIX target.
A shorthand for `requireNotWindows` that reads better on tests whose
dependency is POSIX semantics generally rather than anything about
Windows specifically.
"""
return requireNotPlatform(["windows"])(func)
def requireSignals(func):
"""Mark the item as requiring POSIX signal support on the target."""
return requireNotPlatform(["windows", "wasip1", "wasi"])(func)
def requireNotWasm(func):
"""Mark the item as inherently inapplicable to WebAssembly targets.
WebAssembly has no processes, no signals, no shared libraries and no
ptrace-style debugging, so a large amount of the test suite can never
apply to it.
"""
return requireNotPlatform(["wasip1", "wasi"])(func)
def requireHostPlatform(oslist):
"""Mark the item as runnable only on the listed *host* platforms."""
return unittest.skipUnless(
lldbplatformutil.getHostPlatform() in oslist,
UnsupportedReason("requires one of %s as host" % (", ".join(oslist))),
)
def requireDarwinHost(func):
"""Mark the item as requiring a Darwin host, regardless of target.
Use for tests that drive host-side Darwin facilities: `xcrun`, the
simulator runtimes, dsymutil, the LLDB.framework layout, and so on.
"""
return requireHostPlatform(lldbplatform.translate(lldbplatform.darwin_all))(func)
def skipIfTargetDoesNotSupportThreads():
"""Skip tests that require thread support (e.g. pthreads)."""
platform = lldbplatformutil.getPlatform()

View file

@ -1255,6 +1255,12 @@ def run_suite():
configuration.failed = not result.wasSuccessful()
if getattr(result, "skipped", None):
sys.stderr.write(
"Skip breakdown (unsupported=%d, skipped=%d)\n"
% (result.countUnsupported(), result.countSkipped())
)
if configuration.sdir_has_content and configuration.verbose:
sys.stderr.write(
"Session logs for test failures/errors/unexpected successes"

View file

@ -0,0 +1,17 @@
"""
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
See https://llvm.org/LICENSE.txt for license information.
SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Distinguishes the two reasons a test can end up not running.
"""
class UnsupportedReason(str):
"""A skip reason meaning "this test can never run here", not "this test is
broken here". Reported as UNSUPPORTED rather than SKIPPED."""
def is_unsupported(reason):
"""Return True if *reason* marks a test as unsupported rather than skipped."""
return isinstance(reason, UnsupportedReason)

View file

@ -16,6 +16,7 @@ import unittest
# LLDB Modules
from . import configuration
from .skip_reason import UnsupportedReason, is_unsupported
from lldbsuite.test_event import build_exception
@ -162,10 +163,18 @@ class LLDBTestResult(unittest.TextTestResult):
getattr(test, test._testMethodName).__func__.__unittest_skip__ = True
getattr(
test, test._testMethodName
).__func__.__unittest_skip_why__ = (
).__func__.__unittest_skip_why__ = UnsupportedReason(
"test case does not fall in any category of interest for this run"
)
def countUnsupported(self):
"""Number of skipped tests that can never run in this configuration."""
return sum(1 for _, reason in self.skipped if is_unsupported(reason))
def countSkipped(self):
"""Number of skipped tests that ought to run here but don't work yet."""
return len(self.skipped) - self.countUnsupported()
def checkExclusion(self, exclusion_list, name):
if exclusion_list:
import re
@ -282,9 +291,13 @@ class LLDBTestResult(unittest.TextTestResult):
method = getattr(test, "markSkippedTest", None)
if method:
method()
# A test turned off by a `require*` decorator can never run in this
# configuration, so report it as UNSUPPORTED. Anything else is a test
# that ought to run here but doesn't work yet: report it as SKIPPED.
status = "UNSUPPORTED" if is_unsupported(reason) else "SKIPPED"
self.stream.write(
"UNSUPPORTED: LLDB (%s) :: %s (%s) \n"
% (self._config_string(test), str(test), reason)
"%s: LLDB (%s) :: %s (%s) \n"
% (status, self._config_string(test), str(test), reason)
)
def addUnexpectedSuccess(self, test):

View file

@ -34,10 +34,12 @@
#include "lldb/Host/HostInfo.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Target/Process.h"
#include "lldb/Utility/ErrorMessages.h"
#include "lldb/Utility/Status.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/FormatVariadic.h"
using namespace lldb;
using namespace lldb_private;
@ -433,7 +435,10 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
if (result != eExpressionCompleted) {
error = Status::FromError(diagnostics.GetAsError(
eExpressionSetupError,
"LoadLibrary error: failed to execute LoadLibrary helper:"));
llvm::formatv("failed to execute LoadLibrary helper "
"({0}):",
toString(result))
.str()));
return LLDB_INVALID_IMAGE_TOKEN;
}
@ -941,7 +946,10 @@ extern "C" {
ExpressionResults result = UserExpression::Evaluate(
context, options, expression, kLoaderDecls, value);
if (result != eExpressionCompleted)
return value ? value->GetError().Clone() : Status("unknown error");
return value
? value->GetError().Clone()
: Status::FromErrorStringWithFormatv(
"failed to execute loader helper ({0})", toString(result));
if (value && value->GetError().Fail())
return value->GetError().Clone();

View file

@ -840,22 +840,116 @@ def main(f):
return ArgInfo(count, varargs)
)";
Expected<PythonCallable::ArgInfo> PythonCallable::GetArgInfo() const {
ArgInfo result = {};
if (!IsValid())
return nullDeref();
// inspect.signature() is deeply recursive and expensive in C-stack terms;
// reentrant scripted callbacks dispatched through GetArgInfo() can turn
// that into a fatal stack overflow instead of a catchable Python
// RecursionError. GetArgInfo() never calls this itself; callers fall back
// to it explicitly when they need to handle callables its cheaper,
// attribute-only approach can't (e.g. builtins).
Expected<PythonCallable::ArgInfo>
PythonCallable::GetArgInfoFromInspectSignature(const PythonCallable &callable) {
PythonCallable::ArgInfo result = {};
// no need to synchronize access to this global, we already have the GIL
static PythonScript get_arg_info(get_arg_info_script);
Expected<PythonObject> pyarginfo = get_arg_info(*this);
Expected<PythonObject> pyarginfo = get_arg_info(callable);
if (!pyarginfo)
return pyarginfo.takeError();
long long count =
cantFail(As<long long>(pyarginfo.get().GetAttribute("count")));
bool has_varargs =
cantFail(As<bool>(pyarginfo.get().GetAttribute("has_varargs")));
result.max_positional_args = has_varargs ? ArgInfo::UNBOUNDED : count;
result.max_positional_args =
has_varargs ? PythonCallable::ArgInfo::UNBOUNDED : count;
return result;
}
// GetArgInfo()'s branches, top to bottom (`func` is what each branch ends up
// introspecting; the final step is always func.__code__.co_argcount/co_flags):
//
// callable
// |-- has __self__ -> func = __func__ (bound method;
// | fails for slot wrappers, e.g. (1).__add__)
// |-- has __code__ already -> func = callable (plain function)
// `-- neither
// |-- is a class
// | |-- __init__ has __code__ -> func = __init__
// | `-- else: check __new__ too (object.__init__ is lenient about
// | extra args once __new__ is overridden)
// | |-- __new__ has __code__ -> func = __new__
// | `-- else -> ArgInfo{0} (object's defaults)
// `-- is an instance
// `-- func = __call__ (unwrap __func__ if bound)
// `-- no __code__ -> error (e.g. a builtin)
Expected<PythonCallable::ArgInfo> PythonCallable::GetArgInfo() const {
if (!IsValid())
return nullDeref();
PythonObject func = *this;
bool implicit_first_arg = false;
if (HasAttribute("__self__")) {
implicit_first_arg = true;
Expected<PythonObject> func_or_err = GetAttribute("__func__");
if (!func_or_err)
return func_or_err.takeError();
func = *func_or_err;
} else if (!HasAttribute("__code__")) {
implicit_first_arg = true;
if (PyType_Check(m_py_obj)) {
Expected<PythonObject> init_or_err = GetAttribute("__init__");
if (!init_or_err)
return init_or_err.takeError();
func = *init_or_err;
if (!func.HasAttribute("__code__")) {
// __init__ is still object.__init__. A class may customize
// __new__ instead and leave __init__ untouched, which makes
// object.__init__ lenient about extra arguments -- so check
// __new__ too before concluding there are none.
Expected<PythonObject> new_or_err = GetAttribute("__new__");
if (!new_or_err)
return new_or_err.takeError();
func = *new_or_err;
if (!func.HasAttribute("__code__"))
return ArgInfo{0};
}
} else {
Expected<PythonObject> call_or_err = GetAttribute("__call__");
if (!call_or_err)
return call_or_err.takeError();
func = *call_or_err;
if (func.HasAttribute("__self__")) {
Expected<PythonObject> inner_or_err = func.GetAttribute("__func__");
if (!inner_or_err)
return inner_or_err.takeError();
func = *inner_or_err;
}
if (!func.HasAttribute("__code__"))
return llvm::createStringError("__call__ has no __code__");
}
}
Expected<PythonObject> code_or_err = func.GetAttribute("__code__");
if (!code_or_err)
return code_or_err.takeError();
PythonObject code = *code_or_err;
Expected<long long> argcount =
As<long long>(code.GetAttribute("co_argcount"));
if (!argcount)
return argcount.takeError();
Expected<long long> flags = As<long long>(code.GetAttribute("co_flags"));
if (!flags)
return flags.takeError();
ArgInfo result = {};
// Mirrors CPython's CO_VARARGS from <code.h>, which isn't reliably
// visible across the Python versions/platforms this file builds against.
constexpr long long kCoFlagVarArgs = 0x04;
if (*flags & kCoFlagVarArgs) {
result.max_positional_args = ArgInfo::UNBOUNDED;
} else {
long long count = *argcount - (implicit_first_arg ? 1 : 0);
result.max_positional_args = count > 0 ? static_cast<unsigned>(count) : 0;
}
return result;
}

View file

@ -615,6 +615,15 @@ public:
llvm::Expected<ArgInfo> GetArgInfo() const;
// Always derives ArgInfo via a Python-level inspect.signature() call,
// regardless of whether the callable's argument count/varargs bit could
// have been read directly off its data attributes. GetArgInfo() prefers
// the cheaper attribute-based path and only falls back to this for
// callables it can't introspect that way (e.g. builtins); exposed
// separately so that fallback behavior can be tested directly.
static llvm::Expected<ArgInfo>
GetArgInfoFromInspectSignature(const PythonCallable &callable);
PythonObject operator()();
PythonObject operator()(std::initializer_list<PyObject *> args);

View file

@ -1300,6 +1300,14 @@ ScriptInterpreterPythonImpl::GetMaxPositionalArgumentsForCallable(
callable_name.str().c_str());
}
llvm::Expected<PythonCallable::ArgInfo> arg_info = pfunc.GetArgInfo();
if (!arg_info) {
// `-f` may point at a builtin, unlike other GetArgInfo() callers.
LLDB_LOG_ERROR(GetLog(LLDBLog::Script), arg_info.takeError(),
"GetArgInfo failed for callable {1}, falling back to "
"inspect.signature: {0}",
callable_name);
arg_info = PythonCallable::GetArgInfoFromInspectSignature(pfunc);
}
if (!arg_info)
return arg_info.takeError();
return arg_info.get().max_positional_args;

View file

@ -717,7 +717,6 @@ class RegisterCommandsTestCase(TestBase):
self.expect("register write pc 0", substrs=[err_msg], error=True)
self.expect("register info pc", substrs=[err_msg], error=True)
@expectedFailureDarwin(bugnumber="github.com/llvm/llvm-project/issues/213386")
def test_case_insensitivity(self):
"""
Register names, their aliases and any generic names like "sp" and "ra"

View file

@ -16,7 +16,7 @@ class AArch64LinuxAArch32Compat(TestBase):
@skipIfRemote
@skipUnlessArch("aarch64")
@skipIfLLVMTargetMissing("ARM")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_aarch32_compat(self):
self.build()
test_program = self.getBuildArtifact("a.out")

View file

@ -16,7 +16,7 @@ class AArch64LinuxFPMR(TestBase):
EXPECTED_FPMR_FIELDS = ["LSCALE2 = 42", "F8S1 = FP8_E4M3 | 0x4"]
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_fpmr_register_live(self):
if not self.isAArch64FPMR():
self.skipTest("FPMR must be present.")

View file

@ -13,7 +13,7 @@ class AArch64LinuxGCSTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_region(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")
@ -62,7 +62,7 @@ class AArch64LinuxGCSTestCase(TestBase):
# cleanly if GCS was manually enabled.
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_fault(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")
@ -118,7 +118,7 @@ class AArch64LinuxGCSTestCase(TestBase):
return gcs_features_enabled, gcs_features_locked, gcspr_el0
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_registers(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")
@ -239,7 +239,7 @@ class AArch64LinuxGCSTestCase(TestBase):
],
)
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_expression_simple(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")
@ -303,7 +303,7 @@ class AArch64LinuxGCSTestCase(TestBase):
self.expect(expr_cmd, substrs=["(unsigned long) 1"])
self.check_gcs_registers(*before)
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_expression_disable_gcs(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")
@ -343,7 +343,7 @@ class AArch64LinuxGCSTestCase(TestBase):
enabled &= ~1
self.check_gcs_registers(enabled, locked, spr_el0)
@skipUnlessPlatform(["linux"])
@requireLinux
def test_gcs_expression_enable_gcs(self):
if not self.isAArch64GCS():
self.skipTest("Target must support GCS.")

View file

@ -14,7 +14,7 @@ class AArch64LinuxMTEMemoryRegionTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_regions(self):
if not self.isAArch64MTE():

View file

@ -44,7 +44,7 @@ class AArch64LinuxMTEMemoryTagAccessTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_tag_read(self):
self.setup_mte_test()
@ -209,7 +209,7 @@ class AArch64LinuxMTEMemoryTagAccessTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_tag_write(self):
self.setup_mte_test()
@ -431,7 +431,7 @@ class AArch64LinuxMTEMemoryTagAccessTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_memory_read_tag_display(self):
self.setup_mte_test()
@ -588,7 +588,7 @@ class AArch64LinuxMTEMemoryTagAccessTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
# Repeating options currently does not work, see
# https://github.com/llvm/llvm-project/issues/192057.
@ -631,7 +631,7 @@ class AArch64LinuxMTEMemoryTagAccessTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_memory_find(self):
"""Test the --show-tags option with memory find."""

View file

@ -38,7 +38,7 @@ class AArch64LinuxMTEMemoryTagFaultsTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_tag_fault_sync(self):
self.setup_mte_test("sync")
@ -57,7 +57,7 @@ class AArch64LinuxMTEMemoryTagFaultsTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
@skipUnlessAArch64MTELinuxCompiler
def test_mte_tag_fault_async(self):
self.setup_mte_test("async")

View file

@ -54,11 +54,11 @@ class AArch64LinuxNonAddressBitCodeBreak(TestBase):
# AArch64 Linux always enables the top byte ignore feature
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_software_break(self):
self.do_tagged_break(False)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_hardware_break(self):
self.do_tagged_break(True)

View file

@ -45,7 +45,7 @@ class AArch64LinuxNonAddressBitMemoryAccessTestCase(TestBase):
self.expect("memory read {}".format(read_from), substrs=[data])
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_non_address_bit_memory_read_write_cmds(self):
self.setup_test()
@ -82,7 +82,7 @@ class AArch64LinuxNonAddressBitMemoryAccessTestCase(TestBase):
self.assertEqual(data, buf_content)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_non_address_bit_memory_read_write_api_process(self):
self.setup_test()
buf, buf_with_non_address = self.get_ptr_values()
@ -121,7 +121,7 @@ class AArch64LinuxNonAddressBitMemoryAccessTestCase(TestBase):
self.assertEqual(0x5634120042444C4C, ptr)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_non_address_bit_memory_read_write_api_target(self):
self.setup_test()
buf, buf_with_non_address = self.get_ptr_values()
@ -147,7 +147,7 @@ class AArch64LinuxNonAddressBitMemoryAccessTestCase(TestBase):
# Read<type>FromMemory are in Target but not SBTarget so no tests for those.
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_non_address_bit_memory_caching(self):
# The read/write tests above do exercise the cache but this test
# only cares that the cache sees buf and buf_with_non_address

View file

@ -35,7 +35,7 @@ class AArch64LinuxPOE(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_poe_live(self):
if not self.isAArch64POE():
self.skipTest("POE must be present.")

View file

@ -38,7 +38,7 @@ class AArch64LinuxTaggedMemoryReadTestCase(TestBase):
)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_tagged_memory_read(self):
self.setup_test()
@ -64,7 +64,7 @@ class AArch64LinuxTaggedMemoryReadTestCase(TestBase):
self.expect("memory read", patterns=[tagged_addr_pattern], matching=False)
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_tagged_memory_find(self):
self.setup_test()

View file

@ -14,7 +14,7 @@ class AArch64LinuxTaggedMemoryRegionTestCase(TestBase):
# AArch64 Linux always enables the top byte ignore feature
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_mte_regions(self):
self.build()
self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)

View file

@ -96,7 +96,7 @@ class AArch64LinuxTLSRegisters(TestBase):
self.expect("p {}_was_set".format(register), substrs=["true"])
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_tls_no_sme(self):
if self.isAArch64SME():
self.skipTest("SME must not be present.")
@ -104,7 +104,7 @@ class AArch64LinuxTLSRegisters(TestBase):
self.check_tls_reg(["tpidr"])
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_tls_sme(self):
if not self.isAArch64SME():
self.skipTest("SME must be present.")
@ -112,7 +112,7 @@ class AArch64LinuxTLSRegisters(TestBase):
self.check_tls_reg(["tpidr", "tpidr2"])
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_tpidr2_no_sme(self):
if self.isAArch64SME():
self.skipTest("SME must not be present.")

View file

@ -12,7 +12,7 @@ class UnwindSignalTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessArch("aarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_unwind_signal(self):
"""Inferior calls sigill() and handles the resultant SIGILL.
Stopped at a breakpoint in the handler, check that we can unwind

View file

@ -11,7 +11,7 @@ class TargetSymbolsAddCommand(TestBase):
self.source = "main.c"
@no_debug_info_test # Prevent the genaration of the dwarf version of this test
@skipUnlessPlatform(["linux"])
@requireLinux
def test_target_symbols_add(self):
"""Test that 'target symbols add' can load the symbols
even if gnu.build-id and gnu_debuglink are not present in the module.

View file

@ -9,7 +9,7 @@ from lldbsuite.test import lldbutil
@skipUnlessArch("arm")
@skipUnlessPlatform(["linux"])
@requireLinux
class ArmLinuxTLSRegister(TestBase):
NO_DEBUG_INFO_TESTCASE = True

View file

@ -15,7 +15,7 @@ class TestLinkerSymbols(TestBase):
NO_DEBUG_INFO_TESTCASE = True
SHARED_BUILD_TESTCASE = False
@skipUnlessPlatform(["linux"])
@requireLinux
def test_linker_symbols(self):
build_dict = dict(LD_EXTRAS="-Wl,-T," + self.getSourcePath("linker.script"))
self.build(dictionary=build_dict)

View file

@ -78,7 +78,7 @@ class LoongArch64LinuxRegisters(TestBase):
self.expect("continue", substrs=["exited with status = 0"])
@skipUnlessArch("loongarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_lsx(self):
"""Test read/write of LSX registers."""
if not self.isLoongArchLSX():
@ -86,7 +86,7 @@ class LoongArch64LinuxRegisters(TestBase):
self.simd_registers_impl(Mode.LSX)
@skipUnlessArch("loongarch64")
@skipUnlessPlatform(["linux"])
@requireLinux
def test_lasx(self):
"""Test read/write of LASX registers."""
if not self.isLoongArchLASX():

View file

@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil
class TestMixedDwarfBinary(TestBase):
@no_debug_info_test # Prevent the genaration of the dwarf version of this test
@add_test_categories(["dwo"])
@skipUnlessPlatform(["linux"])
@requireLinux
def test_mixed_dwarf(self):
"""Test that 'frame variable' works
for the executable built from two source files compiled

View file

@ -7,7 +7,7 @@ from lldbsuite.test import lldbutil
class TestTargetSymbolsSepDebugSymlink(TestBase):
@no_debug_info_test # Prevent the genaration of the dwarf version of this test
@skipUnlessPlatform(["linux"])
@requireLinux
@skipIf(hostoslist=["windows"])
@skipIfRemote # llvm.org/pr36237
def test_target_symbols_sepdebug_symlink_case(self):

View file

@ -14,7 +14,7 @@ from lldbsuite.test import lldbutil
class CreateDuringInstructionStepTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessPlatform(["linux"])
@requireLinux
@expectedFailureAndroid("llvm.org/pr24737", archs=["arm$"])
@skipIf(oslist=["linux"], archs=["arm$", "aarch64"], bugnumber="llvm.org/pr24737")
def test_step_inst(self):

View file

@ -127,6 +127,15 @@ class LLDBTest(TestFormat):
expected_failures = parsed_details["expected failures"]
unexpected_successes = parsed_details["unexpected successes"]
only_skipped = 0
breakdown = re.search(
r"^Skip breakdown \(unsupported=(\d+), skipped=(\d+)\)\r?$",
err,
re.MULTILINE,
)
if breakdown:
only_skipped = int(breakdown.group(2))
non_pass = (
failures + errors + skipped + expected_failures + unexpected_successes
)
@ -142,9 +151,11 @@ class LLDBTest(TestFormat):
return lit.Test.XPASS, output
else:
# Aggregate the tests results with the following precedence:
# PASS > XFAIL > UNSUPPORTED
# PASS > XFAIL > SKIPPED > UNSUPPORTED
if passes > 0:
return lit.Test.PASS, output
if expected_failures > 0:
return lit.Test.XFAIL, output
if only_skipped > 0:
return lit.Test.SKIPPED, output
return lit.Test.UNSUPPORTED, output

View file

@ -4,7 +4,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
@requireDarwin
class AddDsymDownload(TestBase):
SHARED_BUILD_TESTCASE = False

View file

@ -7,7 +7,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
@requireDarwin
class AddDsymMidExecutionCommandCase(TestBase):
SHARED_BUILD_TESTCASE = False

View file

@ -4,7 +4,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
@requireDarwin
@skipIf(archs=no_match(["arm64"]))
class TestArmPointerMetadataStripping(TestBase):
def test(self):

View file

@ -7,7 +7,7 @@ from lldbsuite.test import lldbutil
class TestBSSOnlyDataSectionSliding(TestBase):
@skipUnlessDarwin
@requireDarwin
def test_with_python_api(self):
"""Test that we get thread names when interrupting a process."""
self.build()

View file

@ -12,7 +12,7 @@ from lldbsuite.test import lldbutil
class TestCorefileExceptionReason(TestBase):
@no_debug_info_test
@skipUnlessDarwin
@requireDarwin
@skipIf(archs=no_match(["arm64", "arm64e"]))
@skipIfRemote
def test(self):

View file

@ -21,14 +21,14 @@ class TestCTF(TestBase):
@skipTestIfFn(no_ctf_convert)
@skipTestIfFn(no_objcopy)
@skipUnlessDarwin
@requireDarwin
def test(self):
self.build()
self.do_test()
@skipTestIfFn(no_ctf_convert)
@skipTestIfFn(no_objcopy)
@skipUnlessDarwin
@requireDarwin
def test_compressed(self):
self.build(dictionary={"COMPRESS_CTF": "YES"})
self.do_test()

View file

@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil
class TestCase(TestBase):
@no_debug_info_test
@skipUnlessDarwin
@requireDarwin
def test_abort(self):
self.build()
target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))

View file

@ -8,7 +8,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@skipUnlessDarwin
@requireDarwin
@skipIfOutOfTreeDebugserver
class TestCase(TestBase):
def check_invalid_packet(self, packet_str):

View file

@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil
class TestDelayInitDependencies(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIf(macos_version=["<", "15.0"])
@skipIfRemote
def test_delay_init_dependency(self):

View file

@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil
class DenyAttachTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded # PT_DENY_ATTACH attach behavior differs on ios/tvos/etc
@skipIfAsan # Attach tests time out inconsistently under asan.
def test_attach_to_deny_attach_process(self):

View file

@ -28,7 +28,7 @@ def has_lldb_codesign():
return False
@skipUnlessDarwin
@requireDarwin
class TestdSYMCodesign(TestBase):
NO_DEBUG_INFO_TESTCASE = True
SHARED_BUILD_TESTCASE = False

View file

@ -11,7 +11,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
@skipUnlessDarwin
@requireDarwin
class TestdSYMModuleInit(TestBase):
SHARED_BUILD_TESTCASE = False

View file

@ -12,7 +12,7 @@ class DyldTrieSymbolsTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_dyld_trie_symbols(self):
"""Test that we make create symbol table entries from the dyld trie data structure."""
self.build()

View file

@ -10,7 +10,7 @@ from lldbsuite.test import lldbutil
class TestEarlyProcessLaunch(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIfAsan # rdar://103359354
# until this feature is included in the system
# debugserver.

View file

@ -34,18 +34,18 @@ from lldbsuite.test.gdbclientutils import (
class TestExpeditedStackMemory(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_no_packets_during_backtrace(self):
"""With the memory cache on, the backtrace sends no packets at all."""
self.check_packets_during_backtrace(disable_memory_cache=False)
@skipUnlessDarwin
@requireDarwin
def test_memory_reads_during_backtrace_without_cache(self):
"""With the memory cache off, the backtrace reads the backchain from the
stub, producing memory-read packets."""
self.check_packets_during_backtrace(disable_memory_cache=True)
@skipUnlessDarwin
@requireDarwin
def test_memory_reads_when_examining_frame0_locals(self):
"""Model an IDE stop: walk the whole stack (a backtrace / debug
navigator) but examine the locals of only the selected frame 0.
@ -54,7 +54,7 @@ class TestExpeditedStackMemory(TestBase):
heap memory."""
self.check_memory_reads_when_examining_locals(examine_all_frames=False)
@skipUnlessDarwin
@requireDarwin
def test_memory_reads_when_examining_all_frames_locals(self):
"""Model "view all frames": walk the whole stack and examine every
frame's locals. This reads the same variety of memory across several

View file

@ -12,7 +12,7 @@ file_index = 0
class TestExpeditedThreadPCs(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_expedited_thread_pcs(self):
TestBase.setUp(self)

View file

@ -15,7 +15,7 @@ class TestExtendedBacktraceAPI(TestBase):
TestBase.setUp(self)
self.main_source = "main.m"
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["objc", "pyapi"])
def test_extended_backtrace_thread_api(self):
"""Test GetExtendedBacktraceThread with queue debugging."""

View file

@ -9,7 +9,7 @@ import lldbsuite.test.lldbplatformutil as lldbplatformutil
from lldbsuite.test.lldbtest import *
@decorators.skipUnlessDarwin
@decorators.requireDarwin
class FindAppInMacOSAppBundle(TestBase):
NO_DEBUG_INFO_TESTCASE = True

View file

@ -26,7 +26,7 @@ class BundleWithDotInFilenameTestCase(TestBase):
TestBase.tearDown(self)
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
# This test is explicitly a dSYM test, it doesn't need to run for any other config.
@skipIf(debug_info=no_match(["dsym"]))
def test_attach_and_check_dsyms(self):

View file

@ -25,7 +25,7 @@ class DeepBundleTestCase(TestBase):
TestBase.tearDown(self)
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
# This test is explicitly a dSYM test, it doesn't need to run for any other config.
@skipIf(debug_info=no_match(["dsym"]))
def test_attach_and_check_dsyms(self):

View file

@ -4,7 +4,7 @@ from lldbsuite.test.lldbtest import *
class TestFunctionNameWithoutArgs(TestBase):
@skipUnlessDarwin
@requireDarwin
@no_debug_info_test
def test_function_name_without_args(self):
self.build()

View file

@ -16,7 +16,7 @@ class FunctionStartsTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
@skipIf(compiler="clang", compiler_version=["<", "13.0"])
def test_function_starts_binary(self):
"""Test that we make synthetic symbols when we have the binary."""
@ -24,7 +24,7 @@ class FunctionStartsTestCase(TestBase):
self.do_function_starts(False)
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
@skipIf(compiler="clang", compiler_version=["<", "13.0"])
def test_function_starts_no_binary(self):
"""Test that we make synthetic symbols when we don't have the binary"""

View file

@ -12,7 +12,7 @@ from lldbsuite.test.lldbtest import *
class TestDarwinSignalHandlers(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_ignored_thread(self):
"""It isn't possible to convert an EXC_BAD_ACCESS to a signal when
running under the debugger, which makes debugging SIGBUS handlers

View file

@ -14,7 +14,7 @@ class TestIndirectFunctions(TestBase):
# Find the line numbers that we will step to in main:
self.main_source = "main.c"
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
@skipIf(bugnumber="rdar://120796553")
def test_with_python_api(self):

View file

@ -13,7 +13,7 @@ from lldbsuite.test import lldbutil
class TestMetadataRegisters(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIfRemote
def test_add_registers_via_metadata(self):
self.build()

View file

@ -20,7 +20,7 @@ class TestAddrableBitsCorefile(TestBase):
self.corefile = self.getBuildArtifact("corefile")
@skipIf(archs=no_match(["arm64e"]))
@skipUnlessDarwin
@requireDarwin
def test_lc_note_addrable_bits(self):
self.initial_setup()

View file

@ -20,7 +20,7 @@ class TestFirmwareCorefiles(TestBase):
)
@skipIf(archs=no_match(["x86_64", "arm64", "arm64e", "aarch64"]))
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_lc_note_version_string(self):
self.build()
aout_exe_basename = "a.out"
@ -120,7 +120,7 @@ class TestFirmwareCorefiles(TestBase):
)
@skipIf(archs=no_match(["x86_64", "arm64", "arm64e", "aarch64"]))
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_lc_note_main_bin_spec(self):
self.build()
aout_exe_basename = "a.out"
@ -233,7 +233,7 @@ class TestFirmwareCorefiles(TestBase):
)
@skipIf(archs=no_match(["x86_64", "arm64", "arm64e", "aarch64"]))
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_lc_note_main_bin_spec_os_plugin(self):
self.build()
aout_exe = self.getBuildArtifact("a.out")

View file

@ -17,7 +17,7 @@ class TestKernVerStrLCNOTE(TestBase):
bugnumber="This test is looking explicitly for a dSYM",
)
@skipIf(archs=no_match(["x86_64"]))
@skipUnlessDarwin
@requireDarwin
def test_lc_note(self):
self.build()
self.test_exe = self.getBuildArtifact("a.out")

View file

@ -82,7 +82,7 @@ class TestMultipleBinaryCorefile(TestBase):
@skipIf(archs=no_match(["x86_64", "arm64", "arm64e", "aarch64"]))
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_corefile_binaries_dsymforuuid(self):
self.initial_setup()
@ -198,7 +198,7 @@ class TestMultipleBinaryCorefile(TestBase):
@skipIf(archs=no_match(["x86_64", "arm64", "arm64e", "aarch64"]))
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_corefile_binaries_preloaded(self):
self.initial_setup()

View file

@ -10,7 +10,7 @@ class TestMacCatalyst(TestBase):
SHARED_BUILD_TESTCASE = False
@skipIf(macos_version=["<", "10.15"])
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
def test_macabi(self):
"""Test the x86_64-apple-ios-macabi target linked against a macos dylib"""

View file

@ -7,7 +7,7 @@ import os
class TestMacCatalystAppWithMacOSFramework(TestBase):
@skipIf(macos_version=["<", "10.15"])
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
# There is a Clang driver change missing on llvm.org.
@expectedFailureAll(bugnumber="rdar://problem/54986190>")

View file

@ -11,7 +11,7 @@ import lldbsuite.test.cpu_feature as cpu_feature
exe_name = "uaf" # Must match Makefile
@skipIfWasm # memory tagging is a Darwin AArch64 feature
@requireNotWasm # memory tagging is a Darwin AArch64 feature
class TestDarwinMTE(TestBase):
SHARED_BUILD_TESTCASE = False
NO_DEBUG_INFO_TESTCASE = True

View file

@ -15,7 +15,7 @@ class NoNlistsTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
def test_no_nlist_symbols(self):
self.build()

View file

@ -120,7 +120,7 @@ class DarwinNSLogOutputTestCase(TestBase):
@skipIfAsan # avoid dealing with pexpect timeout flakyness on bots
@skipIf(oslist=["linux"], archs=["arm$", "aarch64"])
@skipUnlessDarwin
@requireDarwin
@skipIfRemote # this test is currently written using lldb commands & assumes running on local system
def test_nslog_output_is_displayed(self):
"""Test that NSLog() output shows up in the command-line debugger."""
@ -136,7 +136,7 @@ class DarwinNSLogOutputTestCase(TestBase):
@skipIfAsan # avoid dealing with pexpect timeout flakyness on bots
@skipIf(oslist=["linux"], archs=["arm$", "aarch64"])
@skipUnlessDarwin
@requireDarwin
@skipIfRemote # this test is currently written using lldb commands & assumes running on local system
def test_nslog_output_is_suppressed_with_env_var(self):
"""Test that NSLog() output does not show up with the ignore env var."""

View file

@ -11,14 +11,14 @@ from lldbsuite.test.lldbtest import *
class TestObjCRecognizer(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_exception_recognizer_sub_class(self):
"""There can be many tests in a test case - describe this test here."""
self.build()
self.main_source_file = lldb.SBFileSpec("main.m")
self.objc_recognizer_test(True)
@skipUnlessDarwin
@requireDarwin
def test_exception_recognizer_plain(self):
"""There can be many tests in a test case - describe this test here."""
self.build()

View file

@ -11,7 +11,7 @@ from lldbsuite.test import lldbutil
class OrderFileTestCase(TestBase):
@skipUnlessDarwin
@requireDarwin
def test(self):
"""Test debug symbols follow the correct order by the order file."""
self.build()

View file

@ -49,7 +49,7 @@ class TestLaunchProcessPosixSpawn(TestBase):
self.assertState(process.GetState(), lldb.eStateExited)
self.assertIn("slice: {}".format(arch), process.GetSTDOUT(1000))
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
@skipIfLLVMTargetMissing("AArch64")
@skipIfLLVMTargetMissing("X86")
@ -60,7 +60,7 @@ class TestLaunchProcessPosixSpawn(TestBase):
self.run_arch(exe, "x86_64")
self.run_arch(exe, "x86_64h")
@skipUnlessDarwin
@requireDarwin
@skipIf(bugnumber="rdar://170040996")
@skipIfDarwinEmbedded
@skipIfLLVMTargetMissing("AArch64")

View file

@ -18,7 +18,7 @@ import signal
class TestDetachVrsProfile(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIfRemote
def test_profile_and_detach(self):
"""There can be many tests in a test case - describe this test here."""

View file

@ -9,20 +9,20 @@ from lldbsuite.test import lldbutil
class TestQueues(TestBase):
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
def test_with_python_api_queues(self):
"""Test queues inspection SB APIs."""
self.build()
self.queues()
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
def test_queue_specific_breakpoints(self):
self.build()
self.queue_specific_breakpoints()
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
def test_with_python_api_queues_with_backtrace(self):
"""Test queues inspection SB APIs."""

View file

@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil
class TestSafeFuncCalls(TestBase):
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
def test_with_python_api(self):
"""Test function call thread safety."""

View file

@ -16,7 +16,7 @@ class TestSaveCrashlog(TestBase):
# each debug info format.
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_save_crashlog(self):
"""There can be many tests in a test case - describe this test here."""
self.build()

View file

@ -7,7 +7,7 @@ from lldbsuite.test import lldbutil
class SharedCacheHostMemoryTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@skipIfRemote
def test_host_lldb_memory(self):
"""Stop in a shared cache binary loaded from lldb's own memory and

View file

@ -14,7 +14,7 @@ class SharedCacheVMRangeTestCase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipIfRemote
@skipUnlessDarwin
@requireDarwin
@skipIfOutOfTreeDebugserver # debugserver returns shared_cache_size
def test_shared_cache_vm_range(self):
"""Test that the shared cache VM range contains a known libc function"""

View file

@ -99,7 +99,7 @@ class TestSimulatorPlatformLaunching(TestBase):
)
@skipIfAsan
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
@apple_simulator_test("iphone")
@skipIf(archs=["x86_64"])
@ -114,7 +114,7 @@ class TestSimulatorPlatformLaunching(TestBase):
)
@skipIfAsan
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
@apple_simulator_test("appletv")
@skipIf(archs=["x86_64"])

View file

@ -18,7 +18,7 @@ class TestSkinnyCorefile(TestBase):
debug_info=no_match(["dsym"]),
bugnumber="This test is looking explicitly for a dSYM",
)
@skipUnlessDarwin
@requireDarwin
@skipIfRemote
def test_lc_note(self):
self.build()

View file

@ -10,7 +10,7 @@ class TestSMERegistersDarwin(TestBase):
NO_DEBUG_INFO_TESTCASE = True
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@requireDarwin
@skipUnlessFeature(cpu_feature.AArch64.SME)
@skipUnlessFeature(cpu_feature.AArch64.SME2)
# thread_set_state/thread_get_state only avail in macOS 15.4+

View file

@ -12,7 +12,7 @@ from lldbsuite.test import lldbutil
class TestStackCorefile(TestBase):
@no_debug_info_test
@skipUnlessDarwin
@requireDarwin
@skipIfRemote
def test(self):
corefile = self.getBuildArtifact("process.core")

View file

@ -12,7 +12,7 @@ from lldbsuite.test.decorators import *
class TestMachExceptionData(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_exc_bad_access(self):
"""Test that we get type 1, code 1 and the right address for
a EXC_BAD_ACCESS mach exception."""

View file

@ -27,7 +27,7 @@ class TestTBIHonored(TestBase):
# This test is valid on AArch64 systems with TBI mode enabled,
# and an address mask that clears the top byte before reading
# from memory.
@skipUnlessDarwin
@requireDarwin
@skipIf(archs=no_match(["arm64", "arm64e"]))
@skipIfRemote
def test(self):

View file

@ -11,7 +11,7 @@ from lldbsuite.test import lldbutil
class TestInterruptThreadNames(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
@add_test_categories(["pyapi"])
def test_with_python_api(self):
"""Test that we get thread names when interrupting a process."""

View file

@ -8,7 +8,7 @@ from lldbsuite.test import lldbutil
class TestInterruptThreadNames(TestBase):
@skipUnlessDarwin
@requireDarwin
def test_internal_bps_resolved(self):
self.build()
@ -36,7 +36,7 @@ class TestInterruptThreadNames(TestBase):
num_resolved += bp.GetNumResolvedLocations()
self.assertGreater(num_resolved, 0)
@skipUnlessDarwin
@requireDarwin
def test_internal_bps_deleted_on_relaunch(self):
self.build()

View file

@ -12,7 +12,7 @@ from lldbsuite.test.lldbtest import *
class TestSuspendedThreadHandling(TestBase):
NO_DEBUG_INFO_TESTCASE = True
@skipUnlessDarwin
@requireDarwin
def test_suspended_threads(self):
"""Test that debugserver doesn't disturb the suspend count of a thread
that has been suspended from within a program, when navigating breakpoints

View file

@ -23,7 +23,7 @@ class UniversalTestCase(TestBase):
self.line = line_number("main.c", "// Set break point at this line.")
@add_test_categories(["pyapi"])
@skipUnlessDarwin
@requireDarwin
@unittest.skipUnless(
hasattr(os, "uname") and os.uname()[4] in ["x86_64"], "requires x86_64"
)
@ -49,7 +49,7 @@ class UniversalTestCase(TestBase):
process = target.LaunchSimple(None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
@skipUnlessDarwin
@requireDarwin
@unittest.skipUnless(
hasattr(os, "uname") and os.uname()[4] in ["x86_64"], "requires x86_64"
)
@ -112,7 +112,7 @@ class UniversalTestCase(TestBase):
self.expect("image list -A -b", substrs=["x86_64h testit"])
self.runCmd("continue")
@skipUnlessDarwin
@requireDarwin
@unittest.skipUnless(
hasattr(os, "uname") and os.uname()[4] in ["x86_64"], "requires x86_64"
)

View file

@ -20,7 +20,7 @@ class Universal64TestCase(TestBase):
# The Makefile manually invokes clang.
@skipIfLLVMTargetMissing("X86")
@skipIfAsan
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
def test_universal64_executable(self):
"""Test fat64 universal executable"""
@ -30,7 +30,7 @@ class Universal64TestCase(TestBase):
# The Makefile manually invokes clang.
@skipIfLLVMTargetMissing("X86")
@skipIfAsan
@skipUnlessDarwin
@requireDarwin
@skipIfDarwinEmbedded
def test_universal64_dsym(self):
"""Test fat64 universal dSYM"""

View file

@ -14,7 +14,7 @@ class TestUnregisteredMacho(TestBase):
# newer debugserver required for jGetLoadedDynamicLibrariesInfos
# to support this
@no_debug_info_test
@skipUnlessDarwin
@requireDarwin
def test(self):
self.build()
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(

View file

@ -61,7 +61,7 @@ class ConPTYTestCase(TestBase):
return process.GetSTDOUT(1 << 20)
@skipUnlessWindows
@requireWindows
@skipUnlessWindowsConPTY2022
@skipIf(oslist=["windows"], archs=["aarch64"], bugnumber="#194069")
def test_stdout_delivery(self):
@ -72,7 +72,7 @@ class ConPTYTestCase(TestBase):
output = self._strip_output(output)
self.assertIn("Hello from ConPTY\r\n", output)
@skipUnlessWindows
@requireWindows
@skipUnlessWindowsConPTY2022
@skipIf(oslist=["windows"], archs=["aarch64"], bugnumber="#194069")
def test_large_output(self):
@ -90,7 +90,7 @@ class ConPTYTestCase(TestBase):
for i, line in enumerate(output_lines):
self.assertEqual("line %04d" % i, line)
@skipUnlessWindows
@requireWindows
@skipUnlessWindowsConPTY
@skipIf(oslist=["windows"], archs=["aarch64"], bugnumber="#194069")
def test_basic_output_without_vt_check(self):
@ -107,7 +107,7 @@ class ConPTYTestCase(TestBase):
stripped = re.sub(r"\x1b\[[0-9;?]*[A-Za-z]", "", output)
self.assertIn("Hello from ConPTY", stripped)
@skipUnlessWindows
@requireWindows
@skipUnlessWindowsConPTY2022
@skipIf(oslist=["windows"], archs=["aarch64"], bugnumber="#194069")
def test_no_screen_clear_on_init(self):

Some files were not shown because too many files have changed in this diff Show more