Skip to content

Commit

Permalink
Merge pull request #398 from llvm/main
Browse files Browse the repository at this point in the history
[pull] main from llvm:main
  • Loading branch information
devkadirselcuk authored Dec 30, 2021
2 parents 55a9809 + 2e69f4f commit 978ceb5
Show file tree
Hide file tree
Showing 117 changed files with 867 additions and 577 deletions.
27 changes: 18 additions & 9 deletions clang/test/CodeGen/stack-protector-guard.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
// RUN: %clang_cc1 -mstack-protector-guard=sysreg \
// RUN: -mstack-protector-guard-reg=sp_el0 \
// RUN: -mstack-protector-guard-offset=1024 \
// RUN: -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck --check-prefix=CHECK-NONE %s
// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple x86_64-linux-gnu \
// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple powerpc64le-linux-gnu \
// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple arm-linux-gnueabi \
// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple thumbv7-linux-gnueabi \
// RUN: -mstack-protector-guard-offset=1024 -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -mstack-protector-guard=sysreg -triple aarch64-linux-gnu \
// RUN: -mstack-protector-guard-offset=1024 -mstack-protector-guard-reg=sp_el0 \
// RUN: -emit-llvm %s -o - | FileCheck %s --check-prefix=AARCH64
void foo(int*);
void bar(int x) {
int baz[x];
foo(baz);
}

// CHECK: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]], [[ATTR3:![0-9]+]]}
// CHECK: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]]}
// CHECK: [[ATTR1]] = !{i32 1, !"stack-protector-guard", !"sysreg"}
// CHECK: [[ATTR2]] = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
// CHECK: [[ATTR3]] = !{i32 1, !"stack-protector-guard-offset", i32 1024}
// CHECK-NONE-NOT: !"stack-protector-guard
// CHECK: [[ATTR2]] = !{i32 1, !"stack-protector-guard-offset", i32 1024}

// AARCH64: !llvm.module.flags = !{{{.*}}[[ATTR1:![0-9]+]], [[ATTR2:![0-9]+]], [[ATTR3:![0-9]+]]}
// AARCH64: [[ATTR1]] = !{i32 1, !"stack-protector-guard", !"sysreg"}
// AARCH64: [[ATTR2]] = !{i32 1, !"stack-protector-guard-reg", !"sp_el0"}
// AARCH64: [[ATTR3]] = !{i32 1, !"stack-protector-guard-offset", i32 1024}
19 changes: 19 additions & 0 deletions cmake/Modules/ExtendPath.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Extend the path in `base_path` with the path in `current_segment`, returning
# the result in `joined_path`. If `current_segment` is an absolute path then
# just return it, in effect overriding `base_path`, and issue a warning.
#
# Note that the code returns a relative path (avoiding introducing leading
# slashes) if `base_path` is empty.
function(extend_path joined_path base_path current_segment)
if("${current_segment}" STREQUAL "")
set(temp_path "${base_path}")
elseif("${base_path}" STREQUAL "")
set(temp_path "${current_segment}")
elseif(IS_ABSOLUTE "${current_segment}")
message(WARNING "Since \"${current_segment}\" is absolute, it overrides base path: \"${base_path}\".")
set(temp_path "${current_segment}")
else()
set(temp_path "${base_path}/${current_segment}")
endif()
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()
25 changes: 6 additions & 19 deletions compiler-rt/cmake/base-config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

include(CheckIncludeFile)
include(CheckCXXSourceCompiles)
include(ExtendPath)

check_include_file(unwind.h HAVE_UNWIND_H)

Expand Down Expand Up @@ -85,20 +86,6 @@ else()
set(COMPILER_RT_TEST_COMPILER_ID GNU)
endif()

function(extend_install_path joined_path current_segment)
if("${current_segment}" STREQUAL "")
set(temp_path "${COMPILER_RT_INSTALL_PATH}")
elseif("${COMPILER_RT_INSTALL_PATH}" STREQUAL "")
set(temp_path "${current_segment}")
elseif(IS_ABSOLUTE "${current_segment}")
message(WARNING "Since \"${current_segment}\" is absolute, it overrides COMPILER_RT_INSTALL_PATH: \"${COMPILER_RT_INSTALL_PATH}\".")
set(temp_path "${current_segment}")
else()
set(temp_path "${COMPILER_RT_INSTALL_PATH}/${current_segment}")
endif()
set(${joined_path} "${temp_path}" PARENT_SCOPE)
endfunction()

