Skip to content

Commit

Permalink
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Browse files Browse the repository at this point in the history
release/11.x llvmorg-11.0.0-rc2-0-g414f32a9e86.

MFC after:	6 weeks
X-MFC-With:	r364284
  • Loading branch information
DimitryAndric committed Aug 24, 2020
1 parent cc4819e commit fed189f
Show file tree
Hide file tree
Showing 35 changed files with 367 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class TargetOptions {
/// be a list of strings starting with by '+' or '-'.
std::vector<std::string> Features;

/// The map of which features have been enabled disabled based on the command
/// line.
llvm::StringMap<bool> FeatureMap;

/// Supported OpenCL extensions and optional core features.
OpenCLOptions SupportedOpenCLOptions;

Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1780,7 +1780,7 @@ def fstack_protector_all : Flag<["-"], "fstack-protector-all">, Group<f_Group>,
HelpText<"Enable stack protectors for all functions">;
def fstack_clash_protection : Flag<["-"], "fstack-clash-protection">, Group<f_Group>, Flags<[CC1Option]>,
HelpText<"Enable stack clash protection">;
def fnostack_clash_protection : Flag<["-"], "fnostack-clash-protection">, Group<f_Group>,
def fno_stack_clash_protection : Flag<["-"], "fno-stack-clash-protection">, Group<f_Group>,
HelpText<"Disable stack clash protection">;
def fstack_protector_strong : Flag<["-"], "fstack-protector-strong">, Group<f_Group>,
HelpText<"Enable stack protectors for some functions vulnerable to stack smashing. "
Expand Down
3 changes: 1 addition & 2 deletions contrib/llvm-project/clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11147,8 +11147,7 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap<bool> &FeatureMap,
std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU, Features);
} else {
Target->initFeatureMap(FeatureMap, getDiagnostics(), TargetCPU,
Target->getTargetOpts().Features);
FeatureMap = Target->getTargetOpts().FeatureMap;
}
}

