[lld] d52d1b9 - [lld-macho] Downgrade version mismatch to warning

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 08:06:37 PDT 2021


Author: Jez Ng
Date: 2021-06-16T11:06:26-04:00
New Revision: d52d1b93c3f5666a2d324a3cd6f505ae1dfb469a

URL: https://github.com/llvm/llvm-project/commit/d52d1b93c3f5666a2d324a3cd6f505ae1dfb469a
DIFF: https://github.com/llvm/llvm-project/commit/d52d1b93c3f5666a2d324a3cd6f505ae1dfb469a.diff

LOG: [lld-macho] Downgrade version mismatch to warning

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

Added: 
    

Modified: 
    lld/MachO/InputFiles.cpp
    lld/test/MachO/invalid/incompatible-arch.s

Removed: 
    


################################################################################
diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index a70cfedbd9ba3..097cf6172e66f 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -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.

diff  --git a/lld/test/MachO/invalid/incompatible-arch.s b/lld/test/MachO/invalid/incompatible-arch.s
index 29bffebf350d4..4984c178ec7bc 100644
--- a/lld/test/MachO/invalid/incompatible-arch.s
+++ b/lld/test/MachO/invalid/incompatible-arch.s
@@ -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
 
@@ -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


        


More information about the llvm-commits mailing list