Skip to content

Commit d66d285

Browse files
committed
Switch to LLVM 11
1 parent f230e6b commit d66d285

File tree

190 files changed

+11676
-3260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+11676
-3260
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ set(TARGET_Hexagon HexagonCodeGen HexagonAsmParser HexagonDesc HexagonInfo)
3838
set(TARGET_BPF BPFCodeGen BPFAsmParser BPFDesc BPFInfo)
3939
set(TARGET_ARM ARMCodeGen ARMAsmParser ARMDesc ARMUtils ARMInfo)
4040
set(TARGET_AMDGPU AMDGPUCodeGen AMDGPUAsmParser AMDGPUDesc AMDGPUUtils AMDGPUInfo)
41-
set(TARGET_X86 X86CodeGen X86AsmParser X86Desc X86Utils X86Info)
41+
set(TARGET_X86 X86CodeGen X86AsmParser X86Desc X86Info)
4242
set(TARGET_AArch64 AArch64CodeGen AArch64AsmParser AArch64Desc AArch64Utils AArch64Info)
4343

4444
set(TARGETS_TO_BUILD "WebAssembly" "XCore" "SystemZ" "Sparc" "RISCV" "PowerPC" "NVPTX" "MSP430" "Mips" "Lanai" "Hexagon" "BPF" "ARM" "AMDGPU" "X86" "AArch64")

include/Sand/Type.hpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,10 @@ class Type : public Name
410410
{
411411
return Type::equals(left_ptr->getElementType(), right_ptr->getElementType());
412412
}
413-
else if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
414-
{
415-
return Type::equals(left_ptr->getElementType(), right_sequential->getElementType());
416-
}
413+
// else if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
414+
// {
415+
// return Type::equals(left_ptr->getElementType(), right_sequential->getElementType());
416+
// }
417417

418418
return false;
419419

@@ -461,20 +461,19 @@ class Type : public Name
461461
}
462462

