mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Bitcode: Don't create comdats when autoupgrading macho bitcode
Don't infer COMDAT groups from older bitcode if the target is macho, it doesn't have COMDATs. llvm-svn: 226546
This commit is contained in:
parent
4c09531400
commit
4556f4a8ee
@ -11,6 +11,7 @@
|
||||
#include "BitcodeReader.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
#include "llvm/Bitcode/LLVMBitCodes.h"
|
||||
#include "llvm/IR/AutoUpgrade.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
@ -1106,6 +1107,8 @@ std::error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
|
||||
SmallVector<uint64_t, 64> Record;
|
||||
|
||||
Triple TT(TheModule->getTargetTriple());
|
||||
|
||||
// Read all the records for this value table.
|
||||
SmallString<128> ValueName;
|
||||
while (1) {
|
||||
@ -1137,8 +1140,12 @@ std::error_code BitcodeReader::ParseValueSymbolTable() {
|
||||
|
||||
V->setName(StringRef(ValueName.data(), ValueName.size()));
|
||||
if (auto *GO = dyn_cast<GlobalObject>(V)) {
|
||||
if (GO->getComdat() == reinterpret_cast<Comdat *>(1))
|
||||
GO->setComdat(TheModule->getOrInsertComdat(V->getName()));
|
||||
if (GO->getComdat() == reinterpret_cast<Comdat *>(1)) {
|
||||
if (TT.isOSBinFormatMachO())
|
||||
GO->setComdat(nullptr);
|
||||
else
|
||||
GO->setComdat(TheModule->getOrInsertComdat(V->getName()));
|
||||
}
|
||||
}
|
||||
ValueName.clear();
|
||||
break;
|
||||
|
11
test/Bitcode/weak-macho-3.5.ll
Normal file
11
test/Bitcode/weak-macho-3.5.ll
Normal file
@ -0,0 +1,11 @@
|
||||
; RUN: llvm-dis < %s.bc| FileCheck %s
|
||||
|
||||
; weak-macho-3.5.ll.bc was generated by passing this file to llvm-as-3.5
|
||||
; The test checks that LLVM does not place weak GlobalVariables into Comdats for
|
||||
; macho object files, they don't support it.
|
||||
|
||||
target triple = "x86_64-apple-macosx10.9.0"
|
||||
; CHECK: target triple = "x86_64-apple-macosx10.9.0"
|
||||
|
||||
@x = weak global i32 0
|
||||
; CHECK: @x = weak global i32 0{{$}}
|
BIN
test/Bitcode/weak-macho-3.5.ll.bc
Normal file
BIN
test/Bitcode/weak-macho-3.5.ll.bc
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user