Skip to content

Commit

Permalink
Switch to LLVM 11
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumsheep committed Aug 10, 2020
1 parent f230e6b commit 6090ff5
Show file tree
Hide file tree
Showing 190 changed files with 11,676 additions and 3,260 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(TARGET_Hexagon HexagonCodeGen HexagonAsmParser HexagonDesc HexagonInfo)
set(TARGET_BPF BPFCodeGen BPFAsmParser BPFDesc BPFInfo)
set(TARGET_ARM ARMCodeGen ARMAsmParser ARMDesc ARMUtils ARMInfo)
set(TARGET_AMDGPU AMDGPUCodeGen AMDGPUAsmParser AMDGPUDesc AMDGPUUtils AMDGPUInfo)
set(TARGET_X86 X86CodeGen X86AsmParser X86Desc X86Utils X86Info)
set(TARGET_X86 X86CodeGen X86AsmParser X86Desc X86Info)
set(TARGET_AArch64 AArch64CodeGen AArch64AsmParser AArch64Desc AArch64Utils AArch64Info)

set(TARGETS_TO_BUILD "WebAssembly" "XCore" "SystemZ" "Sparc" "RISCV" "PowerPC" "NVPTX" "MSP430" "Mips" "Lanai" "Hexagon" "BPF" "ARM" "AMDGPU" "X86" "AArch64")
Expand Down
19 changes: 9 additions & 10 deletions include/Sand/Type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ class Type : public Name
{
return Type::equals(left_ptr->getElementType(), right_ptr->getElementType());
}
else if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
{
return Type::equals(left_ptr->getElementType(), right_sequential->getElementType());
}
// else if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
// {
// return Type::equals(left_ptr->getElementType(), right_sequential->getElementType());
// }

return false;

Expand Down Expand Up @@ -461,20 +461,19 @@ class Type : public Name
}

