Skip to content

Commit

Permalink
[lld-macho] Downgrade version mismatch to warning
Browse files Browse the repository at this point in the history
It's a warning in ld64. While having LLD be stricter would be nice, it
makes it harder for it to be a drop-in replacement into existing builds.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D104333
  • Loading branch information
int3 committed Jun 16, 2021
1 parent 2a936be commit d52d1b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 5 additions & 6 deletions lld/MachO/InputFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,12 @@ static bool checkCompatibility(const InputFile *input) {
return false;
}

if (it->minimum <= config->platformInfo.minimum)
return true;
if (it->minimum > config->platformInfo.minimum)
warn(toString(input) + " has version " + it->minimum.getAsString() +
", which is newer than target minimum of " +
config->platformInfo.minimum.getAsString());

error(toString(input) + " has version " + it->minimum.getAsString() +
", which is newer than target minimum of " +
config->platformInfo.minimum.getAsString());
return false;
return true;
}

// Open a given file path and return it as a memory-mapped file.
Expand Down
8 changes: 4 additions & 4 deletions lld/test/MachO/invalid/incompatible-arch.s
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

# RUN: %lld -lSystem -dylib -arch arm64 -platform_version macOS 10.14.0 10.15.0 %t/out.dylib -o /dev/null

# RUN: not %lld -lSystem -dylib -arch arm64 -platform_version macOS 10.13.0 10.15.0 %t/out.dylib \
# RUN: %no_fatal_warnings_lld -lSystem -dylib -arch arm64 -platform_version macOS 10.13.0 10.15.0 %t/out.dylib \
# RUN: -o /dev/null 2>&1 | FileCheck %s --check-prefix=DYLIB-VERSION
# DYLIB-VERSION: {{.*}}out.dylib has version 10.14.0, which is newer than target minimum of 10.13.0
# DYLIB-VERSION: warning: {{.*}}out.dylib has version 10.14.0, which is newer than target minimum of 10.13.0

# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15.0 %s -o %t/test_x86.o

Expand All @@ -26,9 +26,9 @@

# RUN: %lld %t/test_x86.o -lSystem -arch x86_64 -platform_version macOS 10.15.0 10.15.0 -o /dev/null

# RUN: not %lld %t/test_x86.o -lSystem -arch x86_64 -platform_version macOS 10.14.0 10.15.0 \
# RUN: %no_fatal_warnings_lld %t/test_x86.o -lSystem -arch x86_64 -platform_version macOS 10.14.0 10.15.0 \
# RUN: -o /dev/null 2>&1 | FileCheck %s --check-prefix=OBJ-VERSION
# OBJ-VERSION: {{.*}}test_x86.o has version 10.15.0, which is newer than target minimum of 10.14.0
# OBJ-VERSION: warning: {{.*}}test_x86.o has version 10.15.0, which is newer than target minimum of 10.14.0

## Test that simulators platforms are compat with their simulatees.
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-ios14.0 %s -o %t/test_x86_ios.o
Expand Down

0 comments on commit d52d1b9

Please sign in to comment.