if(NOT DEFINED COMPILER_RT_OS_DIR)
if(ANDROID)
# The CMAKE_SYSTEM_NAME for Android is Android, but the OS is Linux and the
Expand All @@ -111,23 +98,23 @@ endif()
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib)
extend_install_path(default_install_path lib)
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" lib)
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt libraries should be installed.")
else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
set(COMPILER_RT_OUTPUT_LIBRARY_DIR
${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
extend_install_path(default_install_path "lib/${COMPILER_RT_OS_DIR}")
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib/${COMPILER_RT_OS_DIR}")
set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt libraries should be installed.")
endif()
extend_install_path(default_install_path bin)
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" bin)
set(COMPILER_RT_INSTALL_BINARY_DIR "${default_install_path}" CACHE PATH
"Path where built compiler-rt executables should be installed.")
extend_install_path(default_install_path include)
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" include)
set(COMPILER_RT_INSTALL_INCLUDE_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt headers should be installed.")
extend_install_path(default_install_path share)
extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" share)
set(COMPILER_RT_INSTALL_DATA_DIR "${default_install_path}" CACHE PATH
"Path where compiler-rt data files should be installed.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ mlir::MLIRContext Context;

auto Identifier = mlir::Identifier::get("foo", &Context);
mlir::OperationName OperationName("FooOp", &Context);
mlir::Value Value({reinterpret_cast<void *>(0x8),
mlir::Value::Kind::TrailingOpResult});

mlir::Type Type(nullptr);
mlir::Type IndexType = mlir::IndexType::get(&Context);
Expand All @@ -23,6 +21,10 @@ mlir::Type VectorType = mlir::VectorType::get({1, 2}, FloatType);
mlir::Type TupleType =
mlir::TupleType::get(&Context, mlir::TypeRange({IndexType, FloatType}));


mlir::detail::OutOfLineOpResult Result(FloatType, 42);
mlir::Value Value(&Result);

auto UnknownLoc = mlir::UnknownLoc::get(&Context);
auto FileLineColLoc = mlir::FileLineColLoc::get(&Context, "file", 7, 8);
auto OpaqueLoc = mlir::OpaqueLoc::get<uintptr_t>(9, &Context);
Expand Down
45 changes: 0 additions & 45 deletions lldb/packages/Python/lldbsuite/test/lldbtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1584,51 +1584,6 @@ def yaml2obj(self, yaml_path, obj_path, max_size=None):
command += ["--max-size=%d" % max_size]
self.runBuildCommand(command)

def getBuildFlags(
self,
use_cpp11=True,
use_libcxx=False,
use_libstdcxx=False):
""" Returns a dictionary (which can be provided to build* functions above) which
contains OS-specific build flags.
"""
cflags = ""
ldflags = ""

# On Mac OS X, unless specifically requested to use libstdc++, use
# libc++
if not use_libstdcxx and self.platformIsDarwin():
use_libcxx = True

if use_libcxx and self.libcxxPath:
cflags += "-stdlib=libc++ "
if self.libcxxPath:
libcxxInclude = os.path.join(self.libcxxPath, "include")
libcxxLib = os.path.join(self.libcxxPath, "lib")
if os.path.isdir(libcxxInclude) and os.path.isdir(libcxxLib):
cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (
libcxxInclude, libcxxLib, libcxxLib)

if use_cpp11:
cflags += "-std="
if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
cflags += "c++0x"
else:
cflags += "c++11"
if self.platformIsDarwin() or self.getPlatform() == "freebsd":
cflags += " -stdlib=libc++"
elif self.getPlatform() == "openbsd":
cflags += " -stdlib=libc++"
elif self.getPlatform() == "netbsd":
# NetBSD defaults to libc++
pass
elif "clang" in self.getCompiler():
cflags += " -stdlib=libstdc++"

return {'CFLAGS_EXTRAS': cflags,
'LD_EXTRAS': ldflags,
}

def cleanup(self, dictionary=None):
"""Platform specific way to do cleanup after build."""
module = builder_module()
Expand Down
7 changes: 5 additions & 2 deletions lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
Target &target, Status &error) {
Log *log = GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM);

std::string qemu = GetGlobalProperties().GetEmulatorPath().GetPath();
FileSpec qemu = GetGlobalProperties().GetEmulatorPath();
if (!qemu)
qemu.SetPath(("qemu-" + GetGlobalProperties().GetArchitecture()).str());
FileSystem::Instance().ResolveExecutableLocation(qemu);

llvm::SmallString<0> socket_model, socket_path;
HostInfo::GetProcessTempDir().GetPath(socket_model);
Expand All @@ -171,7 +174,7 @@ lldb::ProcessSP PlatformQemuUser::DebugProcess(ProcessLaunchInfo &launch_info,
llvm::sys::fs::createUniquePath(socket_model, socket_path, false);
} while (FileSystem::Instance().Exists(socket_path));

Args args({qemu, "-g", socket_path});
Args args({qemu.GetPath(), "-g", socket_path});
args.AppendArguments(GetGlobalProperties().GetEmulatorArgs());
args.AppendArgument("--");
args.AppendArgument(launch_info.GetExecutableFile().GetPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let Definition = "platformqemuuser" in {
def EmulatorPath: Property<"emulator-path", "FileSpec">,
Global,
DefaultStringValue<"">,
Desc<"Path to the emulator binary.">;
Desc<"Path to the emulator binary. If the path does not contain a directory separator, the filename is looked up in the PATH environment variable. If empty, the filename is derived from the architecture setting.">;
def EmulatorArgs: Property<"emulator-args", "Args">,
Global,
DefaultStringValue<"">,
Expand Down
3 changes: 2 additions & 1 deletion lldb/test/API/android/platform/TestDefaultCacheLineSize.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
class DefaultCacheLineSizeTestCase(TestBase):

mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True

@skipUnlessTargetAndroid
def test_cache_line_size(self):
self.build(dictionary=self.getBuildFlags())
self.build()
target = self.createTestTarget()
self.assertTrue(target and target.IsValid(), "Target is valid")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def setUp(self):
def test_get_dynamic_vals(self):
"""Test fetching C++ dynamic values from pointers & references."""
"""Get argument vals for the call stack when stopped on a breakpoint."""
self.build(dictionary=self.getBuildFlags())
self.build()
exe = self.getBuildArtifact("a.out")

# Create a target from the debugger.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def setUp(self):
# TODO: Change the test to don't depend on std::future<T>
def test(self):
"""Test breakpoint handling after a thread join."""
self.build(dictionary=self.getBuildFlags())
self.build()

exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def setUp(self):
@expectedFailureNetBSD
def test(self):
"""Test breakpoint handling after a thread join."""
self.build(dictionary=self.getBuildFlags())
self.build()

exe = self.getBuildArtifact("a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ConcurrentBreakpointDelayBreakpointOneSignal(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
"""Test two threads that trigger a breakpoint (one with a 1 second delay) and one signal thread. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_breakpoint_threads=1,
num_delay_breakpoint_threads=1,
num_signal_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ class ConcurrentBreakpointOneDelayBreakpointThreads(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
"""Test threads that trigger a breakpoint where one thread has a 1 second delay. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_breakpoint_threads=1,
num_delay_breakpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConcurrentBreakpointsDelayedBreakpointOneWatchpoint(
@add_test_categories(["watchpoint"])
def test(self):
"""Test a breakpoint, a delayed breakpoint, and one watchpoint thread. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_breakpoint_threads=1,
num_delay_breakpoint_threads=1,
num_watchpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class ConcurrentCrashWithBreak(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
""" Test a thread that crashes while another thread hits a breakpoint."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_crash_threads=1, num_breakpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class ConcurrentCrashWithSignal(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
""" Test a thread that crashes while another thread generates a signal."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_crash_threads=1, num_signal_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class ConcurrentCrashWithWatchpoint(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
""" Test a thread that crashes while another thread hits a watchpoint."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_crash_threads=1, num_watchpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ConcurrentCrashWithWatchpointBreakpointSignal(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
""" Test a thread that crashes while other threads generate a signal and hit a watchpoint and breakpoint. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_crash_threads=1,
num_breakpoint_threads=1,
num_signal_threads=1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ConcurrentDelaySignalBreak(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
"""Test (1-second delay) signal and a breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(
num_breakpoint_threads=1,
num_delay_signal_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ConcurrentDelaySignalWatch(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
"""Test a watchpoint and a (1 second delay) signal in multiple threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(
num_delay_signal_threads=1,
num_watchpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ConcurrentDelayWatchBreak(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
"""Test (1-second delay) watchpoint and a breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(
num_breakpoint_threads=1,
num_delay_watchpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ConcurrentDelayedCrashWithBreakpointSignal(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
""" Test a thread with a delayed crash while other threads generate a signal and hit a breakpoint. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_delay_crash_threads=1,
num_breakpoint_threads=1,
num_signal_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ConcurrentDelayedCrashWithBreakpointWatchpoint(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
""" Test a thread with a delayed crash while other threads hit a watchpoint and a breakpoint. """
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_delay_crash_threads=1,
num_breakpoint_threads=1,
num_watchpoint_threads=1)
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ class ConcurrentManyBreakpoints(ConcurrentEventsBase):
bugnumber="llvm.org/pr49433")
def test(self):
"""Test 100 breakpoints from 100 threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_breakpoint_threads=100)
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class ConcurrentManyCrash(ConcurrentEventsBase):
@skipIfOutOfTreeDebugserver
def test(self):
"""Test 100 threads that cause a segfault."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_crash_threads=100)
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ class ConcurrentManySignals(ConcurrentEventsBase):
@skipIfOutOfTreeDebugserver
def test(self):
"""Test 100 signals from 100 threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_signal_threads=100)
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ class ConcurrentManyWatchpoints(ConcurrentEventsBase):
@skipIfOutOfTreeDebugserver
def test(self):
"""Test 100 watchpoints from 100 threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_watchpoint_threads=100)
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class ConcurrentNWatchNBreak(ConcurrentEventsBase):
@add_test_categories(["watchpoint"])
def test(self):
"""Test with 5 watchpoint and breakpoint threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_watchpoint_threads=5,
num_breakpoint_threads=5)
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class ConcurrentSignalBreak(ConcurrentEventsBase):
@skipIf(triple='^mips')
def test(self):
"""Test signal and a breakpoint in multiple threads."""
self.build(dictionary=self.getBuildFlags())
self.build()
self.do_thread_actions(num_breakpoint_threads=1, num_signal_threads=1)
Loading

0 comments on commit 978ceb5

Please sign in to comment.