Expand Down
11 changes: 8 additions & 3 deletions contrib/llvm-project/clang/lib/Basic/Targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new FreeBSDTargetInfo<PPC64TargetInfo>(Triple, Opts);
case llvm::Triple::NetBSD:
return new NetBSDTargetInfo<PPC64TargetInfo>(Triple, Opts);
case llvm::Triple::OpenBSD:
return new OpenBSDTargetInfo<PPC64TargetInfo>(Triple, Opts);
case llvm::Triple::AIX:
return new AIXPPC64TargetInfo(Triple, Opts);
default:
Expand All @@ -358,6 +360,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
return new LinuxTargetInfo<PPC64TargetInfo>(Triple, Opts);
case llvm::Triple::NetBSD:
return new NetBSDTargetInfo<PPC64TargetInfo>(Triple, Opts);
case llvm::Triple::OpenBSD:
return new OpenBSDTargetInfo<PPC64TargetInfo>(Triple, Opts);
default:
return new PPC64TargetInfo(Triple, Opts);
}
Expand Down Expand Up @@ -387,6 +391,8 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
switch (os) {
case llvm::Triple::FreeBSD:
return new FreeBSDTargetInfo<RISCV64TargetInfo>(Triple, Opts);
case llvm::Triple::OpenBSD:
return new OpenBSDTargetInfo<RISCV64TargetInfo>(Triple, Opts);
case llvm::Triple::Fuchsia:
return new FuchsiaTargetInfo<RISCV64TargetInfo>(Triple, Opts);
case llvm::Triple::Linux:
Expand Down Expand Up @@ -662,14 +668,13 @@ TargetInfo::CreateTargetInfo(DiagnosticsEngine &Diags,

// Compute the default target features, we need the target to handle this
// because features may have dependencies on one another.
llvm::StringMap<bool> Features;
if (!Target->initFeatureMap(Features, Diags, Opts->CPU,
if (!Target->initFeatureMap(Opts->FeatureMap, Diags, Opts->CPU,
Opts->FeaturesAsWritten))
return nullptr;

// Add the features to the compile options.
Opts->Features.clear();
for (const auto &F : Features)
for (const auto &F : Opts->FeatureMap)
Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str());
// Sort here, so we handle the features in a predictable order. (This matters
// when we're dealing with features that overlap.)
Expand Down
5 changes: 5 additions & 0 deletions contrib/llvm-project/clang/lib/Basic/Targets/OSTargets.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo<Target> {
public:
OpenBSDTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
this->WCharType = this->WIntType = this->SignedInt;
this->IntMaxType = TargetInfo::SignedLongLong;
this->Int64Type = TargetInfo::SignedLongLong;
switch (Triple.getArch()) {
case llvm::Triple::x86:
case llvm::Triple::x86_64:
Expand All @@ -476,6 +479,8 @@ class LLVM_LIBRARY_VISIBILITY OpenBSDTargetInfo : public OSTargetInfo<Target> {
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
case llvm::Triple::ppc:
case llvm::Triple::ppc64:
case llvm::Triple::ppc64le:
case llvm::Triple::sparcv9:
this->MCountName = "_mcount";
break;
Expand Down
4 changes: 2 additions & 2 deletions contrib/llvm-project/clang/lib/Basic/Targets/PPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public PPCTargetInfo {
ABI = "elfv1";
}

if (Triple.isOSFreeBSD() || Triple.getOS() == llvm::Triple::AIX ||
Triple.isMusl()) {
if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
Triple.getOS() == llvm::Triple::AIX || Triple.isMusl()) {
LongDoubleWidth = LongDoubleAlign = 64;
LongDoubleFormat = &llvm::APFloat::IEEEdouble();
}
Expand Down
5 changes: 5 additions & 0 deletions contrib/llvm-project/clang/lib/Basic/Targets/Sparc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ void SparcV9TargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__sparc_v9__");
Builder.defineMacro("__sparcv9__");
}

Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
}

void SparcV9TargetInfo::fillValidCPUList(
Expand Down
60 changes: 31 additions & 29 deletions contrib/llvm-project/clang/lib/Basic/Targets/WebAssembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,43 @@ void WebAssemblyTargetInfo::getTargetDefines(const LangOptions &Opts,
}

void WebAssemblyTargetInfo::setSIMDLevel(llvm::StringMap<bool> &Features,
SIMDEnum Level) {
SIMDEnum Level, bool Enabled) {
if (Enabled) {
switch (Level) {
case UnimplementedSIMD128:
Features["unimplemented-simd128"] = true;
LLVM_FALLTHROUGH;
case SIMD128:
Features["simd128"] = true;
LLVM_FALLTHROUGH;
case NoSIMD:
break;
}
return;
}

switch (Level) {
case UnimplementedSIMD128:
Features["unimplemented-simd128"] = true;
LLVM_FALLTHROUGH;
case NoSIMD:
case SIMD128:
Features["simd128"] = true;
Features["simd128"] = false;
LLVM_FALLTHROUGH;
case NoSIMD:
case UnimplementedSIMD128:
Features["unimplemented-simd128"] = false;
break;
}
}

void WebAssemblyTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
StringRef Name,
bool Enabled) const {
if (Name == "simd128")
setSIMDLevel(Features, SIMD128, Enabled);
else if (Name == "unimplemented-simd128")
setSIMDLevel(Features, UnimplementedSIMD128, Enabled);
else
Features[Name] = Enabled;
}

bool WebAssemblyTargetInfo::initFeatureMap(
llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags, StringRef CPU,
const std::vector<std::string> &FeaturesVec) const {
Expand All @@ -119,30 +143,8 @@ bool WebAssemblyTargetInfo::initFeatureMap(
Features["atomics"] = true;
Features["mutable-globals"] = true;
Features["tail-call"] = true;
setSIMDLevel(Features, SIMD128);
setSIMDLevel(Features, SIMD128, true);
}
// Other targets do not consider user-configured features here, but while we
// are actively developing new features it is useful to let user-configured
// features control availability of builtins
setSIMDLevel(Features, SIMDLevel);
if (HasNontrappingFPToInt)
Features["nontrapping-fptoint"] = true;
if (HasSignExt)
Features["sign-ext"] = true;
if (HasExceptionHandling)
Features["exception-handling"] = true;
if (HasBulkMemory)
Features["bulk-memory"] = true;
if (HasAtomics)
Features["atomics"] = true;
if (HasMutableGlobals)
Features["mutable-globals"] = true;
if (HasMultivalue)
Features["multivalue"] = true;
if (HasTailCall)
Features["tail-call"] = true;
if (HasReferenceTypes)
Features["reference-types"] = true;

return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
}
Expand Down
6 changes: 5 additions & 1 deletion contrib/llvm-project/clang/lib/Basic/Targets/WebAssembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,18 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo {
MacroBuilder &Builder) const override;

private:
static void setSIMDLevel(llvm::StringMap<bool> &Features, SIMDEnum Level);
static void setSIMDLevel(llvm::StringMap<bool> &Features, SIMDEnum Level,
bool Enabled);

bool
initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
StringRef CPU,
const std::vector<std::string> &FeaturesVec) const override;
bool hasFeature(StringRef Feature) const final;

void setFeatureEnabled(llvm::StringMap<bool> &Features, StringRef Name,
bool Enabled) const final;

bool handleTargetFeatures(std::vector<std::string> &Features,
DiagnosticsEngine &Diags) final;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4956,11 +4956,7 @@ bool CGOpenMPRuntimeNVPTX::hasAllocateAttributeForGlobalVar(const VarDecl *VD,
static CudaArch getCudaArch(CodeGenModule &CGM) {
if (!CGM.getTarget().hasFeature("ptx"))
return CudaArch::UNKNOWN;
llvm::StringMap<bool> Features;
CGM.getTarget().initFeatureMap(Features, CGM.getDiags(),
CGM.getTarget().getTargetOpts().CPU,
CGM.getTarget().getTargetOpts().Features);
for (const auto &Feature : Features) {
for (const auto &Feature : CGM.getTarget().getTargetOpts().FeatureMap) {
if (Feature.getValue()) {
CudaArch Arch = StringToCudaArch(Feature.getKey());
if (Arch != CudaArch::UNKNOWN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,11 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
V8_6Pos = Features.insert(std::next(V8_6Pos), {"+i8mm", "+bf16"});

if (Arg *A = Args.getLastArg(options::OPT_mno_unaligned_access,
options::OPT_munaligned_access))
options::OPT_munaligned_access)) {
if (A->getOption().matches(options::OPT_mno_unaligned_access))
Features.push_back("+strict-align");
} else if (Triple.isOSOpenBSD())
Features.push_back("+strict-align");

if (Args.hasArg(options::OPT_ffixed_x1))
Features.push_back("+reserve-x1");
Expand Down
6 changes: 3 additions & 3 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Arch/X86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ const char *x86::getX86TargetCPU(const ArgList &Args,
return "x86-64";

switch (Triple.getOS()) {
case llvm::Triple::FreeBSD:
return "i686";
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
return "i486";
case llvm::Triple::Haiku:
case llvm::Triple::OpenBSD:
return "i586";
case llvm::Triple::FreeBSD:
return "i686";
default:
// Fallback to p4.
return "pentium4";
Expand Down
6 changes: 3 additions & 3 deletions contrib/llvm-project/clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1879,8 +1879,8 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
ABIName = "elfv1-qpx";
break;
}

if (T.isMusl() || (T.isOSFreeBSD() && T.getOSMajorVersion() >= 13))
if ((T.isOSFreeBSD() && T.getOSMajorVersion() >= 13) ||
T.isOSOpenBSD() || T.isMusl())
ABIName = "elfv2";
else
ABIName = "elfv1";
Expand Down Expand Up @@ -2971,7 +2971,7 @@ static void RenderSCPOptions(const ToolChain &TC, const ArgList &Args,
return;

if (Args.hasFlag(options::OPT_fstack_clash_protection,
options::OPT_fnostack_clash_protection, false))
options::OPT_fno_stack_clash_protection, false))
CmdArgs.push_back("-fstack-clash-protection");
}

Expand Down
6 changes: 3 additions & 3 deletions contrib/llvm-project/libunwind/src/AddressSpace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ struct _LIBUNWIND_HIDDEN dl_iterate_cb_data {

// There should be just one of these per process.
static FrameHeaderCache ProcessFrameHeaderCache;
#endif // _LIBUNWIND_USE_FRAME_HEADER_CACHE
#endif

static bool checkAddrInSegment(const Elf_Phdr *phdr, size_t image_base,
dl_iterate_cb_data *cbdata) {
Expand All @@ -481,7 +481,7 @@ int findUnwindSectionsByPhdr(struct dl_phdr_info *pinfo, size_t pinfo_size,
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
if (ProcessFrameHeaderCache.find(pinfo, pinfo_size, data))
return 1;
#endif // _LIBUNWIND_USE_FRAME_HEADER_CACHE
#endif

Elf_Addr image_base = calculateImageBase(pinfo);
bool found_obj = false;
Expand Down Expand Up @@ -511,7 +511,7 @@ int findUnwindSectionsByPhdr(struct dl_phdr_info *pinfo, size_t pinfo_size,
if (found_obj && found_hdr) {
#if defined(_LIBUNWIND_USE_FRAME_HEADER_CACHE)
ProcessFrameHeaderCache.add(cbdata->sects);
#endif // _LIBUNWIND_USE_FRAME_HEADER_CACHE
#endif
return 1;
}
}
Expand Down
13 changes: 11 additions & 2 deletions contrib/llvm-project/lld/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ ELF Improvements
chrome://tracing. The file can be specified with ``--time-trace-file``.
Trace granularity can be specified with ``--time-trace-granularity``.
(`D71060 <https://reviews.llvm.org/D71060>`_)
* For ARM architectures the default max page size was increased to 64k.
This increases compatibility with systems where a non standard page
size was configured. This also is inline with GNU ld defaults.
(`D77330 <https://reviews.llvm.org/D77330>`_)
* ...

Breaking changes
Expand All @@ -40,12 +44,17 @@ Breaking changes
COFF Improvements
-----------------

* ...
* Fixed exporting symbols whose names contain a period (``.``), which was
a regression in lld 7.

MinGW Improvements
------------------

* ...
* Implemented new options for disabling auto import and runtime pseudo
relocations (``--disable-auto-import`` and
``--disable-runtime-pseudo-reloc``), the ``--no-seh`` flag and options
for selecting file and section alignment (``--file-alignment`` and
``--section-alignment``).

MachO Improvements
------------------
Expand Down
2 changes: 1 addition & 1 deletion contrib/llvm-project/lld/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
#html_use_smartypants = True

# Custom sidebar templates, maps document names to template names.
html_sidebars = {'index': 'indexsidebar.html'}
html_sidebars = {'index': ['indexsidebar.html']}

# Additional templates that should be rendered to pages, maps page names to
# template names.
Expand Down
15 changes: 11 additions & 4 deletions contrib/llvm-project/llvm/include/llvm/MC/MCDwarf.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,12 @@ class MCCFIInstruction {
unsigned Register2;
};
std::vector<char> Values;
std::string Comment;

MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, StringRef V)
MCCFIInstruction(OpType Op, MCSymbol *L, unsigned R, int O, StringRef V,
StringRef Comment = "")
: Operation(Op), Label(L), Register(R), Offset(O),
Values(V.begin(), V.end()) {
Values(V.begin(), V.end()), Comment(Comment) {
assert(Op != OpRegister);
}

Expand Down Expand Up @@ -570,8 +572,9 @@ class MCCFIInstruction {

/// .cfi_escape Allows the user to add arbitrary bytes to the unwind
/// info.
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals) {
return MCCFIInstruction(OpEscape, L, 0, 0, Vals);
static MCCFIInstruction createEscape(MCSymbol *L, StringRef Vals,
StringRef Comment = "") {
return MCCFIInstruction(OpEscape, L, 0, 0, Vals, Comment);
}

/// A special wrapper for .cfi_escape that indicates GNU_ARGS_SIZE
Expand Down Expand Up @@ -606,6 +609,10 @@ class MCCFIInstruction {
assert(Operation == OpEscape);
return StringRef(&Values[0], Values.size());
}

StringRef getComment() const {
return Comment;
}
};

struct MCDwarfFrameInfo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ void AsmPrinter::emitCFIInstruction(const MCCFIInstruction &Inst) const {
OutStreamer->emitCFIGnuArgsSize(Inst.getOffset());
break;
case MCCFIInstruction::OpEscape:
OutStreamer->AddComment(Inst.getComment());
OutStreamer->emitCFIEscape(Inst.getValues());
break;
case MCCFIInstruction::OpRestore:
Expand Down
Loading

0 comments on commit fed189f

Please sign in to comment.