463463
case llvm::Type::ArrayTyID:
464-
case llvm::Type::VectorTyID:
465464
{
466-
auto left_sequential = llvm::cast<llvm::SequentialType>(left);
465+
auto left_array = llvm::cast<llvm::ArrayType>(left);
467466

468-
if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
467+
if (auto right_array = llvm::dyn_cast<llvm::ArrayType>(right))
469468
{
470-
if (left_sequential->getNumElements() != right_sequential->getNumElements())
469+
if (left_array->getNumElements() != right_array->getNumElements())
471470
return false;
472471

473-
return Type::equals(left_sequential->getElementType(), right_sequential->getElementType());
472+
return Type::equals(left_array->getElementType(), right_array->getElementType());
474473
}
475474
else if (auto right_pointer = llvm::dyn_cast<llvm::PointerType>(right))
476475
{
477-
return Type::equals(left_sequential->getElementType(), right_pointer->getElementType());
476+
return Type::equals(left_array->getElementType(), right_pointer->getElementType());
478477
}
479478

480479
return false;

libs/lld/.arcconfig

Lines changed: 0 additions & 4 deletions
This file was deleted.

libs/lld/.clang-tidy

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
2+
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
3+
CheckOptions:
4+
- key: readability-identifier-naming.ClassCase
5+
value: CamelCase
6+
- key: readability-identifier-naming.EnumCase
7+
value: CamelCase
8+
- key: readability-identifier-naming.FunctionCase
9+
value: camelBack
10+
- key: readability-identifier-naming.MemberCase
11+
value: camelBack
12+
- key: readability-identifier-naming.ParameterCase
13+
value: camelBack
14+
- key: readability-identifier-naming.UnionCase
15+
value: CamelCase
16+
- key: readability-identifier-naming.VariableCase
17+
value: camelBack
18+
- key: readability-identifier-naming.IgnoreMainLikeFunctions
19+
value: 1

libs/lld/CMakeLists.txt

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,38 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
5656
include(HandleLLVMOptions)
5757

5858
if(LLVM_INCLUDE_TESTS)
59-
include(FindPythonInterp)
60-
if(NOT PYTHONINTERP_FOUND)
61-
message(FATAL_ERROR
62-
"Unable to find Python interpreter, required for testing.
59+
if(CMAKE_VERSION VERSION_LESS 3.12)
60+
include(FindPythonInterp)
61+
if(NOT PYTHONINTERP_FOUND)
62+
message(FATAL_ERROR
63+
"Unable to find Python interpreter, required for testing.
6364
64-
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
65-
endif()
65+
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
66+
endif()
67+
68+
if(${PYTHON_VERSION_STRING} VERSION_LESS 2.7)
69+
message(FATAL_ERROR "Python 2.7 or newer is required")
70+
endif()
6671

67-
if(${PYTHON_VERSION_STRING} VERSION_LESS 2.7)
68-
message(FATAL_ERROR "Python 2.7 or newer is required")
72+
add_executable(Python3::Interpeter IMPORTED)
73+
set_target_properties(Python3::Interpreter PROPERTIES
74+
IMPORTED_LOCATION ${PYTHON_EXECUTABLE})
75+
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
76+
else()
77+
find_package(Python3 COMPONENTS Interpreter)
78+
if(NOT Python3_Interpreter_FOUND)
79+
message(WARNING "Python3 not found, using python2 as a fallback")
80+
find_package(Python2 COMPONENTS Interpreter REQUIRED)
81+
if(Python2_VERSION VERSION_LESS 2.7)
82+
message(SEND_ERROR "Python 2.7 or newer is required")
83+
endif()
84+
85+
# Treat python2 as python3
86+
add_executable(Python3::Interpreter IMPORTED)
87+
set_target_properties(Python3::Interpreter PROPERTIES
88+
IMPORTED_LOCATION ${Python2_EXECUTABLE})
89+
set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
90+
endif()
6991
endif()
7092

7193
# Check prebuilt llvm/utils.
@@ -120,6 +142,13 @@ set(LLD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
120142
set(LLD_INCLUDE_DIR ${LLD_SOURCE_DIR}/include )
121143
set(LLD_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
122144

145+
set(LLD_VENDOR ${PACKAGE_VENDOR} CACHE STRING
146+
"Vendor-specific text for showing with version information.")
147+
148+
if(LLD_VENDOR)
149+
add_definitions(-DLLD_VENDOR="${LLD_VENDOR}")
150+
endif()
151+
123152
# Compute the LLD version from the LLVM version.
124153
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLD_VERSION
125154
${PACKAGE_VERSION})
@@ -130,33 +159,6 @@ string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" LLD_VERSION_MAJOR
130159
string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" LLD_VERSION_MINOR
131160
${LLD_VERSION})
132161

133-
# Determine LLD revision and repository.
134-
# TODO: Figure out a way to get the revision and the repository on windows.
135-
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
136-
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLD_SOURCE_DIR}
137-
OUTPUT_VARIABLE LLD_REVISION)
138-
139-
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLD_SOURCE_DIR}
140-
OUTPUT_VARIABLE LLD_REPOSITORY)
141-
if ( LLD_REPOSITORY )
142-
# Replace newline characters with spaces
143-
string(REGEX REPLACE "(\r?\n)+" " " LLD_REPOSITORY ${LLD_REPOSITORY})
144-
# Remove leading spaces
145-
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REPOSITORY "${LLD_REPOSITORY}" )
146-
# Remove trailing spaces
147-
string(REGEX REPLACE "(\ )+$" "" LLD_REPOSITORY ${LLD_REPOSITORY})
148-
endif()
149-
150-
if ( LLD_REVISION )
151-
# Replace newline characters with spaces
152-
string(REGEX REPLACE "(\r?\n)+" " " LLD_REVISION ${LLD_REVISION})
153-
# Remove leading spaces
154-
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REVISION "${LLD_REVISION}" )
155-
# Remove trailing spaces
156-
string(REGEX REPLACE "(\ )+$" "" LLD_REVISION ${LLD_REVISION})
157-
endif()
158-
endif ()
159-
160162
# Configure the Version.inc file.
161163
configure_file(
162164
${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Common/Version.inc.in
@@ -221,5 +223,8 @@ add_subdirectory(lib)
221223
# add_subdirectory(docs)
222224
add_subdirectory(COFF)
223225
add_subdirectory(ELF)
226+
add_subdirectory(MachO)
224227
add_subdirectory(MinGW)
225228
add_subdirectory(wasm)
229+
230+
add_subdirectory(cmake/modules)

libs/lld/COFF/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_lld_library(lldCOFF
1414
DriverUtils.cpp
1515
ICF.cpp
1616
InputFiles.cpp
17+
LLDMapFile.cpp
1718
LTO.cpp
1819
MapFile.cpp
1920
MarkLive.cpp

libs/lld/COFF/Chunks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static void maybeReportRelocationToDiscarded(const SectionChunk *fromChunk,
333333
} else {
334334
COFFSymbolRef coffSym =
335335
check(file->getCOFFObj()->getSymbol(rel.SymbolTableIndex));
336-
file->getCOFFObj()->getSymbolName(coffSym, name);
336+
name = check(file->getCOFFObj()->getSymbolName(coffSym));
337337
}
338338

339339
std::vector<std::string> symbolLocations =

libs/lld/COFF/Chunks.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ class SectionChunk final : public Chunk {
269269
AssociatedIterator() = default;
270270
AssociatedIterator(SectionChunk *head) : cur(head) {}
271271
bool operator==(const AssociatedIterator &r) const { return cur == r.cur; }
272-
const SectionChunk &operator*() const { return *cur; }
272+
// FIXME: Wrong const-ness, but it makes filter ranges work.
273+
SectionChunk &operator*() const { return *cur; }
273274
SectionChunk &operator*() { return *cur; }
274275
AssociatedIterator &operator++() {
275276
cur = cur->assocChildren;

libs/lld/COFF/Config.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ struct Configuration {
110110
bool showSummary = false;
111111
unsigned debugTypes = static_cast<unsigned>(DebugType::None);
112112
std::vector<std::string> natvisFiles;
113+
llvm::StringMap<std::string> namedStreams;
113114
llvm::SmallString<128> pdbAltPath;
114115
llvm::SmallString<128> pdbPath;
115116
llvm::SmallString<128> pdbSourcePath;
@@ -139,12 +140,13 @@ struct Configuration {
139140
bool safeSEH = false;
140141
Symbol *sehTable = nullptr;
141142
Symbol *sehCount = nullptr;
143+
bool noSEH = false;
142144

143145
// Used for /opt:lldlto=N
144146
unsigned ltoo = 2;
145147

146148
// Used for /opt:lldltojobs=N
147-
unsigned thinLTOJobs = 0;
149+
std::string thinLTOJobs;
148150
// Used for /opt:lldltopartitions=N
149151
unsigned ltoPartitions = 1;
150152

@@ -182,6 +184,9 @@ struct Configuration {
182184
llvm::StringMap<int> order;
183185

184186
// Used for /lldmap.
187+
std::string lldmapFile;
188+
189+
// Used for /map.
185190
std::string mapFile;
186191

187192
// Used for /thinlto-index-only:
@@ -211,6 +216,7 @@ struct Configuration {
211216
uint32_t functionPadMin = 0;
212217
bool dynamicBase = true;
213218
bool allowBind = true;
219+
bool cetCompat = false;
214220
bool nxCompat = true;
215221
bool allowIsolation = true;
216222
bool terminalServerAware = true;
@@ -230,6 +236,8 @@ struct Configuration {
230236
bool swaprunNet = false;
231237
bool thinLTOEmitImportsFiles;
232238
bool thinLTOIndexOnly;
239+
bool autoImport = false;
240+
bool pseudoRelocs = false;
233241
};
234242

235243
extern Configuration *config;

0 commit comments

Comments
 (0)