case llvm::Type::ArrayTyID:
case llvm::Type::VectorTyID:
{
auto left_sequential = llvm::cast<llvm::SequentialType>(left);
auto left_array = llvm::cast<llvm::ArrayType>(left);

if (auto right_sequential = llvm::dyn_cast<llvm::SequentialType>(right))
if (auto right_array = llvm::dyn_cast<llvm::ArrayType>(right))
{
if (left_sequential->getNumElements() != right_sequential->getNumElements())
if (left_array->getNumElements() != right_array->getNumElements())
return false;

return Type::equals(left_sequential->getElementType(), right_sequential->getElementType());
return Type::equals(left_array->getElementType(), right_array->getElementType());
}
else if (auto right_pointer = llvm::dyn_cast<llvm::PointerType>(right))
{
return Type::equals(left_sequential->getElementType(), right_pointer->getElementType());
return Type::equals(left_array->getElementType(), right_pointer->getElementType());
}

return false;
Expand Down
4 changes: 0 additions & 4 deletions libs/lld/.arcconfig

This file was deleted.

19 changes: 19 additions & 0 deletions libs/lld/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Almost identical to the top-level .clang-tidy, except that {Member,Parameter,Variable}Case use camelBack.
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,readability-identifier-naming'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.MemberCase
value: camelBack
- key: readability-identifier-naming.ParameterCase
value: camelBack
- key: readability-identifier-naming.UnionCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: camelBack
- key: readability-identifier-naming.IgnoreMainLikeFunctions
value: 1
75 changes: 40 additions & 35 deletions libs/lld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,38 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include(HandleLLVMOptions)

if(LLVM_INCLUDE_TESTS)
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
"Unable to find Python interpreter, required for testing.
if(CMAKE_VERSION VERSION_LESS 3.12)
include(FindPythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR
"Unable to find Python interpreter, required for testing.
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()
Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
endif()

if(${PYTHON_VERSION_STRING} VERSION_LESS 2.7)
message(FATAL_ERROR "Python 2.7 or newer is required")
endif()

if(${PYTHON_VERSION_STRING} VERSION_LESS 2.7)
message(FATAL_ERROR "Python 2.7 or newer is required")
add_executable(Python3::Interpeter IMPORTED)
set_target_properties(Python3::Interpreter PROPERTIES
IMPORTED_LOCATION ${PYTHON_EXECUTABLE})
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
else()
find_package(Python3 COMPONENTS Interpreter)
if(NOT Python3_Interpreter_FOUND)
message(WARNING "Python3 not found, using python2 as a fallback")
find_package(Python2 COMPONENTS Interpreter REQUIRED)
if(Python2_VERSION VERSION_LESS 2.7)
message(SEND_ERROR "Python 2.7 or newer is required")
endif()

# Treat python2 as python3
add_executable(Python3::Interpreter IMPORTED)
set_target_properties(Python3::Interpreter PROPERTIES
IMPORTED_LOCATION ${Python2_EXECUTABLE})
set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
endif()
endif()

# Check prebuilt llvm/utils.
Expand Down Expand Up @@ -120,6 +142,13 @@ set(LLD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(LLD_INCLUDE_DIR ${LLD_SOURCE_DIR}/include )
set(LLD_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

set(LLD_VENDOR ${PACKAGE_VENDOR} CACHE STRING
"Vendor-specific text for showing with version information.")

if(LLD_VENDOR)
add_definitions(-DLLD_VENDOR="${LLD_VENDOR}")
endif()

# Compute the LLD version from the LLVM version.
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLD_VERSION
${PACKAGE_VERSION})
Expand All @@ -130,33 +159,6 @@ string(REGEX REPLACE "([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" LLD_VERSION_MAJOR
string(REGEX REPLACE "[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" LLD_VERSION_MINOR
${LLD_VERSION})

# Determine LLD revision and repository.
# TODO: Figure out a way to get the revision and the repository on windows.
if ( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetSourceVersion ${LLD_SOURCE_DIR}
OUTPUT_VARIABLE LLD_REVISION)

execute_process(COMMAND ${CMAKE_SOURCE_DIR}/utils/GetRepositoryPath ${LLD_SOURCE_DIR}
OUTPUT_VARIABLE LLD_REPOSITORY)
if ( LLD_REPOSITORY )
# Replace newline characters with spaces
string(REGEX REPLACE "(\r?\n)+" " " LLD_REPOSITORY ${LLD_REPOSITORY})
# Remove leading spaces
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REPOSITORY "${LLD_REPOSITORY}" )
# Remove trailing spaces
string(REGEX REPLACE "(\ )+$" "" LLD_REPOSITORY ${LLD_REPOSITORY})
endif()

if ( LLD_REVISION )
# Replace newline characters with spaces
string(REGEX REPLACE "(\r?\n)+" " " LLD_REVISION ${LLD_REVISION})
# Remove leading spaces
STRING(REGEX REPLACE "^[ \t\r\n]+" "" LLD_REVISION "${LLD_REVISION}" )
# Remove trailing spaces
string(REGEX REPLACE "(\ )+$" "" LLD_REVISION ${LLD_REVISION})
endif()
endif ()

# Configure the Version.inc file.
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/lld/Common/Version.inc.in
Expand Down Expand Up @@ -221,5 +223,8 @@ add_subdirectory(lib)
# add_subdirectory(docs)
add_subdirectory(COFF)
add_subdirectory(ELF)
add_subdirectory(MachO)
add_subdirectory(MinGW)
add_subdirectory(wasm)

add_subdirectory(cmake/modules)
1 change: 1 addition & 0 deletions libs/lld/COFF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ add_lld_library(lldCOFF
DriverUtils.cpp
ICF.cpp
InputFiles.cpp
LLDMapFile.cpp
LTO.cpp
MapFile.cpp
MarkLive.cpp
Expand Down
2 changes: 1 addition & 1 deletion libs/lld/COFF/Chunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ static void maybeReportRelocationToDiscarded(const SectionChunk *fromChunk,
} else {
COFFSymbolRef coffSym =
check(file->getCOFFObj()->getSymbol(rel.SymbolTableIndex));
file->getCOFFObj()->getSymbolName(coffSym, name);
name = check(file->getCOFFObj()->getSymbolName(coffSym));
}

std::vector<std::string> symbolLocations =
Expand Down
3 changes: 2 additions & 1 deletion libs/lld/COFF/Chunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ class SectionChunk final : public Chunk {
AssociatedIterator() = default;
AssociatedIterator(SectionChunk *head) : cur(head) {}
bool operator==(const AssociatedIterator &r) const { return cur == r.cur; }
const SectionChunk &operator*() const { return *cur; }
// FIXME: Wrong const-ness, but it makes filter ranges work.
SectionChunk &operator*() const { return *cur; }
SectionChunk &operator*() { return *cur; }
AssociatedIterator &operator++() {
cur = cur->assocChildren;
Expand Down
10 changes: 9 additions & 1 deletion libs/lld/COFF/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ struct Configuration {
bool showSummary = false;
unsigned debugTypes = static_cast<unsigned>(DebugType::None);
std::vector<std::string> natvisFiles;
llvm::StringMap<std::string> namedStreams;
llvm::SmallString<128> pdbAltPath;
llvm::SmallString<128> pdbPath;
llvm::SmallString<128> pdbSourcePath;
Expand Down Expand Up @@ -139,12 +140,13 @@ struct Configuration {
bool safeSEH = false;
Symbol *sehTable = nullptr;
Symbol *sehCount = nullptr;
bool noSEH = false;

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

// Used for /opt:lldltojobs=N
unsigned thinLTOJobs = 0;
std::string thinLTOJobs;
// Used for /opt:lldltopartitions=N
unsigned ltoPartitions = 1;

Expand Down Expand Up @@ -182,6 +184,9 @@ struct Configuration {
llvm::StringMap<int> order;

// Used for /lldmap.
std::string lldmapFile;

// Used for /map.
std::string mapFile;

// Used for /thinlto-index-only:
Expand Down Expand Up @@ -211,6 +216,7 @@ struct Configuration {
uint32_t functionPadMin = 0;
bool dynamicBase = true;
bool allowBind = true;
bool cetCompat = false;
bool nxCompat = true;
bool allowIsolation = true;
bool terminalServerAware = true;
Expand All @@ -230,6 +236,8 @@ struct Configuration {
bool swaprunNet = false;
bool thinLTOEmitImportsFiles;
bool thinLTOIndexOnly;
bool autoImport = false;
bool pseudoRelocs = false;
};

extern Configuration *config;
Expand Down
Loading

0 comments on commit 6090ff5

Please sign in to comment.