[PATCH] D71219: Fix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift and Objective-C bitcode

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 9 14:01:22 PST 2019


dexonsmith added reviewers: ahatanak, steven_wu.
dexonsmith added inline comments.


================
Comment at: llvm/lib/Linker/IRMover.cpp:1277-1282
     // If either flag has override behavior, handle it first.
     if (DstBehaviorValue == Module::Override) {
       // Diagnose inconsistent flags which both have override behavior.
       if (SrcBehaviorValue == Module::Override &&
-          SrcOp->getOperand(2) != DstOp->getOperand(2))
+          SrcOp->getOperand(2) != DstOp->getOperand(2)) {
+        if (ID->getString().equals("Objective-C Garbage Collection")) {
----------------
The use case you have sounds great, but I disagree with specializing module flag logic for specific keys.  Module flags are meant to be generic ways of enforcing rules.

- If Swift is emitting a value that's incompatible with the value Clang is emitting but the IR is compatible, then at least one of them needs to change what value they're emitting for this flag so that the normal module flags semantics work.
- If the IR that Swift and Clang emit is *not* compatible, then that has to be fixed first.
- If we need support for old, archived bitcode getting merged with new bitcode from one of the compilers (I doubt we do, but maybe?), then we can figure out a scheme for some upgrade logic.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71219/new/

https://reviews.llvm.org/D71219





More information about the llvm-commits mailing list