r339048 - [MinGW] Predefine UNICODE if -municode is specified during compilation
Author: mstorsjo Date: Mon Aug 6 12:48:44 2018 New Revision: 339048 URL: http://llvm.org/viewvc/llvm-project?rev=339048&view=rev Log: [MinGW] Predefine UNICODE if -municode is specified during compilation Differential Revision: https://reviews.llvm.org/D50199 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/mingw.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=339048&r1=339047&r2=339048&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Aug 6 12:48:44 2018 @@ -3346,6 +3346,9 @@ void Clang::ConstructJob(Compilation &C, if (Args.hasArg(options::OPT_static)) CmdArgs.push_back("-static-define"); + if (Args.hasArg(options::OPT_municode)) +CmdArgs.push_back("-DUNICODE"); + if (isa(JA)) RenderAnalyzerOptions(Args, CmdArgs, Triple, Input); Modified: cfe/trunk/test/Driver/mingw.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=339048&r1=339047&r2=339048&view=diff == --- cfe/trunk/test/Driver/mingw.cpp (original) +++ cfe/trunk/test/Driver/mingw.cpp Mon Aug 6 12:48:44 2018 @@ -56,3 +56,8 @@ // CHECK_MINGW_UBUNTU_POSIX_TREE: "{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32" // CHECK_MINGW_UBUNTU_POSIX_TREE: "{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}backward" // CHECK_MINGW_UBUNTU_POSIX_TREE: "{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}x86_64-w64-mingw32{{/|}}include" + +// RUN: %clang -target i686-windows-gnu -E -### %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_NO_UNICODE %s +// RUN: %clang -target i686-windows-gnu -E -### %s -municode 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UNICODE %s +// CHECK_MINGW_NO_UNICODE-NOT: "-DUNICODE" +// CHECK_MINGW_UNICODE: "-DUNICODE" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r339170 - [Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64
Author: mstorsjo Date: Tue Aug 7 13:02:40 2018 New Revision: 339170 URL: http://llvm.org/viewvc/llvm-project?rev=339170&view=rev Log: [Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64 This matches how GCC defines this struct. Differential Revision: https://reviews.llvm.org/D50380 Modified: cfe/trunk/lib/Headers/unwind.h Modified: cfe/trunk/lib/Headers/unwind.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=339170&r1=339169&r2=339170&view=diff == --- cfe/trunk/lib/Headers/unwind.h (original) +++ cfe/trunk/lib/Headers/unwind.h Tue Aug 7 13:02:40 2018 @@ -154,8 +154,12 @@ struct _Unwind_Control_Block { struct _Unwind_Exception { _Unwind_Exception_Class exception_class; _Unwind_Exception_Cleanup_Fn exception_cleanup; +#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__) + _Unwind_Word private_[6]; +#else _Unwind_Word private_1; _Unwind_Word private_2; +#endif /* The Itanium ABI requires that _Unwind_Exception objects are "double-word * aligned". GCC has interpreted this to mean "use the maximum useful * alignment for the target"; so do we. */ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r339503 - Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0
Author: mstorsjo Date: Sat Aug 11 12:36:06 2018 New Revision: 339503 URL: http://llvm.org/viewvc/llvm-project?rev=339503&view=rev Log: Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0 This was missed in SVN r337754. Modified: libcxxabi/trunk/src/cxa_personality.cpp Modified: libcxxabi/trunk/src/cxa_personality.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=339503&r1=339502&r2=339503&view=diff == --- libcxxabi/trunk/src/cxa_personality.cpp (original) +++ libcxxabi/trunk/src/cxa_personality.cpp Sat Aug 11 12:36:06 2018 @@ -1038,7 +1038,7 @@ __gxx_personality_v0 } #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) -extern "C" EXCEPTION_DISPOSITION +extern "C" _LIBCXXABI_FUNC_VIS EXCEPTION_DISPOSITION __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r339642 - [cmake] Add MINGW_LIBRARIES to the linker flags
Author: mstorsjo Date: Mon Aug 13 23:13:36 2018 New Revision: 339642 URL: http://llvm.org/viewvc/llvm-project?rev=339642&view=rev Log: [cmake] Add MINGW_LIBRARIES to the linker flags This is essential when building with -nodefaultlibs. In some CMake versions (noticed in 3.5.1), the same libraries are picked up from CMAKE_REQUIRED_LIBRARIES in some exceptional situations (if CXX probing failed, due to libc++ not being built yet, the libraries from CMAKE_REQUIRED_LIBRARIES are used for linking the target library), but not at all in other newer CMake versions (3.10). This is similar to what already is done in libcxxabi in SVN r302760 and libcxx in SVN r312498. Differential Revision: https://reviews.llvm.org/D50663 Modified: libunwind/trunk/src/CMakeLists.txt Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=339642&r1=339641&r2=339642&view=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Mon Aug 13 23:13:36 2018 @@ -62,6 +62,9 @@ append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_ append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) +# MINGW_LIBRARIES is defined in config-ix.cmake +append_if(libraries MINGW "${MINGW_LIBRARIES}") + if (LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG AND LIBUNWIND_HAS_FUNWIND_TABLES) list(APPEND LIBUNWIND_COMPILE_FLAGS -fno-exceptions) list(APPEND LIBUNWIND_COMPILE_FLAGS -funwind-tables) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r339697 - [CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option
Author: mstorsjo Date: Tue Aug 14 10:33:10 2018 New Revision: 339697 URL: http://llvm.org/viewvc/llvm-project?rev=339697&view=rev Log: [CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option This option should be available if LIBCXX_ENABLE_SHARED is enabled, not LIBCXX_ENABLE_STATIC. This fixes a typo from SVN r337814. Differential Revision: https://reviews.llvm.org/D50691 Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=339697&r1=339696&r2=339697&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Tue Aug 14 10:33:10 2018 @@ -175,7 +175,7 @@ cmake_dependent_option(LIBCXX_STATICALLY cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY "Statically link the ABI library to shared library" ON - "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF) + "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF) # Generate and install a linker script inplace of libc++.so. The linker script # will link libc++ to the correct ABI library. This option is on by default ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r340334 - [CodeGen] Implicitly set stackrealign on the main function, if custom stack alignment is used
Author: mstorsjo Date: Tue Aug 21 13:41:17 2018 New Revision: 340334 URL: http://llvm.org/viewvc/llvm-project?rev=340334&view=rev Log: [CodeGen] Implicitly set stackrealign on the main function, if custom stack alignment is used If using a custom stack alignment, one is expected to make sure that all callers provide such alignment, or realign the stack in all entry points (and callbacks). Despite this, the compiler can assume that the main function will need realignment in these cases, since the startup routines calling the main function most probably won't provide the custom alignment. This matches what GCC does in similar cases; if compiling with -mincoming-stack-boundary=X -mpreferred-stack-boundary=X, GCC normally assumes such alignment on entry to a function, but specifically for the main function still does realignment. Differential Revision: https://reviews.llvm.org/D51026 Added: cfe/trunk/test/CodeGen/stackrealign-main.c Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=340334&r1=340333&r2=340334&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Aug 21 13:41:17 2018 @@ -979,6 +979,13 @@ void CodeGenFunction::StartFunction(Glob if (FD->isMain()) Fn->addFnAttr(llvm::Attribute::NoRecurse); + // If a custom alignment is used, force realigning to this alignment on + // any main function which certainly will need it. + if (const FunctionDecl *FD = dyn_cast_or_null(D)) +if ((FD->isMain() || FD->isMSVCRTEntryPoint()) && +CGM.getCodeGenOpts().StackAlignment) + Fn->addFnAttr("stackrealign"); + llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn); // Create a marker to make it easy to insert allocas into the entryblock Added: cfe/trunk/test/CodeGen/stackrealign-main.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/stackrealign-main.c?rev=340334&view=auto == --- cfe/trunk/test/CodeGen/stackrealign-main.c (added) +++ cfe/trunk/test/CodeGen/stackrealign-main.c Tue Aug 21 13:41:17 2018 @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - -mstack-alignment=64 %s | FileCheck %s + +// CHECK-LABEL: define void @other() +// CHECK: [[OTHER:#[0-9]+]] +// CHECK: { +void other(void) {} + +// CHECK-LABEL: define i32 @main( +// CHECK: [[MAIN:#[0-9]+]] +// CHECK: { +int main(int argc, char **argv) { + other(); + return 0; +} + +// CHECK: attributes [[OTHER]] = { noinline nounwind optnone +// CHECK-NOT: "stackrealign" +// CHECK: } +// CHECK: attributes [[MAIN]] = { noinline nounwind optnone {{.*}}"stackrealign"{{.*}} } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r331807 - [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets
Author: mstorsjo Date: Tue May 8 13:55:23 2018 New Revision: 331807 URL: http://llvm.org/viewvc/llvm-project?rev=331807&view=rev Log: [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets -dwarf-column-info is omitted if -gcodeview is specified for msvc targets at the moment, but since -gcodeview is an option that can be specified for any target, there's little reason to restrict this handling to msvc targets. This allows getting proper codeview debug info by passing -gcodeview for e.g. MinGW targets as well. Differential Revision: https://reviews.llvm.org/D46287 Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/codeview-column-info.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331807&r1=331806&r2=331807&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue May 8 13:55:23 2018 @@ -3000,7 +3000,7 @@ static void RenderDebugOptions(const Too // debuggers don't handle missing end columns well, so it's better not to // include any column info. if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info, - /*Default=*/!(IsWindowsMSVC && EmitCodeView) && + /*Default=*/!EmitCodeView && DebuggerTuning != llvm::DebuggerKind::SCE)) CmdArgs.push_back("-dwarf-column-info"); Modified: cfe/trunk/test/Driver/codeview-column-info.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/codeview-column-info.c?rev=331807&r1=331806&r2=331807&view=diff == --- cfe/trunk/test/Driver/codeview-column-info.c (original) +++ cfe/trunk/test/Driver/codeview-column-info.c Tue May 8 13:55:23 2018 @@ -6,6 +6,8 @@ // RUN: FileCheck < %t1 %s // RUN: %clangxx -### --target=x86_64-windows-msvc -c -g -gcodeview %s 2> %t2 // RUN: FileCheck < %t2 %s +// RUN: %clangxx -### --target=x86_64-windows-gnu -c -g -gcodeview %s 2> %t2 +// RUN: FileCheck < %t2 %s // RUN: %clang_cl -### --target=x86_64-windows-msvc /c /Z7 -- %s 2> %t2 // RUN: FileCheck < %t2 %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r331858 - Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"
Author: mstorsjo Date: Wed May 9 02:11:01 2018 New Revision: 331858 URL: http://llvm.org/viewvc/llvm-project?rev=331858&view=rev Log: Revert "[Driver] Use -fuse-line-directives by default in MSVC mode" This reverts commit SVN r331666. It was afterwards pointed out in https://reviews.llvm.org/D46520 that #line directives lose information about what parts come from a system header. That means the result of -E usually won't compile, since Windows headers are typically full of warnings and default-error warnings. Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/cl-options.c Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331858&r1=331857&r2=331858&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed May 9 02:11:01 2018 @@ -4224,9 +4224,9 @@ void Clang::ConstructJob(Compilation &C, IsWindowsMSVC)) CmdArgs.push_back("-fms-extensions"); - // -fno-use-line-directives is default, except for MSVC targets. + // -fno-use-line-directives is default. if (Args.hasFlag(options::OPT_fuse_line_directives, - options::OPT_fno_use_line_directives, IsWindowsMSVC)) + options::OPT_fno_use_line_directives, false)) CmdArgs.push_back("-fuse-line-directives"); // -fms-compatibility=0 is default. Modified: cfe/trunk/test/Driver/cl-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=331858&r1=331857&r2=331858&view=diff == --- cfe/trunk/test/Driver/cl-options.c (original) +++ cfe/trunk/test/Driver/cl-options.c Wed May 9 02:11:01 2018 @@ -28,7 +28,6 @@ // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s // E: "-E" -// E: "-fuse-line-directives" // E: "-o" "-" // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r314138 - [MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked
Author: mstorsjo Date: Mon Sep 25 12:24:45 2017 New Revision: 314138 URL: http://llvm.org/viewvc/llvm-project?rev=314138&view=rev Log: [MinGW] Don't link -lmsvcrt if a different msvcrt version is to be linked Differential Revision: https://reviews.llvm.org/D37530 Added: cfe/trunk/test/Driver/mingw-msvcrt.c Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=314138&r1=314137&r2=314138&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Sep 25 12:24:45 2017 @@ -82,6 +82,9 @@ void tools::MinGW::Linker::AddLibGCC(con CmdArgs.push_back("-lmoldname"); CmdArgs.push_back("-lmingwex"); + for (auto Lib : Args.getAllArgValues(options::OPT_l)) +if (StringRef(Lib).startswith("msvcr") || Lib == "ucrtbase") + return; CmdArgs.push_back("-lmsvcrt"); } Added: cfe/trunk/test/Driver/mingw-msvcrt.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-msvcrt.c?rev=314138&view=auto == --- cfe/trunk/test/Driver/mingw-msvcrt.c (added) +++ cfe/trunk/test/Driver/mingw-msvcrt.c Mon Sep 25 12:24:45 2017 @@ -0,0 +1,5 @@ +// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s +// RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s + +// CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32" +// CHECK_MSVCR120: "-lmingwex" "-ladvapi32" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314196 - Correct data types in the _Unwind_FunctionContext struct
Author: mstorsjo Date: Tue Sep 26 01:07:17 2017 New Revision: 314196 URL: http://llvm.org/viewvc/llvm-project?rev=314196&view=rev Log: Correct data types in the _Unwind_FunctionContext struct This makes it match the definition used within llvm and in libgcc, we previously got the wrong layout in 64 bit environments. Differential Revision: https://reviews.llvm.org/D38247 Modified: libunwind/trunk/src/Unwind-sjlj.c Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=314196&r1=314195&r2=314196&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Tue Sep 26 01:07:17 2017 @@ -39,10 +39,10 @@ struct _Unwind_FunctionContext { struct _Unwind_FunctionContext *prev; // set by calling function before registering to be the landing pad - uintptr_t resumeLocation; + uint32_tresumeLocation; // set by personality handler to be parameters passed to landing pad function - uintptr_t resumeParameters[4]; + uint32_tresumeParameters[4]; // set by calling function before registering __personality_routine personality; // arm offset=24 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314197 - Skip building unused parts when targeting SJLJ
Author: mstorsjo Date: Tue Sep 26 01:07:26 2017 New Revision: 314197 URL: http://llvm.org/viewvc/llvm-project?rev=314197&view=rev Log: Skip building unused parts when targeting SJLJ When SJLJ exceptions are used, those functions aren't used. This fixes build failures on ARM with SJLJ enabled (e.g. on armv7/iOS) when built using the CMake project files. Differential Revision: https://reviews.llvm.org/D38249 Modified: libunwind/trunk/src/UnwindLevel1.c libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/src/UnwindLevel1.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindLevel1.c?rev=314197&r1=314196&r2=314197&view=diff == --- libunwind/trunk/src/UnwindLevel1.c (original) +++ libunwind/trunk/src/UnwindLevel1.c Tue Sep 26 01:07:26 2017 @@ -30,7 +30,7 @@ #include "unwind.h" #include "config.h" -#if !defined(_LIBUNWIND_ARM_EHABI) +#if !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) static _Unwind_Reason_Code unwind_phase1(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *exception_object) { @@ -503,4 +503,4 @@ _LIBUNWIND_EXPORT void _Unwind_SetIP(str unw_set_reg(cursor, UNW_REG_IP, value); } -#endif // !defined(_LIBUNWIND_ARM_EHABI) +#endif // !defined(_LIBUNWIND_ARM_EHABI) && !defined(__USING_SJLJ_EXCEPTIONS__) Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=314197&r1=314196&r2=314197&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Tue Sep 26 01:07:26 2017 @@ -308,7 +308,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li ldpx0, x1, [x0, #0x000] // restore x0,x1 retx30// jump to pc -#elif defined(__arm__) && !defined(__APPLE__) +#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__)) #if !defined(__ARM_ARCH_ISA_ARM) .thumb Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=314197&r1=314196&r2=314197&view=diff == --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Tue Sep 26 01:07:26 2017 @@ -289,7 +289,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext movx0, #0 // return UNW_ESUCCESS ret -#elif defined(__arm__) && !defined(__APPLE__) +#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__)) #if !defined(__ARM_ARCH_ISA_ARM) .thumb Modified: libunwind/trunk/src/libunwind.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/libunwind.cpp?rev=314197&r1=314196&r2=314197&view=diff == --- libunwind/trunk/src/libunwind.cpp (original) +++ libunwind/trunk/src/libunwind.cpp Tue Sep 26 01:07:26 2017 @@ -24,6 +24,7 @@ #include +#if !defined(__USING_SJLJ_EXCEPTIONS__) #include "AddressSpace.hpp" #include "UnwindCursor.hpp" @@ -341,6 +342,7 @@ void _unw_remove_dynamic_fde(unw_word_t DwarfFDECache::removeAllIn((LocalAddressSpace::pint_t)fde); } #endif // defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) +#endif // !defined(__USING_SJLJ_EXCEPTIONS__) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314492 - Skip building x86 parts of UnwindRegisters*.S when targeting SjLj
Author: mstorsjo Date: Thu Sep 28 23:09:09 2017 New Revision: 314492 URL: http://llvm.org/viewvc/llvm-project?rev=314492&view=rev Log: Skip building x86 parts of UnwindRegisters*.S when targeting SjLj This extends SVN r314197 from the arm parts to the whole file. Differential Revision: https://reviews.llvm.org/D38381 Modified: libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=314492&r1=314491&r2=314492&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Thu Sep 28 23:09:09 2017 @@ -11,6 +11,8 @@ .text +#if !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) + #if defined(__i386__) DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv) # @@ -308,7 +310,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li ldpx0, x1, [x0, #0x000] // restore x0,x1 retx30// jump to pc -#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__)) +#elif defined(__arm__) #if !defined(__ARM_ARCH_ISA_ARM) .thumb @@ -491,5 +493,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #endif +#endif /* !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) */ + NO_EXEC_STACK_DIRECTIVE Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=314492&r1=314491&r2=314492&view=diff == --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Thu Sep 28 23:09:09 2017 @@ -11,6 +11,8 @@ .text +#if !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) + #if defined(__i386__) # @@ -289,7 +291,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext movx0, #0 // return UNW_ESUCCESS ret -#elif defined(__arm__) && !(defined(__APPLE__) || defined(__USING_SJLJ_EXCEPTIONS__)) +#elif defined(__arm__) #if !defined(__ARM_ARCH_ISA_ARM) .thumb @@ -471,5 +473,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext l.sw 124(r3), r31 #endif +#endif /* !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) */ + NO_EXEC_STACK_DIRECTIVE ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314635 - SjLj: Fix building after SVN r314632
Author: mstorsjo Date: Sun Oct 1 13:22:40 2017 New Revision: 314635 URL: http://llvm.org/viewvc/llvm-project?rev=314635&view=rev Log: SjLj: Fix building after SVN r314632 The code moved from Unwind_AppleExtras.cpp to Unwind-sjlj.c needed a few minor modifications to build as C instead of C++. Modified: libunwind/trunk/src/Unwind-sjlj.c Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=314635&r1=314634&r2=314635&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Sun Oct 1 13:22:40 2017 @@ -67,7 +67,7 @@ struct _Unwind_FunctionContext { #if defined(__APPLE__) #include #else -static _LIBUNWIND_THREAD_LOCAL _Unwind_FunctionContext *stack = nullptr; +static _LIBUNWIND_THREAD_LOCAL struct _Unwind_FunctionContext *stack = NULL; #endif static struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314695 - Fix building on macOS after SVN r314492
Author: mstorsjo Date: Mon Oct 2 11:14:06 2017 New Revision: 314695 URL: http://llvm.org/viewvc/llvm-project?rev=314695&view=rev Log: Fix building on macOS after SVN r314492 That commit incorrectly expanded the assumption that defined(__APPLE__) implies SjLj exception handling, which only is true within ARM code sections. Modified: libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=314695&r1=314694&r2=314695&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Mon Oct 2 11:14:06 2017 @@ -11,7 +11,7 @@ .text -#if !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) #if defined(__i386__) DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_x866jumptoEv) @@ -310,7 +310,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li ldpx0, x1, [x0, #0x000] // restore x0,x1 retx30// jump to pc -#elif defined(__arm__) +#elif defined(__arm__) && !defined(__APPLE__) #if !defined(__ARM_ARCH_ISA_ARM) .thumb @@ -493,7 +493,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #endif -#endif /* !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) */ +#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */ NO_EXEC_STACK_DIRECTIVE Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=314695&r1=314694&r2=314695&view=diff == --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Mon Oct 2 11:14:06 2017 @@ -11,7 +11,7 @@ .text -#if !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#if !defined(__USING_SJLJ_EXCEPTIONS__) #if defined(__i386__) @@ -291,7 +291,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext movx0, #0 // return UNW_ESUCCESS ret -#elif defined(__arm__) +#elif defined(__arm__) && !defined(__APPLE__) #if !defined(__ARM_ARCH_ISA_ARM) .thumb @@ -473,7 +473,7 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext l.sw 124(r3), r31 #endif -#endif /* !defined(__APPLE__) && !defined(__USING_SJLJ_EXCEPTIONS__) */ +#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */ NO_EXEC_STACK_DIRECTIVE ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314716 - Add CMake support for building for MinGW
Author: mstorsjo Date: Mon Oct 2 13:46:37 2017 New Revision: 314716 URL: http://llvm.org/viewvc/llvm-project?rev=314716&view=rev Log: Add CMake support for building for MinGW This section is similar to what already exists in libcxx and libcxxabi. Differential Revision: https://reviews.llvm.org/D38380 Modified: libunwind/trunk/cmake/config-ix.cmake Modified: libunwind/trunk/cmake/config-ix.cmake URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/config-ix.cmake?rev=314716&r1=314715&r2=314716&view=diff == --- libunwind/trunk/cmake/config-ix.cmake (original) +++ libunwind/trunk/cmake/config-ix.cmake Mon Oct 2 13:46:37 2017 @@ -29,6 +29,19 @@ if (LIBUNWIND_HAS_NODEFAULTLIBS_FLAG) elseif (LIBUNWIND_HAS_GCC_S_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES gcc_s) endif () + if (MINGW) +# Mingw64 requires quite a few "C" runtime libraries in order for basic +# programs to link successfully with -nodefaultlibs. +if (LIBUNWIND_USE_COMPILER_RT) + set(MINGW_RUNTIME ${LIBUNWIND_BUILTINS_LIBRARY}) +else () + set(MINGW_RUNTIME gcc_s gcc) +endif() +set(MINGW_LIBRARIES mingw32 ${MINGW_RUNTIME} moldname mingwex msvcrt advapi32 +shell32 user32 kernel32 mingw32 ${MINGW_RUNTIME} +moldname mingwex msvcrt) +list(APPEND CMAKE_REQUIRED_LIBRARIES ${MINGW_LIBRARIES}) + endif() if (CMAKE_C_FLAGS MATCHES -fsanitize OR CMAKE_CXX_FLAGS MATCHES -fsanitize) set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize=all") endif () ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r315090 - [docs] Mention that SjLj works on any OS on the archs where supported by the compiler
Author: mstorsjo Date: Fri Oct 6 12:14:07 2017 New Revision: 315090 URL: http://llvm.org/viewvc/llvm-project?rev=315090&view=rev Log: [docs] Mention that SjLj works on any OS on the archs where supported by the compiler Differential Revision: https://reviews.llvm.org/D38576 Modified: libunwind/trunk/docs/index.rst Modified: libunwind/trunk/docs/index.rst URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=315090&r1=315089&r2=315090&view=diff == --- libunwind/trunk/docs/index.rst (original) +++ libunwind/trunk/docs/index.rst Fri Oct 6 12:14:07 2017 @@ -50,6 +50,7 @@ Linuxi386, x86_64 Clang, LinuxARM Clang, GCC EHABI Bare Metal ARM Clang, GCC EHABI NetBSD x86_64 Clang, GCC DWARF CFI +Any i386, x86_64, ARMClangSjLj The following minimum compiler versions are strongly recommended. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r315498 - Support DWARF unwinding on i386 windows
Author: mstorsjo Date: Wed Oct 11 13:06:18 2017 New Revision: 315498 URL: http://llvm.org/viewvc/llvm-project?rev=315498&view=rev Log: Support DWARF unwinding on i386 windows In practice, with code built with clang, there are still unresolved issues with DW_CFA_GNU_args_size though. Differential Revision: https://reviews.llvm.org/D38679 Modified: libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/assembly.h libunwind/trunk/src/config.h Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=315498&r1=315497&r2=315498&view=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Wed Oct 11 13:06:18 2017 @@ -18,7 +18,7 @@ #include #include -#ifndef _LIBUNWIND_IS_BAREMETAL +#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) #include #endif @@ -97,7 +97,12 @@ extern char __exidx_end; // independent ELF header traversal is not provided by on some // systems (e.g., FreeBSD). On these systems the data structures are // just called Elf_XXX. Define ElfW() locally. +#ifndef _WIN32 #include +#else +#include +#include +#endif #if !defined(ElfW) #define ElfW(type) Elf_##type #endif @@ -356,6 +361,43 @@ inline bool LocalAddressSpace::findUnwin info.arm_section, info.arm_section_length); if (info.arm_section && info.arm_section_length) return true; +#elif defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) && defined(_WIN32) + HMODULE mods[1024]; + HANDLE process = GetCurrentProcess(); + DWORD needed; + + if (!EnumProcessModules(process, mods, sizeof(mods), &needed)) +return false; + + for (unsigned i = 0; i < (needed / sizeof(HMODULE)); i++) { +PIMAGE_DOS_HEADER pidh = (PIMAGE_DOS_HEADER)mods[i]; +PIMAGE_NT_HEADERS pinh = (PIMAGE_NT_HEADERS)((BYTE *)pidh + pidh->e_lfanew); +PIMAGE_FILE_HEADER pifh = (PIMAGE_FILE_HEADER)&pinh->FileHeader; +PIMAGE_SECTION_HEADER pish = IMAGE_FIRST_SECTION(pinh); +bool found_obj = false; +bool found_hdr = false; + +info.dso_base = (uintptr_t)mods[i]; +for (unsigned j = 0; j < pifh->NumberOfSections; j++, pish++) { + uintptr_t begin = pish->VirtualAddress + (uintptr_t)mods[i]; + uintptr_t end = begin + pish->Misc.VirtualSize; + if (!strncmp((const char *)pish->Name, ".text", + IMAGE_SIZEOF_SHORT_NAME)) { +if (targetAddr >= begin && targetAddr < end) + found_obj = true; + } else if (!strncmp((const char *)pish->Name, ".eh_frame", + IMAGE_SIZEOF_SHORT_NAME)) { +// FIXME: This section name actually is truncated, ideally we +// should locate and check the full long name instead. +info.dwarf_section = begin; +info.dwarf_section_length = pish->Misc.VirtualSize; +found_hdr = true; + } + if (found_obj && found_hdr) +return true; +} + } + return false; #elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) struct dl_iterate_cb_data { LocalAddressSpace *addressSpace; @@ -478,7 +520,7 @@ inline bool LocalAddressSpace::findOther inline bool LocalAddressSpace::findFunctionName(pint_t addr, char *buf, size_t bufLen, unw_word_t *offset) { -#ifndef _LIBUNWIND_IS_BAREMETAL +#if !defined(_LIBUNWIND_IS_BAREMETAL) && !defined(_WIN32) Dl_info dyldInfo; if (dladdr((void *)addr, &dyldInfo)) { if (dyldInfo.dli_sname != NULL) { Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=315498&r1=315497&r2=315498&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Wed Oct 11 13:06:18 2017 @@ -18,6 +18,10 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li # # void libunwind::Registers_x86::jumpto() # +#if defined(_WIN32) +# On windows, the 'this' pointer is passed in ecx instead of on the stack + movl %ecx, %eax +#else # On entry: # + + # +---+ @@ -27,6 +31,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li # +---+ <-- SP # + + movl 4(%esp), %eax +#endif # set up eax and ret on new stack location movl 28(%eax), %edx # edx holds new stack pointer subl $8,%edx Modified: libunwind/trunk/src/assembly.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=315498&r1=315497&r2=315498&view=diff == --- libunwind/trunk/src/assembly.h (original) +++ libunwi
r315567 - [COFF, ARM64] Add MS builtins __dmb, __dsb, __isb
Author: mstorsjo Date: Thu Oct 12 00:05:37 2017 New Revision: 315567 URL: http://llvm.org/viewvc/llvm-project?rev=315567&view=rev Log: [COFF, ARM64] Add MS builtins __dmb, __dsb, __isb Differential Revision: https://reviews.llvm.org/D38821 Added: cfe/trunk/test/CodeGen/arm64-microsoft-intrinsics.c Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def cfe/trunk/lib/Basic/Targets/AArch64.cpp Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=315567&r1=315566&r2=315567&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Thu Oct 12 00:05:37 2017 @@ -14,6 +14,10 @@ // The format of this database matches clang/Basic/Builtins.def. +#if defined(BUILTIN) && !defined(LANGBUILTIN) +# define LANGBUILTIN(ID, TYPE, ATTRS, BUILTIN_LANG) BUILTIN(ID, TYPE, ATTRS) +#endif + // In libgcc BUILTIN(__clear_cache, "vv*v*", "i") @@ -61,4 +65,9 @@ BUILTIN(__builtin_arm_wsr, "vcC*Ui", "nc BUILTIN(__builtin_arm_wsr64, "vcC*LUi", "nc") BUILTIN(__builtin_arm_wsrp, "vcC*vC*", "nc") +LANGBUILTIN(__dmb, "vUi", "nc", ALL_MS_LANGUAGES) +LANGBUILTIN(__dsb, "vUi", "nc", ALL_MS_LANGUAGES) +LANGBUILTIN(__isb, "vUi", "nc", ALL_MS_LANGUAGES) + #undef BUILTIN +#undef LANGBUILTIN Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=315567&r1=315566&r2=315567&view=diff == --- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original) +++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Thu Oct 12 00:05:37 2017 @@ -27,6 +27,8 @@ const Builtin::Info AArch64TargetInfo::B #define BUILTIN(ID, TYPE, ATTRS) \ {#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr}, +#define LANGBUILTIN(ID, TYPE, ATTRS, LANG) \ + {#ID, TYPE, ATTRS, nullptr, LANG, nullptr}, #include "clang/Basic/BuiltinsAArch64.def" }; Added: cfe/trunk/test/CodeGen/arm64-microsoft-intrinsics.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/arm64-microsoft-intrinsics.c?rev=315567&view=auto == --- cfe/trunk/test/CodeGen/arm64-microsoft-intrinsics.c (added) +++ cfe/trunk/test/CodeGen/arm64-microsoft-intrinsics.c Thu Oct 12 00:05:37 2017 @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -triple arm64-windows -fms-compatibility -emit-llvm -o - %s \ +// RUN:| FileCheck %s -check-prefix CHECK-MSVC + +// RUN: not %clang_cc1 -triple arm64-linux -Werror -S -o /dev/null %s 2>&1 \ +// RUN:| FileCheck %s -check-prefix CHECK-LINUX + +void check__dmb(void) { + __dmb(0); +} + +// CHECK-MSVC: @llvm.aarch64.dmb(i32 0) +// CHECK-LINUX: error: implicit declaration of function '__dmb' + +void check__dsb(void) { + __dsb(0); +} + +// CHECK-MSVC: @llvm.aarch64.dsb(i32 0) +// CHECK-LINUX: error: implicit declaration of function '__dsb' + +void check__isb(void) { + __isb(0); +} + +// CHECK-MSVC: @llvm.aarch64.isb(i32 0) +// CHECK-LINUX: error: implicit declaration of function '__isb' ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r316149 - [Headers] Fix typoed __ARM_DWARF_EH__ ifdefs
Author: mstorsjo Date: Thu Oct 19 00:40:45 2017 New Revision: 316149 URL: http://llvm.org/viewvc/llvm-project?rev=316149&view=rev Log: [Headers] Fix typoed __ARM_DWARF_EH__ ifdefs These typos appeared in SVN r309226 and r309327. Modified: cfe/trunk/lib/Headers/unwind.h Modified: cfe/trunk/lib/Headers/unwind.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=316149&r1=316148&r2=316149&view=diff == --- cfe/trunk/lib/Headers/unwind.h (original) +++ cfe/trunk/lib/Headers/unwind.h Thu Oct 19 00:40:45 2017 @@ -76,7 +76,7 @@ typedef intptr_t _sleb128_t; typedef uintptr_t _uleb128_t; struct _Unwind_Context; -#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) struct _Unwind_Control_Block; typedef struct _Unwind_Control_Block _Unwind_Exception; /* Alias */ #else @@ -117,7 +117,7 @@ typedef enum { typedef void (*_Unwind_Exception_Cleanup_Fn)(_Unwind_Reason_Code, _Unwind_Exception *); -#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) typedef struct _Unwind_Control_Block _Unwind_Control_Block; typedef uint32_t _Unwind_EHT_Header; @@ -177,7 +177,7 @@ typedef _Unwind_Personality_Fn __persona typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *, void *); -#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH___)) +#if defined(__arm__) && !(defined(__USING_SJLJ_EXCEPTIONS__) || defined(__ARM_DWARF_EH__)) typedef enum { _UVRSC_CORE = 0,/* integer register */ _UVRSC_VFP = 1, /* vfp */ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r316300 - Make HIDDEN_DIRECTIVE a function-like macro. NFCI.
Author: mstorsjo Date: Sun Oct 22 12:39:26 2017 New Revision: 316300 URL: http://llvm.org/viewvc/llvm-project?rev=316300&view=rev Log: Make HIDDEN_DIRECTIVE a function-like macro. NFCI. This avoids a hack for making it a no-op for windows. Also explicitly check for _WIN32 instead of assuming it. Differential Revision: https://reviews.llvm.org/D39156 Modified: libunwind/trunk/src/assembly.h Modified: libunwind/trunk/src/assembly.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=316300&r1=316299&r2=316300&view=diff == --- libunwind/trunk/src/assembly.h (original) +++ libunwind/trunk/src/assembly.h Sun Oct 22 12:39:26 2017 @@ -24,20 +24,6 @@ #define SEPARATOR ; #endif -#if defined(__APPLE__) -#define HIDDEN_DIRECTIVE .private_extern -#elif defined(_WIN32) -// In the COFF object file format, there's no attributes for a global, -// non-static symbol to make it somehow hidden. So on windows, we don't -// want to set this at all. To avoid conditionals in -// DEFINE_LIBUNWIND_PRIVATE_FUNCTION below, make it .globl (which it already -// is, defined in the same DEFINE_LIBUNWIND_PRIVATE_FUNCTION macro; the -// duplicate .globl directives are harmless). -#define HIDDEN_DIRECTIVE .globl -#else -#define HIDDEN_DIRECTIVE .hidden -#endif - #define GLUE2(a, b) a ## b #define GLUE(a, b) GLUE2(a, b) #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) @@ -45,6 +31,7 @@ #if defined(__APPLE__) #define SYMBOL_IS_FUNC(name) +#define HIDDEN_SYMBOL(name) .private_extern name #define NO_EXEC_STACK_DIRECTIVE #elif defined(__ELF__) @@ -54,6 +41,7 @@ #else #define SYMBOL_IS_FUNC(name) .type name,@function #endif +#define HIDDEN_SYMBOL(name) .hidden name #if defined(__GNU__) || defined(__FreeBSD__) || defined(__Fuchsia__) || \ defined(__linux__) @@ -62,16 +50,21 @@ #define NO_EXEC_STACK_DIRECTIVE #endif -#else +#elif defined(_WIN32) #define SYMBOL_IS_FUNC(name) \ .def name SEPARATOR \ .scl 2 SEPARATOR \ .type 32 SEPARATOR \ .endef +#define HIDDEN_SYMBOL(name) #define NO_EXEC_STACK_DIRECTIVE +#else + +#error Unsupported target + #endif #define DEFINE_LIBUNWIND_FUNCTION(name) \ @@ -81,7 +74,7 @@ #define DEFINE_LIBUNWIND_PRIVATE_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ - HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR\ + HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ SYMBOL_NAME(name): ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r316364 - Abstract rwlocks into a class, provide a SRW lock implementation for windows
Author: mstorsjo Date: Mon Oct 23 12:29:36 2017 New Revision: 316364 URL: http://llvm.org/viewvc/llvm-project?rev=316364&view=rev Log: Abstract rwlocks into a class, provide a SRW lock implementation for windows This requires _WIN32_WINNT >= 0x0600. If someone wants to spend effort on supporting earlier versions, one can easily add another fallback implementation based on critical sections, or try to load SRW lock functions dynamically. This makes sure that the FDE cache is thread safe on windows. Differential Revision: https://reviews.llvm.org/D38704 Added: libunwind/trunk/src/RWMutex.hpp Modified: libunwind/trunk/src/CMakeLists.txt libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/config.h Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=316364&r1=316363&r2=316364&view=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Mon Oct 23 12:29:36 2017 @@ -30,6 +30,7 @@ set(LIBUNWIND_HEADERS DwarfParser.hpp libunwind_ext.h Registers.hpp +RWMutex.hpp UnwindCursor.hpp ${CMAKE_CURRENT_SOURCE_DIR}/../include/libunwind.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/unwind.h) Added: libunwind/trunk/src/RWMutex.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/RWMutex.hpp?rev=316364&view=auto == --- libunwind/trunk/src/RWMutex.hpp (added) +++ libunwind/trunk/src/RWMutex.hpp Mon Oct 23 12:29:36 2017 @@ -0,0 +1,77 @@ +//===- Registers.hpp --===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +// +// Abstract interface to shared reader/writer log, hiding platform and +// configuration differences. +// +//===--===// + +#ifndef __RWMUTEX_HPP__ +#define __RWMUTEX_HPP__ + +#if defined(_WIN32) +#include +#elif !defined(_LIBUNWIND_HAS_NO_THREADS) +#include +#endif + +namespace libunwind { + +#if defined(_LIBUNWIND_HAS_NO_THREADS) + +class _LIBUNWIND_HIDDEN RWMutex { +public: + bool lock_shared() { return true; } + bool unlock_shared() { return true; } + bool lock() { return true; } + bool unlock() { return true; } +}; + +#elif defined(_WIN32) + +class _LIBUNWIND_HIDDEN RWMutex { +public: + bool lock_shared() { +AcquireSRWLockShared(&_lock); +return true; + } + bool unlock_shared() { +ReleaseSRWLockShared(&_lock); +return true; + } + bool lock() { +AcquireSRWLockExclusive(&_lock); +return true; + } + bool unlock() { +ReleaseSRWLockExclusive(&_lock); +return true; + } + +private: + SRWLOCK _lock = SRWLOCK_INIT; +}; + +#else + +class _LIBUNWIND_HIDDEN RWMutex { +public: + bool lock_shared() { return pthread_rwlock_rdlock(&_lock) == 0; } + bool unlock_shared() { return pthread_rwlock_unlock(&_lock) == 0; } + bool lock() { return pthread_rwlock_wrlock(&_lock) == 0; } + bool unlock() { return pthread_rwlock_unlock(&_lock) == 0; } + +private: + pthread_rwlock_t _lock = PTHREAD_RWLOCK_INITIALIZER; +}; + +#endif + +} // namespace libunwind + +#endif // __RWMUTEX_HPP__ Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=316364&r1=316363&r2=316364&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Mon Oct 23 12:29:36 2017 @@ -16,9 +16,6 @@ #include #include #include -#ifndef _LIBUNWIND_HAS_NO_THREADS - #include -#endif #include #ifdef __APPLE__ @@ -34,6 +31,7 @@ #include "EHHeaderParser.hpp" #include "libunwind.h" #include "Registers.hpp" +#include "RWMutex.hpp" #include "Unwind-EHABI.h" namespace libunwind { @@ -62,9 +60,7 @@ private: // These fields are all static to avoid needing an initializer. // There is only one instance of this class per process. -#ifndef _LIBUNWIND_HAS_NO_THREADS - static pthread_rwlock_t _lock; -#endif + static RWMutex _lock; #ifdef __APPLE__ static void dyldUnloadHook(const struct mach_header *mh, intptr_t slide); static bool _registeredForDyldUnloads; @@ -91,10 +87,8 @@ DwarfFDECache::_bufferEnd = &_initial template typename DwarfFDECache::entry DwarfFDECache::_initialBuffer[64]; -#ifndef _LIBUNWIND_HAS_NO_THREADS template -pthread_rwlock_t DwarfFDECache::_lock = PTHREAD_RWLOCK_INITIALIZER; -#endif +RWMutex DwarfFDECache::_lock; #ifdef __APPLE__ template @@ -104,7 +98,7 @@ bool DwarfFDECache::_registeredForDyl template typename A::pint_t DwarfFDECache::findFDE(pint_t mh, pint_t pc) { pin
[libunwind] r316415 - Add missing checks for register number
Author: mstorsjo Date: Tue Oct 24 00:16:40 2017 New Revision: 316415 URL: http://llvm.org/viewvc/llvm-project?rev=316415&view=rev Log: Add missing checks for register number Most other cases that touch savedRegisters[reg] have got this check, but these three seemed to lack it. Differential Revision: https://reviews.llvm.org/D39206 Modified: libunwind/trunk/src/DwarfParser.hpp Modified: libunwind/trunk/src/DwarfParser.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfParser.hpp?rev=316415&r1=316414&r2=316415&view=diff == --- libunwind/trunk/src/DwarfParser.hpp (original) +++ libunwind/trunk/src/DwarfParser.hpp Tue Oct 24 00:16:40 2017 @@ -605,6 +605,13 @@ bool CFI_Parser::parseInstructions(A break; case DW_CFA_val_offset: reg = addressSpace.getULEB128(p, instructionsEnd); + if (reg > kMaxRegisterNumber) { +fprintf(stderr, +"malformed DW_CFA_val_offset DWARF unwind, reg (%" PRIu64 +") out of range\n", +reg); +return false; + } offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd) * cieInfo.dataAlignFactor; results->savedRegisters[reg].location = kRegisterOffsetFromCFA; @@ -668,6 +675,12 @@ bool CFI_Parser::parseInstructions(A switch (opcode & 0xC0) { case DW_CFA_offset: reg = operand; +if (reg > kMaxRegisterNumber) { + fprintf(stderr, "malformed DW_CFA_offset DWARF unwind, reg (%" PRIu64 + ") out of range\n", + reg); + return false; +} offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd) * cieInfo.dataAlignFactor; results->savedRegisters[reg].location = kRegisterInCFA; @@ -682,6 +695,12 @@ bool CFI_Parser::parseInstructions(A break; case DW_CFA_restore: reg = operand; +if (reg > kMaxRegisterNumber) { + fprintf(stderr, "malformed DW_CFA_restore DWARF unwind, reg (%" PRIu64 + ") out of range\n", + reg); + return false; +} results->savedRegisters[reg] = initialState.savedRegisters[reg]; _LIBUNWIND_TRACE_DWARF("DW_CFA_restore(reg=%" PRIu64 ")\n", static_cast(operand)); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r316559 - Fix the context/cursor size for ARM with WMMX enabled
Author: mstorsjo Date: Wed Oct 25 01:07:19 2017 New Revision: 316559 URL: http://llvm.org/viewvc/llvm-project?rev=316559&view=rev Log: Fix the context/cursor size for ARM with WMMX enabled This was missed in SVN r274744 when the WMMX part was made optional; when made optional, some struct fields were reordered, which caused the total struct size to grow due to padding/alignment. Modified: libunwind/trunk/include/__libunwind_config.h Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=316559&r1=316558&r2=316559&view=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Wed Oct 25 01:07:19 2017 @@ -39,8 +39,8 @@ # elif defined(__arm__) # define _LIBUNWIND_TARGET_ARM 1 # if defined(__ARM_WMMX) -#define _LIBUNWIND_CONTEXT_SIZE 60 -#define _LIBUNWIND_CURSOR_SIZE 67 +#define _LIBUNWIND_CONTEXT_SIZE 61 +#define _LIBUNWIND_CURSOR_SIZE 68 # else #define _LIBUNWIND_CONTEXT_SIZE 42 #define _LIBUNWIND_CURSOR_SIZE 49 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r340941 - [MinGW] Don't mark external variables as DSO local
Author: mstorsjo Date: Wed Aug 29 10:26:58 2018 New Revision: 340941 URL: http://llvm.org/viewvc/llvm-project?rev=340941&view=rev Log: [MinGW] Don't mark external variables as DSO local Since MinGW supports automatically importing external variables from DLLs even without the DLLImport attribute, we shouldn't mark them as DSO local unless we actually know them to be local for sure. Keep marking thread local variables as DSO local. Differential Revision: https://reviews.llvm.org/D51382 Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/test/CodeGen/dllimport.c cfe/trunk/test/CodeGen/dso-local-executable.c cfe/trunk/test/CodeGenCXX/dllexport.cpp cfe/trunk/test/CodeGenCXX/dllimport-members.cpp cfe/trunk/test/CodeGenCXX/dllimport.cpp cfe/trunk/test/CodeGenCXX/dso-local-executable.cpp Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=340941&r1=340940&r2=340941&view=diff == --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Aug 29 10:26:58 2018 @@ -730,6 +730,14 @@ static bool shouldAssumeDSOLocal(const C return false; const llvm::Triple &TT = CGM.getTriple(); + if (TT.isWindowsGNUEnvironment()) { +// In MinGW, variables without DLLImport can still be automatically +// imported from a DLL by the linker; don't mark variables that +// potentially could come from another DLL as DSO local. +if (GV->isDeclarationForLinker() && isa(GV) && +!GV->isThreadLocal()) + return false; + } // Every other GV is local on COFF. // Make an exception for windows OS in the triple: Some firmware builds use // *-win32-macho triples. This (accidentally?) produced windows relocations Modified: cfe/trunk/test/CodeGen/dllimport.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dllimport.c?rev=340941&r1=340940&r2=340941&view=diff == --- cfe/trunk/test/CodeGen/dllimport.c (original) +++ cfe/trunk/test/CodeGen/dllimport.c Wed Aug 29 10:26:58 2018 @@ -39,7 +39,8 @@ USEVAR(GlobalRedecl2) // NB: MSVC issues a warning and makes GlobalRedecl3 dllexport. We follow GCC // and drop the dllimport with a warning. -// CHECK: @GlobalRedecl3 = external dso_local global i32 +// MS: @GlobalRedecl3 = external dso_local global i32 +// GNU: @GlobalRedecl3 = external global i32 __declspec(dllimport) extern int GlobalRedecl3; extern int GlobalRedecl3; // dllimport ignored USEVAR(GlobalRedecl3) Modified: cfe/trunk/test/CodeGen/dso-local-executable.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dso-local-executable.c?rev=340941&r1=340940&r2=340941&view=diff == --- cfe/trunk/test/CodeGen/dso-local-executable.c (original) +++ cfe/trunk/test/CodeGen/dso-local-executable.c Wed Aug 29 10:26:58 2018 @@ -9,6 +9,17 @@ // COFF-DAG: @import_var = external dllimport global i32 // COFF-DAG: declare dllimport void @import_func() +// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix=MINGW %s +// MINGW-DAG: @bar = external global i32 +// MINGW-DAG: @weak_bar = extern_weak global i32 +// MINGW-DAG: declare dso_local void @foo() +// MINGW-DAG: @baz = dso_local global i32 42 +// MINGW-DAG: define dso_local i32* @zed() +// MINGW-DAG: @thread_var = external dso_local thread_local global i32 +// MINGW-DAG: @local_thread_var = dso_local thread_local global i32 42 +// MINGW-DAG: @import_var = external dllimport global i32 +// MINGW-DAG: declare dllimport void @import_func() + // RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm -mrelocation-model static %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix=STATIC %s // STATIC-DAG: @bar = external dso_local global i32 // STATIC-DAG: @weak_bar = extern_weak dso_local global i32 Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=340941&r1=340940&r2=340941&view=diff == --- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original) +++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Wed Aug 29 10:26:58 2018 @@ -43,7 +43,7 @@ __declspec(dllexport) extern int ExternG // M64-DAG: @__ImageBase = external dso_local constant i8 -// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global +// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external global // dllexport implies a definition. // MSC-DAG: @"?GlobalDef@@3HA" = dso_local dllexport global i32 0, align 4 @@ -137,7 +137,7 @@ class __declspec(dllexport) i : h<> {}; // Declarations are not exported. // MSC-DA
[libunwind] r341217 - Fix existing code for SEH on ARM to compile correctly
Author: mstorsjo Date: Fri Aug 31 07:56:55 2018 New Revision: 341217 URL: http://llvm.org/viewvc/llvm-project?rev=341217&view=rev Log: Fix existing code for SEH on ARM to compile correctly Even though SEH for ARM is incomplete, make what code already exists at least compile correctly. The _LIBUNWIND_CURSOR_SIZE wasn't correct. ARM (and AArch64) have a DISPATCHER_CONTEXT field named TargetPc instead of TargetIp. For the libunwind.h UNW_* constants, there is no UNW_ARM_PC, only UNW_ARM_IP. Don't use 'r' as loop variable when 'r' already is a Registers_arm member. Differential Revision: https://reviews.llvm.org/D51530 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/src/Unwind-seh.cpp libunwind/trunk/src/UnwindCursor.hpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=341217&r1=341216&r2=341217&view=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Fri Aug 31 07:56:55 2018 @@ -63,7 +63,7 @@ # define _LIBUNWIND_TARGET_ARM 1 # if defined(__SEH__) #define _LIBUNWIND_CONTEXT_SIZE 42 -#define _LIBUNWIND_CURSOR_SIZE 85 +#define _LIBUNWIND_CURSOR_SIZE 80 # elif defined(__ARM_WMMX) #define _LIBUNWIND_CONTEXT_SIZE 61 #define _LIBUNWIND_CURSOR_SIZE 68 Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=341217&r1=341216&r2=341217&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Fri Aug 31 07:56:55 2018 @@ -164,17 +164,22 @@ _GCC_specific_handler(PEXCEPTION_RECORD // This should never happen in phase 1. if (!IS_UNWINDING(ms_exc->ExceptionFlags)) _LIBUNWIND_ABORT("Personality installed context during phase 1!"); -exc->private_[2] = disp->TargetIp; #ifdef __x86_64__ +exc->private_[2] = disp->TargetIp; unw_get_reg(&cursor, UNW_X86_64_RAX, &retval); unw_get_reg(&cursor, UNW_X86_64_RDX, &exc->private_[3]); #elif defined(__arm__) +exc->private_[2] = disp->TargetPc; unw_get_reg(&cursor, UNW_ARM_R0, &retval); unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]); #endif unw_get_reg(&cursor, UNW_REG_IP, &target); ms_exc->ExceptionCode = STATUS_GCC_UNWIND; +#ifdef __x86_64__ ms_exc->ExceptionInformation[2] = disp->TargetIp; +#elif defined(__arm__) +ms_exc->ExceptionInformation[2] = disp->TargetPc; +#endif ms_exc->ExceptionInformation[3] = exc->private_[3]; // Give NTRTL some scratch space to keep track of the collided unwind. // Don't use the one that was passed in; we don't want to overwrite the Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=341217&r1=341216&r2=341217&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Fri Aug 31 07:56:55 2018 @@ -606,14 +606,14 @@ UnwindCursor::UnwindCursor(unw_con _msContext.R12 = r.getRegister(UNW_ARM_R12); _msContext.Sp = r.getRegister(UNW_ARM_SP); _msContext.Lr = r.getRegister(UNW_ARM_LR); - _msContext.Pc = r.getRegister(UNW_ARM_PC); - for (int r = UNW_ARM_D0; r <= UNW_ARM_D31; ++r) { + _msContext.Pc = r.getRegister(UNW_ARM_IP); + for (int i = UNW_ARM_D0; i <= UNW_ARM_D31; ++i) { union { uint64_t w; double d; } d; -d.d = r.getFloatRegister(r); -_msContext.D[r - UNW_ARM_D0] = d.w; +d.d = r.getFloatRegister(i); +_msContext.D[i - UNW_ARM_D0] = d.w; } #endif } @@ -682,7 +682,7 @@ unw_word_t UnwindCursor::getReg(in case UNW_ARM_SP: return _msContext.Sp; case UNW_ARM_LR: return _msContext.Lr; case UNW_REG_IP: - case UNW_ARM_PC: return _msContext.Pc; + case UNW_ARM_IP: return _msContext.Pc; #endif } _LIBUNWIND_ABORT("unsupported register"); @@ -728,7 +728,7 @@ void UnwindCursor::setReg(int regN case UNW_ARM_SP: _msContext.Sp = value; break; case UNW_ARM_LR: _msContext.Lr = value; break; case UNW_REG_IP: - case UNW_ARM_PC: _msContext.Pc = value; break; + case UNW_ARM_IP: _msContext.Pc = value; break; #endif default: _LIBUNWIND_ABORT("unsupported register"); @@ -842,7 +842,7 @@ const char *UnwindCursor::getRegis case UNW_ARM_SP: return "sp"; case UNW_ARM_LR: return "lr"; case UNW_REG_IP: - case UNW_ARM_PC: return "pc"; + case UNW_ARM_IP: return "pc"; case UNW_ARM_S0: return "s0"; case UNW_ARM_S1: return "s1"; case UNW_ARM_S2: return "s2"; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cf
[libcxxabi] r337754 - Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
Author: mstorsjo Date: Mon Jul 23 15:09:23 2018 New Revision: 337754 URL: http://llvm.org/viewvc/llvm-project?rev=337754&view=rev Log: Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0 This allows handling SEH based exceptions, with unwind functions provided by libgcc. Differential Revision: https://reviews.llvm.org/D49638 Modified: libcxxabi/trunk/src/cxa_personality.cpp Modified: libcxxabi/trunk/src/cxa_personality.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=337754&r1=337753&r2=337754&view=diff == --- libcxxabi/trunk/src/cxa_personality.cpp (original) +++ libcxxabi/trunk/src/cxa_personality.cpp Mon Jul 23 15:09:23 2018 @@ -23,6 +23,16 @@ #include "private_typeinfo.h" #include "unwind.h" +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +#include +#include + +extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD, + void *, PCONTEXT, + PDISPATCHER_CONTEXT, + _Unwind_Personality_Fn); +#endif + /* Exception Header Layout: @@ -934,12 +944,16 @@ _UA_CLEANUP_PHASE */ #if !defined(_LIBCXXABI_ARM_EHABI) +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +static _Unwind_Reason_Code __gxx_personality_imp +#else _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code #ifdef __USING_SJLJ_EXCEPTIONS__ __gxx_personality_sj0 #else __gxx_personality_v0 #endif +#endif (int version, _Unwind_Action actions, uint64_t exceptionClass, _Unwind_Exception* unwind_exception, _Unwind_Context* context) { @@ -1022,6 +1036,17 @@ __gxx_personality_v0 // We were called improperly: neither a phase 1 or phase 2 search return _URC_FATAL_PHASE1_ERROR; } + +#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__) +extern "C" EXCEPTION_DISPOSITION +__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame, + PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp) +{ + return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp, + __gxx_personality_imp); +} +#endif + #else extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337946 - [windows] Fix warning about comparing ints of different signs
Author: mstorsjo Date: Wed Jul 25 11:24:23 2018 New Revision: 337946 URL: http://llvm.org/viewvc/llvm-project?rev=337946&view=rev Log: [windows] Fix warning about comparing ints of different signs This fixes a warning like this: warning: comparison of integers of different signs: 'std::__1::__libcpp_tls_key' (aka 'long') and 'DWORD' (aka 'unsigned long') [-Wsign-compare] if (*__key == FLS_OUT_OF_INDEXES) ~~ ^ ~~ Differential Revision: https://reviews.llvm.org/D49782 Modified: libcxx/trunk/src/support/win32/thread_win32.cpp Modified: libcxx/trunk/src/support/win32/thread_win32.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/win32/thread_win32.cpp?rev=337946&r1=337945&r2=337946&view=diff == --- libcxx/trunk/src/support/win32/thread_win32.cpp (original) +++ libcxx/trunk/src/support/win32/thread_win32.cpp Wed Jul 25 11:24:23 2018 @@ -254,9 +254,10 @@ void __libcpp_thread_sleep_for(const chr int __libcpp_tls_create(__libcpp_tls_key* __key, void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*)) { - *__key = FlsAlloc(__at_exit); - if (*__key == FLS_OUT_OF_INDEXES) + DWORD index = FlsAlloc(__at_exit); + if (index == FLS_OUT_OF_INDEXES) return GetLastError(); + *__key = index; return 0; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r338749 - Work around more GCC miscompiles exposed by r338464.
Author: mstorsjo Date: Thu Aug 2 11:12:08 2018 New Revision: 338749 URL: http://llvm.org/viewvc/llvm-project?rev=338749&view=rev Log: Work around more GCC miscompiles exposed by r338464. This is the same fix as in r338478, for another occurrance of the same pattern from r338464. See gcc.gnu.org/PR86769 for details of the bug. Modified: cfe/trunk/lib/Sema/SemaInit.cpp Modified: cfe/trunk/lib/Sema/SemaInit.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=338749&r1=338748&r2=338749&view=diff == --- cfe/trunk/lib/Sema/SemaInit.cpp (original) +++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Aug 2 11:12:08 2018 @@ -6371,8 +6371,12 @@ static bool implicitObjectParamIsLifetim const TypeSourceInfo *TSI = FD->getTypeSourceInfo(); if (!TSI) return false; + // Don't declare this variable in the second operand of the for-statement; + // GCC miscompiles that by ending its lifetime before evaluating the + // third operand. See gcc.gnu.org/PR86769. + AttributedTypeLoc ATL; for (TypeLoc TL = TSI->getTypeLoc(); - auto ATL = TL.getAsAdjusted(); + (ATL = TL.getAsAdjusted()); TL = ATL.getModifiedLoc()) { if (ATL.getAttrKind() == AttributedType::attr_lifetimebound) return true; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r338819 - [CMake] Allow building standalone without any llvm-config available
Author: mstorsjo Date: Thu Aug 2 22:51:31 2018 New Revision: 338819 URL: http://llvm.org/viewvc/llvm-project?rev=338819&view=rev Log: [CMake] Allow building standalone without any llvm-config available This is the same as libcxxabi/libcxx do. Differential Revision: https://reviews.llvm.org/D50135 Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=338819&r1=338818&r2=338819&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Thu Aug 2 22:51:31 2018 @@ -66,9 +66,10 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() -message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " -"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config " -"or -DLLVM_PATH=path/to/llvm-source-root.") +message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: " +"llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " +"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config " +"or -DLLVM_PATH=path/to/llvm-source-root.") endif() if (EXISTS ${LLVM_CMAKE_PATH}) @@ -76,7 +77,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR include("${LLVM_CMAKE_PATH}/AddLLVM.cmake") include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake") else() -message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}") +message(WARNING "Not found: ${LLVM_CMAKE_PATH}") endif() set(PACKAGE_NAME libunwind) @@ -366,4 +367,6 @@ if (LIBUNWIND_INCLUDE_DOCS) add_subdirectory(docs) endif() -add_subdirectory(test) +if (EXISTS ${LLVM_CMAKE_PATH}) + add_subdirectory(test) +endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r321667 - [PPC64] Port to ppc64le - initial version
Author: mstorsjo Date: Tue Jan 2 12:10:54 2018 New Revision: 321667 URL: http://llvm.org/viewvc/llvm-project?rev=321667&view=rev Log: [PPC64] Port to ppc64le - initial version Initial working version of libunwind for PowerPC 64. Tested on little-endian ppc64 host only. Based on the existing PowerPC 32 code. It supports: - context save/restore (unw_getcontext, unw_init_local, unw_resume) - read/write from/to saved registers - backtrace (unw_step) Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D41386 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/assembly.h libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=321667&r1=321666&r2=321667&view=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Jan 2 12:10:54 2018 @@ -18,6 +18,7 @@ #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86 8 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC 112 +#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM 287 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K 31 @@ -39,6 +40,11 @@ #define _LIBUNWIND_CURSOR_SIZE 33 # endif # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64 +# elif defined(__powerpc64__) +# define _LIBUNWIND_TARGET_PPC64 1 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 # elif defined(__ppc__) # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_CONTEXT_SIZE 117 @@ -84,13 +90,14 @@ # define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_TARGET_X86_64 1 # define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_TARGET_PPC64 1 # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 # define _LIBUNWIND_TARGET_MIPS_O32 1 # define _LIBUNWIND_TARGET_MIPS_N64 1 -# define _LIBUNWIND_CONTEXT_SIZE 128 -# define _LIBUNWIND_CURSOR_SIZE 140 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287 #endif // _LIBUNWIND_IS_NATIVE_ONLY Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=321667&r1=321666&r2=321667&view=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Tue Jan 2 12:10:54 2018 @@ -325,6 +325,120 @@ enum { UNW_PPC_SPEFSCR = 112 }; +// 64-bit ppc register numbers +enum { + UNW_PPC64_R0 = 0, + UNW_PPC64_R1 = 1, + UNW_PPC64_R2 = 2, + UNW_PPC64_R3 = 3, + UNW_PPC64_R4 = 4, + UNW_PPC64_R5 = 5, + UNW_PPC64_R6 = 6, + UNW_PPC64_R7 = 7, + UNW_PPC64_R8 = 8, + UNW_PPC64_R9 = 9, + UNW_PPC64_R10 = 10, + UNW_PPC64_R11 = 11, + UNW_PPC64_R12 = 12, + UNW_PPC64_R13 = 13, + UNW_PPC64_R14 = 14, + UNW_PPC64_R15 = 15, + UNW_PPC64_R16 = 16, + UNW_PPC64_R17 = 17, + UNW_PPC64_R18 = 18, + UNW_PPC64_R19 = 19, + UNW_PPC64_R20 = 20, + UNW_PPC64_R21 = 21, + UNW_PPC64_R22 = 22, + UNW_PPC64_R23 = 23, + UNW_PPC64_R24 = 24, + UNW_PPC64_R25 = 25, + UNW_PPC64_R26 = 26, + UNW_PPC64_R27 = 27, + UNW_PPC64_R28 = 28, + UNW_PPC64_R29 = 29, + UNW_PPC64_R30 = 30, + UNW_PPC64_R31 = 31, + UNW_PPC64_F0 = 32, + UNW_PPC64_F1 = 33, + UNW_PPC64_F2 = 34, + UNW_PPC64_F3 = 35, + UNW_PPC64_F4 = 36, + UNW_PPC64_F5 = 37, + UNW_PPC64_F6 = 38, + UNW_PPC64_F7 = 39, + UNW_PPC64_F8 = 40, + UNW_PPC64_F9 = 41, + UNW_PPC64_F10 = 42, + UNW_PPC64_F11 = 43, + UNW_PPC64_F12 = 44, + UNW_PPC64_F13 = 45, + UNW_PPC64_F14 = 46, + UNW_PPC64_F15 = 47, + UNW_PPC64_F16 = 48, + UNW_PPC64_F17 = 49, + UNW_PPC64_F18 = 50, + UNW_PPC64_F19 = 51, + UNW_PPC64_F20 = 52, + UNW_PPC64_F21 = 53, + UNW_PPC64_F22 = 54, + UNW_PPC64_F23 = 55, + UNW_PPC64_F24 = 56, + UNW_PPC64_F25 = 57, + UNW_PPC64_F26 = 58, + UNW_PPC64_F27 = 59, + UNW_PPC64_F28 = 60, + UNW_PPC64_F29 = 61, + UNW_PPC64_F30 = 62, + UNW_PPC64_F31 = 63, + UNW_PPC64_LR = 64, + UNW_PPC64_CTR = 65, + UNW_PPC64_CR0 = 66, + UNW_PPC64_CR1 = 67, + UNW_PPC64_CR2 = 68, + UNW_PPC64_CR3 = 69, + UNW_PPC64_CR4 = 70, + UNW_PPC64_CR5 = 71, + UNW_PPC64_CR6 = 72, + UNW_PPC64_CR7 = 73, + UNW_PPC64
[libunwind] r321679 - Don't use a strict larger-than comparison in the check_fit/does_fit static assert
Author: mstorsjo Date: Tue Jan 2 14:11:22 2018 New Revision: 321679 URL: http://llvm.org/viewvc/llvm-project?rev=321679&view=rev Log: Don't use a strict larger-than comparison in the check_fit/does_fit static assert For builds that only target one architecture, this was required to be an exact match, while it previously required the allocation to be strictly larger than the largest concrete one. Requiring it to be larger than on equal should be enough. This makes it more straightforward to update _LIBUNWIND_CONTEXT_SIZE and _LIBUNWIND_CURSOR_SIZE. Modified: libunwind/trunk/src/config.h Modified: libunwind/trunk/src/config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=321679&r1=321678&r2=321679&view=diff == --- libunwind/trunk/src/config.h (original) +++ libunwind/trunk/src/config.h Tue Jan 2 14:11:22 2018 @@ -155,7 +155,7 @@ #if defined(_LIBUNWIND_IS_NATIVE_ONLY) # define COMP_OP == #else -# define COMP_OP < +# define COMP_OP <= #endif template struct check_fit { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r321680 - Reland [PPC64] Port to ppc64le - initial version
Author: mstorsjo Date: Tue Jan 2 14:11:30 2018 New Revision: 321680 URL: http://llvm.org/viewvc/llvm-project?rev=321680&view=rev Log: Reland [PPC64] Port to ppc64le - initial version Initial working version of libunwind for PowerPC 64. Tested on little-endian ppc64 host only. Based on the existing PowerPC 32 code. It supports: - context save/restore (unw_getcontext, unw_init_local, unw_resume) - read/write from/to saved registers - backtrace (unw_step) Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D41386 Now builds with LIBUNWIND_ENABLE_CROSS_UNWINDING=ON should work. Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/include/libunwind.h libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/assembly.h libunwind/trunk/src/config.h libunwind/trunk/src/libunwind.cpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=321680&r1=321679&r2=321680&view=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Jan 2 14:11:30 2018 @@ -18,6 +18,7 @@ #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86 8 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC 112 +#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM 287 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K 31 @@ -39,6 +40,11 @@ #define _LIBUNWIND_CURSOR_SIZE 33 # endif # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64 +# elif defined(__powerpc64__) +# define _LIBUNWIND_TARGET_PPC64 1 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 # elif defined(__ppc__) # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_CONTEXT_SIZE 117 @@ -84,13 +90,14 @@ # define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_TARGET_X86_64 1 # define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_TARGET_PPC64 1 # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 # define _LIBUNWIND_TARGET_MIPS_O32 1 # define _LIBUNWIND_TARGET_MIPS_N64 1 -# define _LIBUNWIND_CONTEXT_SIZE 128 -# define _LIBUNWIND_CURSOR_SIZE 140 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287 #endif // _LIBUNWIND_IS_NATIVE_ONLY Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=321680&r1=321679&r2=321680&view=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Tue Jan 2 14:11:30 2018 @@ -325,6 +325,120 @@ enum { UNW_PPC_SPEFSCR = 112 }; +// 64-bit ppc register numbers +enum { + UNW_PPC64_R0 = 0, + UNW_PPC64_R1 = 1, + UNW_PPC64_R2 = 2, + UNW_PPC64_R3 = 3, + UNW_PPC64_R4 = 4, + UNW_PPC64_R5 = 5, + UNW_PPC64_R6 = 6, + UNW_PPC64_R7 = 7, + UNW_PPC64_R8 = 8, + UNW_PPC64_R9 = 9, + UNW_PPC64_R10 = 10, + UNW_PPC64_R11 = 11, + UNW_PPC64_R12 = 12, + UNW_PPC64_R13 = 13, + UNW_PPC64_R14 = 14, + UNW_PPC64_R15 = 15, + UNW_PPC64_R16 = 16, + UNW_PPC64_R17 = 17, + UNW_PPC64_R18 = 18, + UNW_PPC64_R19 = 19, + UNW_PPC64_R20 = 20, + UNW_PPC64_R21 = 21, + UNW_PPC64_R22 = 22, + UNW_PPC64_R23 = 23, + UNW_PPC64_R24 = 24, + UNW_PPC64_R25 = 25, + UNW_PPC64_R26 = 26, + UNW_PPC64_R27 = 27, + UNW_PPC64_R28 = 28, + UNW_PPC64_R29 = 29, + UNW_PPC64_R30 = 30, + UNW_PPC64_R31 = 31, + UNW_PPC64_F0 = 32, + UNW_PPC64_F1 = 33, + UNW_PPC64_F2 = 34, + UNW_PPC64_F3 = 35, + UNW_PPC64_F4 = 36, + UNW_PPC64_F5 = 37, + UNW_PPC64_F6 = 38, + UNW_PPC64_F7 = 39, + UNW_PPC64_F8 = 40, + UNW_PPC64_F9 = 41, + UNW_PPC64_F10 = 42, + UNW_PPC64_F11 = 43, + UNW_PPC64_F12 = 44, + UNW_PPC64_F13 = 45, + UNW_PPC64_F14 = 46, + UNW_PPC64_F15 = 47, + UNW_PPC64_F16 = 48, + UNW_PPC64_F17 = 49, + UNW_PPC64_F18 = 50, + UNW_PPC64_F19 = 51, + UNW_PPC64_F20 = 52, + UNW_PPC64_F21 = 53, + UNW_PPC64_F22 = 54, + UNW_PPC64_F23 = 55, + UNW_PPC64_F24 = 56, + UNW_PPC64_F25 = 57, + UNW_PPC64_F26 = 58, + UNW_PPC64_F27 = 59, + UNW_PPC64_F28 = 60, + UNW_PPC64_F29 = 61, + UNW_PPC64_F30 = 62, + UNW_PPC64_F31 = 63, + UNW_PPC64_LR = 64, + UNW_PPC64_CTR = 65, + UNW_PPC64_CR0 = 66, + UNW_PPC64_CR1 = 67, + UNW_PPC64_CR2 = 68, + UNW_PPC64_CR3 = 69, + UNW_PPC64_CR4 = 70, + UNW_P
[libcxx] r321896 - [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads
Author: mstorsjo Date: Fri Jan 5 12:48:29 2018 New Revision: 321896 URL: http://llvm.org/viewvc/llvm-project?rev=321896&view=rev Log: [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads This allows keeping libcxx using win32 threads even if a version of pthread.h is installed. This matches the existing cmake option LIBCXX_HAS_PTHREAD_API. Also add missing documentation about the internal define _LIBCPP_HAS_THREAD_API_WIN32. Differential Revision: https://reviews.llvm.org/D41764 Modified: libcxx/trunk/CMakeLists.txt libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst libcxx/trunk/include/__config_site.in Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=321896&r1=321895&r2=321896&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Fri Jan 5 12:48:29 2018 @@ -202,6 +202,7 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON) option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" OFF) option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread API" OFF) +option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of win32 thread API" OFF) option(LIBCXX_HAS_EXTERNAL_THREAD_API "Build libc++ with an externalized threading API. This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF) @@ -273,6 +274,10 @@ if(NOT LIBCXX_ENABLE_THREADS) message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set " "to ON when LIBCXX_ENABLE_THREADS is also set to ON.") endif() + if (LIBCXX_HAS_WIN32_THREAD_API) +message(FATAL_ERROR "LIBCXX_HAS_WIN32_THREAD_API can only be set to ON" +" when LIBCXX_ENABLE_THREADS is also set to ON.") + endif() endif() @@ -287,6 +292,19 @@ if (LIBCXX_HAS_EXTERNAL_THREAD_API) "and LIBCXX_HAS_PTHREAD_API cannot be both" "set to ON at the same time.") endif() + if (LIBCXX_HAS_WIN32_THREAD_API) +message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API" +"and LIBCXX_HAS_WIN32_THREAD_API cannot be both" +"set to ON at the same time.") + endif() +endif() + +if (LIBCXX_HAS_PTHREAD_API) + if (LIBCXX_HAS_WIN32_THREAD_API) +message(FATAL_ERROR "The options LIBCXX_HAS_PTHREAD_API" +"and LIBCXX_HAS_WIN32_THREAD_API cannot be both" +"set to ON at the same time.") + endif() endif() # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE @@ -613,6 +631,7 @@ config_define_if_not(LIBCXX_ENABLE_THREA config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD) config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API _LIBCPP_HAS_THREAD_API_EXTERNAL) +config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32) config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME) Modified: libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst?rev=321896&r1=321895&r2=321896&view=diff == --- libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst (original) +++ libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst Fri Jan 5 12:48:29 2018 @@ -66,6 +66,10 @@ Threading Configuration Macros This macro is defined when libc++ should use POSIX threads to implement the internal threading API. +**_LIBCPP_HAS_THREAD_API_WIN32** + This macro is defined when libc++ should use Win32 threads to implement the + internal threading API. + **_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL** This macro is defined when libc++ expects the definitions of the internal threading API to be provided by an external library. When defined Modified: libcxx/trunk/include/__config_site.in URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config_site.in?rev=321896&r1=321895&r2=321896&view=diff == --- libcxx/trunk/include/__config_site.in (original) +++ libcxx/trunk/include/__config_site.in Fri Jan 5 12:48:29 2018 @@ -23,6 +23,7 @@ #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL +#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32 #cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #cmakedefine _LIBCPP_NO_VCRUNTIME ___ cfe-commits maili
r326173 - [RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
Author: mstorsjo Date: Mon Feb 26 22:27:06 2018 New Revision: 326173 URL: http://llvm.org/viewvc/llvm-project?rev=326173&view=rev Log: [RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields When targeting GNU/MinGW for i386, the size of the "long double" data type is 12 bytes (while it is 8 bytes in MSVC). When building with -mms-bitfields to have struct layouts match MSVC, data types are laid out in a struct with alignment according to their size. However, this doesn't make sense for the long double type, since it doesn't match MSVC at all, and aligning to a non-power-of-2 size triggers other asserts later. This matches what GCC does, aligning a long double to 4 bytes in structs on i386 even when -mms-bitfields is specified. This fixes asserts when using the max_align_t data type when building for MinGW/i386 with the -mms-bitfields flag. Differential Revision: https://reviews.llvm.org/D43734 Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp cfe/trunk/test/CodeGen/mingw-long-double.c Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=326173&r1=326172&r2=326173&view=diff == --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original) +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Mon Feb 26 22:27:06 2018 @@ -1752,7 +1752,12 @@ void ItaniumRecordLayoutBuilder::LayoutF QualType T = Context.getBaseElementType(D->getType()); if (const BuiltinType *BTy = T->getAs()) { CharUnits TypeSize = Context.getTypeSizeInChars(BTy); -if (TypeSize > FieldAlign) +assert( +(llvm::isPowerOf2_64(TypeSize.getQuantity()) || + Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) && +"Non PowerOf2 size outside of GNU mode"); +if (TypeSize > FieldAlign && +llvm::isPowerOf2_64(TypeSize.getQuantity())) FieldAlign = TypeSize; } } Modified: cfe/trunk/test/CodeGen/mingw-long-double.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double.c?rev=326173&r1=326172&r2=326173&view=diff == --- cfe/trunk/test/CodeGen/mingw-long-double.c (original) +++ cfe/trunk/test/CodeGen/mingw-long-double.c Mon Feb 26 22:27:06 2018 @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s \ // RUN:| FileCheck %s --check-prefix=GNU32 +// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s -mms-bitfields \ +// RUN:| FileCheck %s --check-prefix=GNU32 // RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s \ // RUN:| FileCheck %s --check-prefix=GNU64 // RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r326180 - [test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.
Author: mstorsjo Date: Tue Feb 27 00:35:35 2018 New Revision: 326180 URL: http://llvm.org/viewvc/llvm-project?rev=326180&view=rev Log: [test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC. Modified: cfe/trunk/test/Driver/mingw-msvcrt.c Modified: cfe/trunk/test/Driver/mingw-msvcrt.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-msvcrt.c?rev=326180&r1=326179&r2=326180&view=diff == --- cfe/trunk/test/Driver/mingw-msvcrt.c (original) +++ cfe/trunk/test/Driver/mingw-msvcrt.c Tue Feb 27 00:35:35 2018 @@ -2,4 +2,5 @@ // RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32" -// CHECK_MSVCR120: "-lmingwex" "-ladvapi32" +// CHECK_MSVCR120: "-lmsvcr120" +// CHECK_MSVCR120-SAME: "-lmingwex" "-ladvapi32" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r326235 - [MinGW, CrossWindows] Allow passing -static together with -shared
Author: mstorsjo Date: Tue Feb 27 11:42:19 2018 New Revision: 326235 URL: http://llvm.org/viewvc/llvm-project?rev=326235&view=rev Log: [MinGW, CrossWindows] Allow passing -static together with -shared In these combinations, link a DLL as usual, but pass -Bstatic instead of -Bdynamic to indicate prefering static libraries. Differential Revision: https://reviews.llvm.org/D43811 Modified: cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/mingw-libgcc.c cfe/trunk/test/Driver/windows-cross.c Modified: cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp?rev=326235&r1=326234&r2=326235&view=diff == --- cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp Tue Feb 27 11:42:19 2018 @@ -127,7 +127,8 @@ void tools::CrossWindows::Linker::Constr } CmdArgs.push_back("-shared"); -CmdArgs.push_back("-Bdynamic"); +CmdArgs.push_back(Args.hasArg(options::OPT_static) ? "-Bstatic" + : "-Bdynamic"); CmdArgs.push_back("--enable-auto-image-base"); Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=326235&r1=326234&r2=326235&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Feb 27 11:42:19 2018 @@ -141,22 +141,21 @@ void tools::MinGW::Linker::ConstructJob( CmdArgs.push_back("console"); } + if (Args.hasArg(options::OPT_mdll)) +CmdArgs.push_back("--dll"); + else if (Args.hasArg(options::OPT_shared)) +CmdArgs.push_back("--shared"); if (Args.hasArg(options::OPT_static)) CmdArgs.push_back("-Bstatic"); - else { -if (Args.hasArg(options::OPT_mdll)) - CmdArgs.push_back("--dll"); -else if (Args.hasArg(options::OPT_shared)) - CmdArgs.push_back("--shared"); + else CmdArgs.push_back("-Bdynamic"); -if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) { - CmdArgs.push_back("-e"); - if (TC.getArch() == llvm::Triple::x86) -CmdArgs.push_back("_DllMainCRTStartup@12"); - else -CmdArgs.push_back("DllMainCRTStartup"); - CmdArgs.push_back("--enable-auto-image-base"); -} + if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) { +CmdArgs.push_back("-e"); +if (TC.getArch() == llvm::Triple::x86) + CmdArgs.push_back("_DllMainCRTStartup@12"); +else + CmdArgs.push_back("DllMainCRTStartup"); +CmdArgs.push_back("--enable-auto-image-base"); } CmdArgs.push_back("-o"); Modified: cfe/trunk/test/Driver/mingw-libgcc.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-libgcc.c?rev=326235&r1=326234&r2=326235&view=diff == --- cfe/trunk/test/Driver/mingw-libgcc.c (original) +++ cfe/trunk/test/Driver/mingw-libgcc.c Tue Feb 27 11:42:19 2018 @@ -2,11 +2,11 @@ // Verified with gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project). // gcc, static -// RUN: %clang -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s +// RUN: %clang -static -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BSTATIC %s +// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s +// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BSTATIC %s +// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BDYNAMIC %s // gcc, dynamic // RUN: %clang -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNA
r326476 - [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
Author: mstorsjo Date: Thu Mar 1 12:22:57 2018 New Revision: 326476 URL: http://llvm.org/viewvc/llvm-project?rev=326476&view=rev Log: [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC Make types with sizes that aren't a power of two an error (that can be disabled) in structs with ms_struct layout, except on mingw where the situation is quite likely to occur and GCC handles it silently. Differential Revision: https://reviews.llvm.org/D43908 Added: cfe/trunk/test/CodeGen/ms_struct-long-double.c Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=326476&r1=326475&r2=326476&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar 1 12:22:57 2018 @@ -759,6 +759,10 @@ def warn_cxx_ms_struct : Warning<"ms_struct may not produce Microsoft-compatible layouts for classes " "with base classes or virtual functions">, DefaultError, InGroup; +def warn_npot_ms_struct : + Warning<"ms_struct may not produce Microsoft-compatible layouts with fundamental " + "data types with sizes that aren't a power of two">, + DefaultError, InGroup; def err_section_conflict : Error<"%0 causes a section type conflict with %1">; def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">; def err_invalid_super_scope : Error<"invalid use of '__super', " Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=326476&r1=326475&r2=326476&view=diff == --- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original) +++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Thu Mar 1 12:22:57 2018 @@ -1752,10 +1752,32 @@ void ItaniumRecordLayoutBuilder::LayoutF QualType T = Context.getBaseElementType(D->getType()); if (const BuiltinType *BTy = T->getAs()) { CharUnits TypeSize = Context.getTypeSizeInChars(BTy); -assert( -(llvm::isPowerOf2_64(TypeSize.getQuantity()) || - Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) && -"Non PowerOf2 size outside of GNU mode"); + +if (!llvm::isPowerOf2_64(TypeSize.getQuantity())) { + assert( + !Context.getTargetInfo().getTriple().isWindowsMSVCEnvironment() && + "Non PowerOf2 size in MSVC mode"); + // Base types with sizes that aren't a power of two don't work + // with the layout rules for MS structs. This isn't an issue in + // MSVC itself since there are no such base data types there. + // On e.g. x86_32 mingw and linux, long double is 12 bytes though. + // Any structs involving that data type obviously can't be ABI + // compatible with MSVC regardless of how it is laid out. + + // Since ms_struct can be mass enabled (via a pragma or via the + // -mms-bitfields command line parameter), this can trigger for + // structs that don't actually need MSVC compatibility, so we + // need to be able to sidestep the ms_struct layout for these types. + + // Since the combination of -mms-bitfields together with structs + // like max_align_t (which contains a long double) for mingw is + // quite comon (and GCC handles it silently), just handle it + // silently there. For other targets that have ms_struct enabled + // (most probably via a pragma or attribute), trigger a diagnostic + // that defaults to an error. + if (!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) +Diag(D->getLocation(), diag::warn_npot_ms_struct); +} if (TypeSize > FieldAlign && llvm::isPowerOf2_64(TypeSize.getQuantity())) FieldAlign = TypeSize; Added: cfe/trunk/test/CodeGen/ms_struct-long-double.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms_struct-long-double.c?rev=326476&view=auto == --- cfe/trunk/test/CodeGen/ms_struct-long-double.c (added) +++ cfe/trunk/test/CodeGen/ms_struct-long-double.c Thu Mar 1 12:22:57 2018 @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm-only -triple i686-windows-gnu -fdump-record-layouts %s | FileCheck %s +// RUN: %clang_cc1 -emit-llvm-only -triple i686-linux -fdump-record-layouts -Wno-incompatible-ms-struct %s | FileCheck %s +// RUN: not %clang_cc1 -emit-llvm-only -triple i686-linux -fdump-record-layouts %s 2>&1 | FileCheck %s -check-prefix=ERROR + +struct ldb_struct {
r333734 - [X86] Remove leftover semicolons at end of macros
Author: mstorsjo Date: Fri Jun 1 02:40:50 2018 New Revision: 333734 URL: http://llvm.org/viewvc/llvm-project?rev=333734&view=rev Log: [X86] Remove leftover semicolons at end of macros This was missed in a few places in SVN r333613, causing compilation errors if these macros are used e.g. as parameter to a function. Modified: cfe/trunk/lib/Headers/avx512fintrin.h cfe/trunk/lib/Headers/f16cintrin.h cfe/trunk/lib/Headers/gfniintrin.h cfe/trunk/lib/Headers/shaintrin.h cfe/trunk/lib/Headers/vpclmulqdqintrin.h Modified: cfe/trunk/lib/Headers/avx512fintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=333734&r1=333733&r2=333734&view=diff == --- cfe/trunk/lib/Headers/avx512fintrin.h (original) +++ cfe/trunk/lib/Headers/avx512fintrin.h Fri Jun 1 02:40:50 2018 @@ -2226,13 +2226,13 @@ _mm512_maskz_sub_ps(__mmask16 __U, __m51 (__m512)__builtin_ia32_subps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)(__m512)(W), (__mmask16)(U), \ - (int)(R)); + (int)(R)) #define _mm512_maskz_sub_round_ps(U, A, B, R) \ (__m512)__builtin_ia32_subps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(U), (int)(R)); + (__mmask16)(U), (int)(R)) static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_mask_mul_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) { @@ -2361,13 +2361,13 @@ _mm512_maskz_mul_ps(__mmask16 __U, __m51 (__m512)__builtin_ia32_mulps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)(__m512)(W), (__mmask16)(U), \ - (int)(R)); + (int)(R)) #define _mm512_maskz_mul_round_ps(U, A, B, R) \ (__m512)__builtin_ia32_mulps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(U), (int)(R)); + (__mmask16)(U), (int)(R)) static __inline__ __m128 __DEFAULT_FN_ATTRS _mm_mask_div_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) { @@ -2509,13 +2509,13 @@ _mm512_maskz_div_ps(__mmask16 __U, __m51 (__m512)__builtin_ia32_divps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)(__m512)(W), (__mmask16)(U), \ - (int)(R)); + (int)(R)) #define _mm512_maskz_div_round_ps(U, A, B, R) \ (__m512)__builtin_ia32_divps512_mask((__v16sf)(__m512)(A), \ (__v16sf)(__m512)(B), \ (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(U), (int)(R)); + (__mmask16)(U), (int)(R)) #define _mm512_roundscale_ps(A, B) \ (__m512)__builtin_ia32_rndscaleps_mask((__v16sf)(__m512)(A), (int)(B), \ Modified: cfe/trunk/lib/Headers/f16cintrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/f16cintrin.h?rev=333734&r1=333733&r2=333734&view=diff == --- cfe/trunk/lib/Headers/f16cintrin.h (original) +++ cfe/trunk/lib/Headers/f16cintrin.h Fri Jun 1 02:40:50 2018 @@ -79,7 +79,7 @@ _cvtsh_ss(unsigned short __a) /// \returns The converted 16-bit half-precision float value. #define _cvtss_sh(a, imm) \ (unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \ - (imm)))[0]); + (imm)))[0]) /// Converts a 128-bit vector containing 32-bit float values into a ///128-bit vector containing 16-bit half-precision float values. @@ -105,7 +105,7 @@ _cvtsh_ss(unsigned short __a) ///values. The lower 64 bits are used to store the converted 16-bit ///half-precision floating-point values. #define _mm_cvtps_ph(a, imm) \ - (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm)); + (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm)) /// Converts a 128-bit vector containing 16-bit half-precision float ///values into a 128-bit vector containing 32-bit float values. @@ -148,7 +148,7 @@ _mm_cvtph_ps(__m128i __a) /// \returns A 128-bit vector containing the converted 16-bit half-precision ///float values. #def
[libunwind] r335169 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 13:53:19 2018 New Revision: 335169 URL: http://llvm.org/viewvc/llvm-project?rev=335169&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48353 Modified: libunwind/trunk/CMakeLists.txt libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=335169&r1=335168&r2=335169&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Wed Jun 20 13:53:19 2018 @@ -59,10 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335169&r1=335168&r2=335169&view=diff == --- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:53:19 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r335171 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 13:59:18 2018 New Revision: 335171 URL: http://llvm.org/viewvc/llvm-project?rev=335171&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48355 Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335171&r1=335170&r2=335171&view=diff == --- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:59:18 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Modified: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335171&r1=335170&r2=335171&view=diff == --- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 13:59:18 2018 @@ -46,10 +46,11 @@ macro(find_llvm_parts) OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r335172 - [CMake] Convert paths to the right form in standalone builds on Windows
Author: mstorsjo Date: Wed Jun 20 14:03:34 2018 New Revision: 335172 URL: http://llvm.org/viewvc/llvm-project?rev=335172&view=rev Log: [CMake] Convert paths to the right form in standalone builds on Windows The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48356 Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335172&r1=335171&r2=335172&view=diff == --- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 14:03:34 2018 @@ -14,6 +14,7 @@ function(find_compiler_rt_library name d OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) + file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}") if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}") message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}") @@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_DIR ) string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR) +file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR) set(LIBRARY_DIR "${LIBRARY_DIR}/darwin") else() set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS} @@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest) OUTPUT_VARIABLE LIBRARY_FILE ) string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE) +file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE) get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY) endif() if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}") Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335172&r1=335171&r2=335172&view=diff == --- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original) +++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 14:03:34 2018 @@ -46,10 +46,11 @@ macro(find_llvm_parts) OUTPUT_VARIABLE CONFIG_OUTPUT ERROR_QUIET) if(NOT HAD_ERROR) - string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH) + string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG) + file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH) else() - set(LLVM_CMAKE_PATH - "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") + file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE) + set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") endif() else() set(LLVM_FOUND OFF) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344125 - [MinGW] Fix passing a sanitizer lib name as dependent lib
Author: mstorsjo Date: Wed Oct 10 02:01:00 2018 New Revision: 344125 URL: http://llvm.org/viewvc/llvm-project?rev=344125&view=rev Log: [MinGW] Fix passing a sanitizer lib name as dependent lib Differential Revision: https://reviews.llvm.org/D52990 Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp cfe/trunk/test/Driver/fsanitize.c Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=344125&r1=344124&r2=344125&view=diff == --- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original) +++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 10 02:01:00 2018 @@ -2337,7 +2337,7 @@ static std::string qualifyWindowsLibrary bool Quote = (Lib.find(" ") != StringRef::npos); std::string ArgStr = Quote ? "\"" : ""; ArgStr += Lib; - if (!Lib.endswith_lower(".lib")) + if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a")) ArgStr += ".lib"; ArgStr += Quote ? "\"" : ""; return ArgStr; Modified: cfe/trunk/test/Driver/fsanitize.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=344125&r1=344124&r2=344125&view=diff == --- cfe/trunk/test/Driver/fsanitize.c (original) +++ cfe/trunk/test/Driver/fsanitize.c Wed Oct 10 02:01:00 2018 @@ -17,9 +17,11 @@ // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 +// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64-MINGW // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib" // CHECK-UNDEFINED-WIN64: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib" +// CHECK-UNDEFINED-WIN64-MINGW: "--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a" // CHECK-UNDEFINED-WIN-CXX: "--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib" // CHECK-UNDEFINED-WIN-SAME: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r344412 - [MinGW] Allow using LTO when lld is used as linker
Author: mstorsjo Date: Fri Oct 12 13:15:51 2018 New Revision: 344412 URL: http://llvm.org/viewvc/llvm-project?rev=344412&view=rev Log: [MinGW] Allow using LTO when lld is used as linker Differential Revision: https://reviews.llvm.org/D53195 Added: cfe/trunk/test/Driver/mingw-lto.c Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.h Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=344412&r1=344411&r2=344412&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Fri Oct 12 13:15:51 2018 @@ -10,6 +10,7 @@ #include "MinGW.h" #include "InputInfo.h" #include "CommonArgs.h" +#include "clang/Config/config.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" @@ -376,6 +377,10 @@ toolchains::MinGW::MinGW(const Driver &D getFilePaths().push_back(Base + "lib"); // openSUSE getFilePaths().push_back(Base + Arch + "/sys-root/mingw/lib"); + + NativeLLVMSupport = + Args.getLastArgValue(options::OPT_fuse_ld_EQ, CLANG_DEFAULT_LINKER) + .equals_lower("lld"); } bool toolchains::MinGW::IsIntegratedAssemblerDefault() const { return true; } @@ -403,6 +408,10 @@ Tool *toolchains::MinGW::buildLinker() c return new tools::MinGW::Linker(*this); } +bool toolchains::MinGW::HasNativeLLVMSupport() const { + return NativeLLVMSupport; +} + bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { return getArch() == llvm::Triple::x86_64; } Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=344412&r1=344411&r2=344412&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Fri Oct 12 13:15:51 2018 @@ -59,6 +59,8 @@ public: MinGW(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); + bool HasNativeLLVMSupport() const override; + bool IsIntegratedAssemblerDefault() const override; bool IsUnwindTablesDefault(const llvm::opt::ArgList &Args) const override; bool isPICDefault() const override; @@ -99,6 +101,8 @@ private: void findGccLibDir(); llvm::ErrorOr findGcc(); llvm::ErrorOr findClangRelativeSysroot(); + + bool NativeLLVMSupport; }; } // end namespace toolchains Added: cfe/trunk/test/Driver/mingw-lto.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-lto.c?rev=344412&view=auto == --- cfe/trunk/test/Driver/mingw-lto.c (added) +++ cfe/trunk/test/Driver/mingw-lto.c Fri Oct 12 13:15:51 2018 @@ -0,0 +1,4 @@ +// The default linker doesn't support LLVM bitcode +// RUN: not %clang -target i686-pc-windows-gnu %s -flto -fuse-ld=bfd +// When using lld, this is allowed though. +// RUN: %clang -target i686-pc-windows-gnu -### %s -flto -fuse-ld=lld ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345003 - [MinGW] Link to correct openmp library
Author: mstorsjo Date: Mon Oct 22 23:33:22 2018 New Revision: 345003 URL: http://llvm.org/viewvc/llvm-project?rev=345003&view=rev Log: [MinGW] Link to correct openmp library Patch by Peiyuan Song! Differential Revision: https://reviews.llvm.org/D53397 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/fopenmp.c Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=345003&r1=345002&r2=345003&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Oct 22 23:33:22 2018 @@ -220,8 +220,24 @@ void tools::MinGW::Linker::ConstructJob( CmdArgs.push_back("-lssp_nonshared"); CmdArgs.push_back("-lssp"); } - if (Args.hasArg(options::OPT_fopenmp)) -CmdArgs.push_back("-lgomp"); + + if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ, + options::OPT_fno_openmp, false)) { +switch (TC.getDriver().getOpenMPRuntime(Args)) { +case Driver::OMPRT_OMP: + CmdArgs.push_back("-lomp"); + break; +case Driver::OMPRT_IOMP5: + CmdArgs.push_back("-liomp5md"); + break; +case Driver::OMPRT_GOMP: + CmdArgs.push_back("-lgomp"); + break; +case Driver::OMPRT_Unknown: + // Already diagnosed. + break; +} + } AddLibGCC(Args, CmdArgs); Modified: cfe/trunk/test/Driver/fopenmp.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fopenmp.c?rev=345003&r1=345002&r2=345003&view=diff == --- cfe/trunk/test/Driver/fopenmp.c (original) +++ cfe/trunk/test/Driver/fopenmp.c Mon Oct 22 23:33:22 2018 @@ -10,6 +10,9 @@ // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // // CHECK-CC1-OPENMP: "-cc1" // CHECK-CC1-OPENMP: "-fopenmp" @@ -49,6 +52,14 @@ // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD +// +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5MD +// // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-OMP: "-lomp" // @@ -60,6 +71,9 @@ // CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-IOMP5: "-liomp5" // +// CHECK-LD-IOMP5MD: "{{.*}}ld{{(.exe)?}}" +// CHECK-LD-IOMP5MD: "-liomp5md" +// // CHECK-NO-OMP: "{{.*}}ld{{(.exe)?}}" // CHECK-NO-OMP-NOT: "-lomp" // @@ -69,6 +83,9 @@ // CHECK-NO-IOMP5: "{{.*}}ld{{(.exe)?}}" // CHECK-NO-IOMP5-NOT: "-liomp5" // +// CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}" +// CHECK-NO-IOMP5MD-NOT: "-liomp5md" +// // We'd like to check that the default is sane, but until we have the ability // to *always* semantically analyze OpenMP without always generating runtime // calls (in the event of an unsupported runtime), we don't have a good way to @@ -79,6 +96,10 @@ // RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY // RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY // RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang -target x86_64-windows-gnu -fopenmp %s
r345004 - [Driver] Use forward slashes in most linker arguments
Author: mstorsjo Date: Mon Oct 22 23:33:26 2018 New Revision: 345004 URL: http://llvm.org/viewvc/llvm-project?rev=345004&view=rev Log: [Driver] Use forward slashes in most linker arguments libtool inspects the output of $CC -v to detect what object files and libraries are linked in by default. When clang is built as a native windows executable, all paths are formatted with backslashes, and the backslashes cause each argument to be enclosed in quotes. The backslashes and quotes break further processing within libtool (which is implemented in shell script, running in e.g. msys) pretty badly. Between unix style pathes (that only work in tools that are linked to the msys runtime, essentially the same as cygwin) and proper windows style paths (with backslashes, that can easily break shell scripts and msys environments), the best compromise is to use windows style paths (starting with e.g. c:) but with forward slashes, which both msys based tools, shell scripts and native windows executables can cope with. This incidentally turns out to be the form of paths that GCC prints out when run with -v on windows as well. This change potentially makes the output from clang -v a bit more inconsistent, but it is isn't necessarily very consistent to begin with. Differential Revision: https://reviews.llvm.org/D53066 Modified: cfe/trunk/lib/Driver/ToolChain.cpp Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345004&r1=345003&r2=345004&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct 22 23:33:26 2018 @@ -378,7 +378,7 @@ std::string ToolChain::getCompilerRT(con SmallString<128> P(LibPath); llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix); if (getVFS().exists(P)) - return P.str(); + return llvm::sys::path::convert_to_slash(P); } StringRef Arch = getArchNameForCompilerRTLib(*this, Args); @@ -386,7 +386,7 @@ std::string ToolChain::getCompilerRT(con SmallString<128> Path(getCompilerRTPath()); llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" + Arch + Env + Suffix); - return Path.str(); + return llvm::sys::path::convert_to_slash(Path); } const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args, @@ -425,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct } std::string ToolChain::GetFilePath(const char *Name) const { - return D.GetFilePath(Name, *this); + return llvm::sys::path::convert_to_slash(D.GetFilePath(Name, *this)); } std::string ToolChain::GetProgramPath(const char *Name) const { @@ -774,12 +774,14 @@ void ToolChain::AddCXXStdlibLibArgs(cons void ToolChain::AddFilePathLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { for (const auto &LibPath : getLibraryPaths()) -if(LibPath.length() > 0) - CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); +if (LibPath.length() > 0) + CmdArgs.push_back(Args.MakeArgString( + StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath))); for (const auto &LibPath : getFilePaths()) -if(LibPath.length() > 0) - CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); +if (LibPath.length() > 0) + CmdArgs.push_back(Args.MakeArgString( + StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath))); } void ToolChain::AddCCKextLibArgs(const ArgList &Args, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345005 - Revert "[Driver] Use forward slashes in most linker arguments"
Author: mstorsjo Date: Tue Oct 23 00:01:55 2018 New Revision: 345005 URL: http://llvm.org/viewvc/llvm-project?rev=345005&view=rev Log: Revert "[Driver] Use forward slashes in most linker arguments" This reverts commit r345004, as it broke tests when actually run on windows; see e.g. http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763. This broke tests that had captured a variable containing a path with backslashes, which failed to match cases in the output where the path separators had been changed into forward slashes. Modified: cfe/trunk/lib/Driver/ToolChain.cpp Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345005&r1=345004&r2=345005&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Oct 23 00:01:55 2018 @@ -378,7 +378,7 @@ std::string ToolChain::getCompilerRT(con SmallString<128> P(LibPath); llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix); if (getVFS().exists(P)) - return llvm::sys::path::convert_to_slash(P); + return P.str(); } StringRef Arch = getArchNameForCompilerRTLib(*this, Args); @@ -386,7 +386,7 @@ std::string ToolChain::getCompilerRT(con SmallString<128> Path(getCompilerRTPath()); llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" + Arch + Env + Suffix); - return llvm::sys::path::convert_to_slash(Path); + return Path.str(); } const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args, @@ -425,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct } std::string ToolChain::GetFilePath(const char *Name) const { - return llvm::sys::path::convert_to_slash(D.GetFilePath(Name, *this)); + return D.GetFilePath(Name, *this); } std::string ToolChain::GetProgramPath(const char *Name) const { @@ -774,14 +774,12 @@ void ToolChain::AddCXXStdlibLibArgs(cons void ToolChain::AddFilePathLibArgs(const ArgList &Args, ArgStringList &CmdArgs) const { for (const auto &LibPath : getLibraryPaths()) -if (LibPath.length() > 0) - CmdArgs.push_back(Args.MakeArgString( - StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath))); +if(LibPath.length() > 0) + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); for (const auto &LibPath : getFilePaths()) -if (LibPath.length() > 0) - CmdArgs.push_back(Args.MakeArgString( - StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath))); +if(LibPath.length() > 0) + CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath)); } void ToolChain::AddCCKextLibArgs(const ArgList &Args, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r345370 - Reapply: [Driver] Use forward slashes in most linker arguments
Author: mstorsjo Date: Fri Oct 26 00:01:59 2018 New Revision: 345370 URL: http://llvm.org/viewvc/llvm-project?rev=345370&view=rev Log: Reapply: [Driver] Use forward slashes in most linker arguments libtool inspects the output of $CC -v to detect what object files and libraries are linked in by default. When clang is built as a native windows executable, all paths are formatted with backslashes, and the backslashes cause each argument to be enclosed in quotes. The backslashes and quotes break further processing within libtool (which is implemented in shell script, running in e.g. msys) pretty badly. Between unix style pathes (that only work in tools that are linked to the msys runtime, essentially the same as cygwin) and proper windows style paths (with backslashes, that can easily break shell scripts and msys environments), the best compromise is to use windows style paths (starting with e.g. c:) but with forward slashes, which both msys based tools, shell scripts and native windows executables can cope with. This incidentally turns out to be the form of paths that GCC prints out when run with -v on windows as well. This change potentially makes the output from clang -v a bit more inconsistent, but it is isn't necessarily very consistent to begin with. Compared to the previous attempt in SVN r345004, this now does the same transformation on more paths, hopefully on the right set of paths so that all tests pass (previously some tests failed, where path fragments that were required to be identical turned out to use different path separators in different places). This now also is done only for non-windows, or cygwin/mingw targets, to preserve all backslashes for MSVC cases (where the paths can end up e.g. embedded into PDB files. (The transformation function itself, llvm::sys::path::convert_to_slash only has an effect when run on windows.) Differential Revision: https://reviews.llvm.org/D53066 Modified: cfe/trunk/include/clang/Driver/ToolChain.h cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Modified: cfe/trunk/include/clang/Driver/ToolChain.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=345370&r1=345369&r2=345370&view=diff == --- cfe/trunk/include/clang/Driver/ToolChain.h (original) +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 26 00:01:59 2018 @@ -21,6 +21,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/Option/Option.h" +#include "llvm/Support/Path.h" #include "llvm/Support/VersionTuple.h" #include "llvm/Target/TargetOptions.h" #include @@ -370,6 +371,12 @@ public: StringRef Component, bool Shared = false) const; + std::string normalizePath(StringRef Path) const { +if (!Triple.isOSWindows() || Triple.isOSCygMing()) + return llvm::sys::path::convert_to_slash(Path); +return Path; + } + // Returns /lib//. This is used by runtimes (such // as OpenMP) to find arch-specific libraries. std::string getArchSpecificLibPath() const; Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=345370&r1=345369&r2=345370&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 26 00:01:59 2018 @@ -1011,6 +1011,12 @@ Compilation *Driver::BuildCompilation(Ar .Default(SaveTempsCwd); } + llvm::Triple EffectiveTriple = computeTargetTriple(*this, TargetTriple, Args); + if (!EffectiveTriple.isOSWindows() || EffectiveTriple.isOSCygMing()) { +for (auto *Str : {&Dir, &InstalledDir, &SysRoot, &ResourceDir}) + *Str = llvm::sys::path::convert_to_slash(*Str); + } + setLTOMode(Args); // Process -fembed-bitcode= flags. Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345370&r1=345369&r2=345370&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 26 00:01:59 2018 @@ -376,9 +376,10 @@ std::string ToolChain::getCompilerRT(con for (const auto &LibPath : getLibraryPaths()) { SmallString<128> P(LibPath); -llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix); +llvm::sys::path::append(P, +Prefix + Twine("clang_rt.") + Component + Suffix); if (getVFS().exists(P)) - return P.str(); + return normalizePath(P); } StringRef Arch = getArchNameForCompilerRTLib(*this, Args); @@
r345372 - Revert "Reapply: [Driver] Use forward slashes in most linker arguments"
Author: mstorsjo Date: Fri Oct 26 01:33:29 2018 New Revision: 345372 URL: http://llvm.org/viewvc/llvm-project?rev=345372&view=rev Log: Revert "Reapply: [Driver] Use forward slashes in most linker arguments" This reverts commit r345370, as it uncovered even more issues in tests with partial/inconsistent path normalization: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/13562 http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/886 http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20994 In particular, these tests seem to have failed: Clang :: CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll Clang :: CodeGen/thinlto-multi-module.ll Clang :: Driver/cuda-external-tools.cu Clang :: Driver/cuda-options.cu Clang :: Driver/hip-toolchain-no-rdc.hip Clang :: Driver/hip-toolchain-rdc.hip Clang :: Driver/openmp-offload-gpu.c At least the Driver tests could potentially be fixed by extending the path normalization to even more places, but the issues with the CodeGen tests are still unknown. In addition, a number of other tests seem to have been broken in other clang dependent tools such as clang-tidy and clangd. Modified: cfe/trunk/include/clang/Driver/ToolChain.h cfe/trunk/lib/Driver/Driver.cpp cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Modified: cfe/trunk/include/clang/Driver/ToolChain.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=345372&r1=345371&r2=345372&view=diff == --- cfe/trunk/include/clang/Driver/ToolChain.h (original) +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 26 01:33:29 2018 @@ -21,7 +21,6 @@ #include "llvm/ADT/Triple.h" #include "llvm/MC/MCTargetOptions.h" #include "llvm/Option/Option.h" -#include "llvm/Support/Path.h" #include "llvm/Support/VersionTuple.h" #include "llvm/Target/TargetOptions.h" #include @@ -371,12 +370,6 @@ public: StringRef Component, bool Shared = false) const; - std::string normalizePath(StringRef Path) const { -if (!Triple.isOSWindows() || Triple.isOSCygMing()) - return llvm::sys::path::convert_to_slash(Path); -return Path; - } - // Returns /lib//. This is used by runtimes (such // as OpenMP) to find arch-specific libraries. std::string getArchSpecificLibPath() const; Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=345372&r1=345371&r2=345372&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 26 01:33:29 2018 @@ -1011,12 +1011,6 @@ Compilation *Driver::BuildCompilation(Ar .Default(SaveTempsCwd); } - llvm::Triple EffectiveTriple = computeTargetTriple(*this, TargetTriple, Args); - if (!EffectiveTriple.isOSWindows() || EffectiveTriple.isOSCygMing()) { -for (auto *Str : {&Dir, &InstalledDir, &SysRoot, &ResourceDir}) - *Str = llvm::sys::path::convert_to_slash(*Str); - } - setLTOMode(Args); // Process -fembed-bitcode= flags. Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345372&r1=345371&r2=345372&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 26 01:33:29 2018 @@ -376,10 +376,9 @@ std::string ToolChain::getCompilerRT(con for (const auto &LibPath : getLibraryPaths()) { SmallString<128> P(LibPath); -llvm::sys::path::append(P, -Prefix + Twine("clang_rt.") + Component + Suffix); +llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + Suffix); if (getVFS().exists(P)) - return normalizePath(P); + return P.str(); } StringRef Arch = getArchNameForCompilerRTLib(*this, Args); @@ -387,7 +386,7 @@ std::string ToolChain::getCompilerRT(con SmallString<128> Path(getCompilerRTPath()); llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" + Arch + Env + Suffix); - return normalizePath(Path); + return Path.str(); } const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList &Args, @@ -426,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct } std::string ToolChain::GetFilePath(const char *Name) const { - return normalizePath(D.GetFilePath(Name, *this)); + return D.GetFilePath(Name, *this); } std::string ToolChain::GetProgramPath(const char *Name) const { @@ -775,14 +774,1
[libunwind] r351587 - [SjLj] Don't use __declspec(thread) in MinGW mode
Author: mstorsjo Date: Fri Jan 18 12:31:12 2019 New Revision: 351587 URL: http://llvm.org/viewvc/llvm-project?rev=351587&view=rev Log: [SjLj] Don't use __declspec(thread) in MinGW mode GCC and Clang in MinGW mode don't support __declspec(thread), which after expanding macros ends up as __attribute__((thread)). Use the GCC specific attribute __thread instead (the next one in the chain of alternatives). Differential Revision: https://reviews.llvm.org/D56905 Modified: libunwind/trunk/src/Unwind-sjlj.c Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=351587&r1=351586&r2=351587&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Fri Jan 18 12:31:12 2019 @@ -52,7 +52,7 @@ struct _Unwind_FunctionContext { #else # if __STDC_VERSION__ >= 201112L # define _LIBUNWIND_THREAD_LOCAL _Thread_local -# elif defined(_WIN32) +# elif defined(_MSC_VER) # define _LIBUNWIND_THREAD_LOCAL __declspec(thread) # elif defined(__GNUC__) || defined(__clang__) # define _LIBUNWIND_THREAD_LOCAL __thread ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r351875 - Enable LLVM_ENABLE_WARNINGS when building standalone out of tree
Author: mstorsjo Date: Tue Jan 22 12:50:33 2019 New Revision: 351875 URL: http://llvm.org/viewvc/llvm-project?rev=351875&view=rev Log: Enable LLVM_ENABLE_WARNINGS when building standalone out of tree When built within the llvm runtimes directory, the runtimes CMakeLists.txt adds the same. Differential Revision: https://reviews.llvm.org/D56981 Modified: libunwind/trunk/CMakeLists.txt Modified: libunwind/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=351875&r1=351874&r2=351875&view=diff == --- libunwind/trunk/CMakeLists.txt (original) +++ libunwind/trunk/CMakeLists.txt Tue Jan 22 12:50:33 2019 @@ -73,6 +73,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR endif() if (EXISTS ${LLVM_CMAKE_PATH}) +# Enable warnings, otherwise -w gets added to the cflags by HandleLLVMOptions. +set(LLVM_ENABLE_WARNINGS ON) list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}") include("${LLVM_CMAKE_PATH}/AddLLVM.cmake") include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake") ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r351876 - Fix warnings about printf format strings
Author: mstorsjo Date: Tue Jan 22 12:50:39 2019 New Revision: 351876 URL: http://llvm.org/viewvc/llvm-project?rev=351876&view=rev Log: Fix warnings about printf format strings Either adjust the format string to use a more exact type, or add casts (for cases when printing pointers to structs/objects with a %p format specifier). Differential Revision: https://reviews.llvm.org/D56982 Modified: libunwind/trunk/src/Unwind-seh.cpp libunwind/trunk/src/Unwind-sjlj.c Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351876&r1=351875&r2=351876&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 12:50:39 2019 @@ -77,7 +77,9 @@ _GCC_specific_handler(PEXCEPTION_RECORD uintptr_t retval, target; bool ours = false; - _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler(%#010x(%x), %p)", ms_exc->ExceptionCode, ms_exc->ExceptionFlags, frame); + _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler(%#010lx(%lx), %p)", + ms_exc->ExceptionCode, ms_exc->ExceptionFlags, + (void *)frame); if (ms_exc->ExceptionCode == STATUS_GCC_UNWIND) { if (IS_TARGET_UNWIND(ms_exc->ExceptionFlags)) { // Set up the upper return value (the lower one and the target PC @@ -129,7 +131,10 @@ _GCC_specific_handler(PEXCEPTION_RECORD } } - _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() calling personality function %p(1, %d, %llx, %p, %p)", pers, action, exc->exception_class, exc, ctx); + _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() calling personality " + "function %p(1, %d, %llx, %p, %p)", + (void *)pers, action, exc->exception_class, + (void *)exc, (void *)ctx); urc = pers(1, action, exc->exception_class, exc, ctx); _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() personality returned %d", urc); switch (urc) { Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=351876&r1=351875&r2=351876&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Tue Jan 22 12:50:39 2019 @@ -11,6 +11,7 @@ #include +#include #include #include #include @@ -107,7 +108,8 @@ _Unwind_SjLj_Unregister(struct _Unwind_F static _Unwind_Reason_Code unwind_phase1(struct _Unwind_Exception *exception_object) { _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack(); - _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p", c); + _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p", + (void *)c); // walk each frame looking for a place to stop for (bool handlerNotFound = true; handlerNotFound; c = c->prev) { @@ -116,17 +118,18 @@ unwind_phase1(struct _Unwind_Exception * if (c == NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): reached " "bottom => _URC_END_OF_STACK", - exception_object); + (void *)exception_object); return _URC_END_OF_STACK; } -_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", c); +_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", (void *)c); // if there is a personality routine, ask it if it will want to stop at this // frame if (c->personality != NULL) { _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): calling " -"personality function %p", - exception_object, c->personality); + "personality function %p", + (void *)exception_object, + (void *)c->personality); _Unwind_Reason_Code personalityResult = (*c->personality)( 1, _UA_SEARCH_PHASE, exception_object->exception_class, exception_object, (struct _Unwind_Context *)c); @@ -137,12 +140,14 @@ unwind_phase1(struct _Unwind_Exception * handlerNotFound = false; exception_object->private_2 = (uintptr_t) c; _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " - "_URC_HANDLER_FOUND", exception_object); + "_URC_HANDLER_FOUND", + (void *)exception_object); return _URC_NO_REASON; case _URC_CONTINUE_UNWIND: _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): " - "_URC_CONTINUE_UNWIND", exception_object); + "_URC_CONT
[libunwind] r351877 - Add casts to avoid warnings about implicit conversions losing precision
Author: mstorsjo Date: Tue Jan 22 12:50:42 2019 New Revision: 351877 URL: http://llvm.org/viewvc/llvm-project?rev=351877&view=rev Log: Add casts to avoid warnings about implicit conversions losing precision This fixes warnings like these: DwarfInstructions.hpp:85:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] DwarfInstructions.hpp:88:25: warning: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'libunwind::DwarfInstructions::pint_t' (aka 'unsigned int') [-Wshorten-64-to-32] Differential Revision: https://reviews.llvm.org/D56983 Modified: libunwind/trunk/src/DwarfInstructions.hpp Modified: libunwind/trunk/src/DwarfInstructions.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=351877&r1=351876&r2=351877&view=diff == --- libunwind/trunk/src/DwarfInstructions.hpp (original) +++ libunwind/trunk/src/DwarfInstructions.hpp Tue Jan 22 12:50:42 2019 @@ -81,12 +81,11 @@ typename A::pint_t DwarfInstructions::kRegisterInCFA: -return addressSpace.getRegister(cfa + (pint_t)savedReg.value); +return (pint_t)addressSpace.getRegister(cfa + (pint_t)savedReg.value); case CFI_Parser::kRegisterAtExpression: -return addressSpace.getRegister( -evaluateExpression((pint_t)savedReg.value, addressSpace, -registers, cfa)); +return (pint_t)addressSpace.getRegister(evaluateExpression( +(pint_t)savedReg.value, addressSpace, registers, cfa)); case CFI_Parser::kRegisterIsExpression: return evaluateExpression((pint_t)savedReg.value, addressSpace, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r351878 - Remove an unused variable
Author: mstorsjo Date: Tue Jan 22 12:50:45 2019 New Revision: 351878 URL: http://llvm.org/viewvc/llvm-project?rev=351878&view=rev Log: Remove an unused variable Differential Revision: https://reviews.llvm.org/D56985 Modified: libunwind/trunk/src/Unwind-seh.cpp Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351878&r1=351877&r2=351878&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 12:50:45 2019 @@ -68,7 +68,6 @@ static void _unw_seh_set_disp_ctx(unw_cu _LIBUNWIND_EXPORT EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx, DISPATCHER_CONTEXT *disp, __personality_routine pers) { - unw_context_t uc; unw_cursor_t cursor; _Unwind_Exception *exc; _Unwind_Action action; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r351888 - Silence warnings about unused parameters
Author: mstorsjo Date: Tue Jan 22 14:12:23 2019 New Revision: 351888 URL: http://llvm.org/viewvc/llvm-project?rev=351888&view=rev Log: Silence warnings about unused parameters Differential Revision: https://reviews.llvm.org/D56984 Modified: libunwind/trunk/src/AddressSpace.hpp libunwind/trunk/src/Unwind-seh.cpp libunwind/trunk/src/UnwindCursor.hpp Modified: libunwind/trunk/src/AddressSpace.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=351888&r1=351887&r2=351888&view=diff == --- libunwind/trunk/src/AddressSpace.hpp (original) +++ libunwind/trunk/src/AddressSpace.hpp Tue Jan 22 14:12:23 2019 @@ -456,6 +456,8 @@ inline bool LocalAddressSpace::findUnwin #elif defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32) // Don't even bother, since Windows has functions that do all this stuff // for us. + (void)targetAddr; + (void)info; return true; #elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) && \ (__ANDROID_API__ < 21) @@ -596,6 +598,11 @@ inline bool LocalAddressSpace::findFunct return true; } } +#else + (void)addr; + (void)buf; + (void)bufLen; + (void)offset; #endif return false; } Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351888&r1=351887&r2=351888&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 14:12:23 2019 @@ -52,6 +52,7 @@ static const uint64_t kSEHExceptionClass /// Exception cleanup routine used by \c _GCC_specific_handler to /// free foreign exceptions. static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) { + (void)urc; if (exc->exception_class != kSEHExceptionClass) _LIBUNWIND_ABORT("SEH cleanup called on non-SEH exception"); free(exc); @@ -210,6 +211,8 @@ extern "C" _Unwind_Reason_Code __libunwind_seh_personality(int version, _Unwind_Action state, uint64_t klass, _Unwind_Exception *exc, struct _Unwind_Context *context) { + (void)version; + (void)klass; EXCEPTION_RECORD ms_exc; bool phase2 = (state & (_UA_SEARCH_PHASE|_UA_CLEANUP_PHASE)) == _UA_CLEANUP_PHASE; ms_exc.ExceptionCode = STATUS_GCC_THROW; Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=351888&r1=351887&r2=351888&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Tue Jan 22 14:12:23 2019 @@ -788,6 +788,8 @@ bool UnwindCursor::validFloatReg(i if (regNum >= UNW_ARM_D0 && regNum <= UNW_ARM_D31) return true; #elif defined(_LIBUNWIND_TARGET_AARCH64) if (regNum >= UNW_ARM64_D0 && regNum <= UNW_ARM64_D31) return true; +#else + (void)regNum; #endif return false; } @@ -815,6 +817,7 @@ unw_fpreg_t UnwindCursor::getFloat #elif defined(_LIBUNWIND_TARGET_AARCH64) return _msContext.V[regNum - UNW_ARM64_D0].D[0]; #else + (void)regNum; _LIBUNWIND_ABORT("float registers unimplemented"); #endif } @@ -842,6 +845,8 @@ void UnwindCursor::setFloatReg(int #elif defined(_LIBUNWIND_TARGET_AARCH64) _msContext.V[regNum - UNW_ARM64_D0].D[0] = value; #else + (void)regNum; + (void)value; _LIBUNWIND_ABORT("float registers unimplemented"); #endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r352461 - Don't define unw_fpreg_t to uint64_t for __ARM_DWARF_EH__
Author: mstorsjo Date: Tue Jan 29 01:00:32 2019 New Revision: 352461 URL: http://llvm.org/viewvc/llvm-project?rev=352461&view=rev Log: Don't define unw_fpreg_t to uint64_t for __ARM_DWARF_EH__ The existing typedef of unw_fpreg_t to uint64_t might work and be correct for the ARM_EHABI case, but for dwarf, some cases in e.g. DwarfInstructions.hpp convert between double and unw_fpreg_t. When converting implicitly between double and unw_fpreg_t (uint64_t), the values get interpreted as integers and converted to float and vice versa, while the correct thing would be to keep the same bit pattern. Avoid the whole issue by using the same definition of unw_fpreg_t as all other architectures, when using dwarf unwinding on ARM. Change assembler functions to take a void pointer instead of unw_fpreg_t pointer, to avoid having a different mangled symbol name depending on the actual value of this typedef. Differential Revision: https://reviews.llvm.org/D57001 Modified: libunwind/trunk/include/libunwind.h libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S Modified: libunwind/trunk/include/libunwind.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=352461&r1=352460&r2=352461&view=diff == --- libunwind/trunk/include/libunwind.h (original) +++ libunwind/trunk/include/libunwind.h Tue Jan 29 01:00:32 2019 @@ -75,7 +75,7 @@ typedef struct unw_addr_space *unw_addr_ typedef int unw_regnum_t; typedef uintptr_t unw_word_t; -#if defined(__arm__) +#if defined(__arm__) && !defined(__ARM_DWARF_EH__) typedef uint64_t unw_fpreg_t; #else typedef double unw_fpreg_t; Modified: libunwind/trunk/src/Registers.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=352461&r1=352460&r2=352461&view=diff == --- libunwind/trunk/src/Registers.hpp (original) +++ libunwind/trunk/src/Registers.hpp Tue Jan 29 01:00:32 2019 @@ -2103,16 +2103,16 @@ private: uint32_t __pc;// Program counter r15 }; - static void saveVFPWithFSTMD(unw_fpreg_t*); - static void saveVFPWithFSTMX(unw_fpreg_t*); - static void saveVFPv3(unw_fpreg_t*); - static void restoreVFPWithFLDMD(unw_fpreg_t*); - static void restoreVFPWithFLDMX(unw_fpreg_t*); - static void restoreVFPv3(unw_fpreg_t*); + static void saveVFPWithFSTMD(void*); + static void saveVFPWithFSTMX(void*); + static void saveVFPv3(void*); + static void restoreVFPWithFLDMD(void*); + static void restoreVFPWithFLDMX(void*); + static void restoreVFPv3(void*); #if defined(__ARM_WMMX) - static void saveiWMMX(unw_fpreg_t*); + static void saveiWMMX(void*); static void saveiWMMXControl(uint32_t*); - static void restoreiWMMX(unw_fpreg_t*); + static void restoreiWMMX(void*); static void restoreiWMMXControl(uint32_t*); #endif void restoreCoreAndJumpTo(); Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=352461&r1=352460&r2=352461&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Tue Jan 29 01:00:32 2019 @@ -658,7 +658,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #if defined(__ELF__) .fpu vfpv3-d16 #endif -DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPy) +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPv) @ VFP and iwMMX instructions are only available when compiling with the flags @ that enable them. We do not want to do that in the library (because we do not @ want the compiler to generate instructions that access those) but this is @@ -679,7 +679,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #if defined(__ELF__) .fpu vfpv3-d16 #endif -DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPy) +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPv) vldmia r0, {d0-d15} @ fldmiax is deprecated in ARMv7+ and now behaves like vldmia JMP(lr) @@ -693,7 +693,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #if defined(__ELF__) .fpu vfpv3 #endif -DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPy) +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPv) vldmia r0, {d16-d31} JMP(lr) @@ -709,7 +709,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li #if defined(__ELF__) .arch armv5te #endif -DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPy) +DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPv) ldcl p1, cr0, [r0], #8 @ wldrd wR0, [r0], #8 ldcl p1, cr1, [r0], #8 @
[libunwind] r348832 - Don't export assembly functions when function visibility annotations are disabled
Author: mstorsjo Date: Mon Dec 10 23:34:14 2018 New Revision: 348832 URL: http://llvm.org/viewvc/llvm-project?rev=348832&view=rev Log: Don't export assembly functions when function visibility annotations are disabled Patch by Peiyuan Song! Differential Revision: https://reviews.llvm.org/D55537 Modified: libunwind/trunk/src/assembly.h Modified: libunwind/trunk/src/assembly.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=348832&r1=348831&r2=348832&view=diff == --- libunwind/trunk/src/assembly.h (original) +++ libunwind/trunk/src/assembly.h Mon Dec 10 23:34:14 2018 @@ -76,7 +76,11 @@ .section .drectve,"yn" SEPARATOR\ .ascii "-export:", #name, "\0" SEPARATOR\ .text +#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS) +#define EXPORT_SYMBOL(name) +#else #define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name) +#endif #define HIDDEN_SYMBOL(name) #define NO_EXEC_STACK_DIRECTIVE ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r348836 - [SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnwindEx
Author: mstorsjo Date: Tue Dec 11 01:53:11 2018 New Revision: 348836 URL: http://llvm.org/viewvc/llvm-project?rev=348836&view=rev Log: [SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnwindEx This fixes PR39935. Modified: libunwind/trunk/src/Unwind-seh.cpp Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=348836&r1=348835&r2=348836&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Tue Dec 11 01:53:11 2018 @@ -374,6 +374,8 @@ _Unwind_Resume(_Unwind_Exception *except CONTEXT ms_ctx; UNWIND_HISTORY_TABLE hist; +memset(&ms_exc, 0, sizeof(ms_exc)); +memset(&hist, 0, sizeof(hist)); ms_exc.ExceptionCode = STATUS_GCC_THROW; ms_exc.ExceptionFlags = EXCEPTION_NONCONTINUABLE; ms_exc.NumberParameters = 4; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r357711 - Move the alias definition of unw_getcontext to within !defined(__USING_SJLJ_EXCEPTIONS__)
Author: mstorsjo Date: Thu Apr 4 10:50:14 2019 New Revision: 357711 URL: http://llvm.org/viewvc/llvm-project?rev=357711&view=rev Log: Move the alias definition of unw_getcontext to within !defined(__USING_SJLJ_EXCEPTIONS__) For builds with SJLJ, there is no __unw_getcontext symbol. On Windows, the weak alias macro also expands to a dllexport directive, which fails if the symbol doesn't exist. Differential Revision: https://reviews.llvm.org/D60251 Modified: libunwind/trunk/src/UnwindRegistersSave.S Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=357711&r1=357710&r2=357711&view=diff == --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Thu Apr 4 10:50:14 2019 @@ -972,8 +972,9 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getconte jmp %o7 clr %o0 // return UNW_ESUCCESS #endif -#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */ WEAK_ALIAS(__unw_getcontext, unw_getcontext) +#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */ + NO_EXEC_STACK_DIRECTIVE ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358393 - [MinGW] Remove some supefluous calls to MakeArgString. NFC.
Author: mstorsjo Date: Mon Apr 15 03:57:09 2019 New Revision: 358393 URL: http://llvm.org/viewvc/llvm-project?rev=358393&view=rev Log: [MinGW] Remove some supefluous calls to MakeArgString. NFC. Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=358393&r1=358392&r2=358393&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Apr 15 03:57:09 2019 @@ -252,16 +252,16 @@ void tools::MinGW::Linker::ConstructJob( ToolChain::FT_Shared)); CmdArgs.push_back( TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk")); -CmdArgs.push_back(Args.MakeArgString("--require-defined")); -CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86 - ? "___asan_seh_interceptor" - : "__asan_seh_interceptor")); +CmdArgs.push_back("--require-defined"); +CmdArgs.push_back(TC.getArch() == llvm::Triple::x86 + ? "___asan_seh_interceptor" + : "__asan_seh_interceptor"); // Make sure the linker consider all object files from the dynamic // runtime thunk. -CmdArgs.push_back(Args.MakeArgString("--whole-archive")); -CmdArgs.push_back(Args.MakeArgString( -TC.getCompilerRT(Args, "asan_dynamic_runtime_thunk"))); -CmdArgs.push_back(Args.MakeArgString("--no-whole-archive")); +CmdArgs.push_back("--whole-archive"); +CmdArgs.push_back( +TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk")); +CmdArgs.push_back("--no-whole-archive"); } TC.addProfileRTLibs(Args, CmdArgs); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r358642 - Add support for ARMv7-M architecture which uses the Thumb 2 ISA (unified syntax)
Author: mstorsjo Date: Wed Apr 17 23:35:42 2019 New Revision: 358642 URL: http://llvm.org/viewvc/llvm-project?rev=358642&view=rev Log: Add support for ARMv7-M architecture which uses the Thumb 2 ISA (unified syntax) Patch by Jérémie Faucher-Goulet! Differential Revision: https://reviews.llvm.org/D60417 Modified: libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=358642&r1=358641&r2=358642&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Wed Apr 17 23:35:42 2019 @@ -610,6 +610,9 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind1 #elif defined(__arm__) && !defined(__APPLE__) #if !defined(__ARM_ARCH_ISA_ARM) +#if (__ARM_ARCH_ISA_THUMB == 2) + .syntax unified +#endif .thumb #endif Modified: libunwind/trunk/src/UnwindRegistersSave.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=358642&r1=358641&r2=358642&view=diff == --- libunwind/trunk/src/UnwindRegistersSave.S (original) +++ libunwind/trunk/src/UnwindRegistersSave.S Wed Apr 17 23:35:42 2019 @@ -750,6 +750,9 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getconte #elif defined(__arm__) && !defined(__APPLE__) #if !defined(__ARM_ARCH_ISA_ARM) +#if (__ARM_ARCH_ISA_THUMB == 2) + .syntax unified +#endif .thumb #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358662 - [MSVC] Use the correct casing of HostX64/HostX86
Author: mstorsjo Date: Thu Apr 18 06:27:31 2019 New Revision: 358662 URL: http://llvm.org/viewvc/llvm-project?rev=358662&view=rev Log: [MSVC] Use the correct casing of HostX64/HostX86 If accessing the MSVC installation root directly on a case sensitive filesystem, these details matter. Differential Revision: https://reviews.llvm.org/D60627 Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=358662&r1=358661&r2=358662&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Apr 18 06:27:31 2019 @@ -496,7 +496,7 @@ void visualstudio::Linker::ConstructJob( // its containing bin directory at the top of PATH, followed by the // native target bin directory. // e.g. when compiling for x86 on an x64 host, PATH should start with: -// /bin/HostX64/x86;/bin/HostX64/x64 +// /bin/Hostx64/x86;/bin/Hostx64/x64 // This doesn't attempt to handle ToolsetLayout::DevDivInternal. if (TC.getIsVS2017OrNewer() && llvm::Triple(llvm::sys::getProcessTriple()).getArch() != TC.getArch()) { @@ -838,7 +838,7 @@ MSVCToolChain::getSubDirectoryPath(SubDi if (VSLayout == ToolsetLayout::VS2017OrNewer) { const bool HostIsX64 = llvm::Triple(llvm::sys::getProcessTriple()).isArch64Bit(); - const char *const HostName = HostIsX64 ? "HostX64" : "HostX86"; + const char *const HostName = HostIsX64 ? "Hostx64" : "Hostx86"; llvm::sys::path::append(Path, "bin", HostName, SubdirName); } else { // OlderVS or DevDivInternal llvm::sys::path::append(Path, "bin", SubdirName); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r358778 - [MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe
Author: mstorsjo Date: Fri Apr 19 12:04:22 2019 New Revision: 358778 URL: http://llvm.org/viewvc/llvm-project?rev=358778&view=rev Log: [MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe Previously, if the MSVC installation isn't detected properly, clang will later just fail to execute link.exe. This improves using clang in msvc mode on linux, where one intentionally might not want to point clang to the MSVC installation itself (which isn't executable as such), but where a link.exe named wine wrapper is available in the path next to a cl.exe named wine wrapper. Differential Revision: https://reviews.llvm.org/D60094 Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=358778&r1=358777&r2=358778&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Fri Apr 19 12:04:22 2019 @@ -488,8 +488,18 @@ void visualstudio::Linker::ConstructJob( // their own link.exe which may come first. linkPath = FindVisualStudioExecutable(TC, "link.exe"); -if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) - C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); +if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) { + llvm::SmallString<128> ClPath; + ClPath = TC.GetProgramPath("cl.exe"); + if (llvm::sys::fs::can_execute(ClPath)) { +linkPath = llvm::sys::path::parent_path(ClPath); +llvm::sys::path::append(linkPath, "link.exe"); +if (!llvm::sys::fs::can_execute(linkPath)) + C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); + } else { +C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found); + } +} #ifdef _WIN32 // When cross-compiling with VS2017 or newer, link.exe expects to have ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359233 - [Windows] Separate elements in -print-search-dirs with semicolons
Author: mstorsjo Date: Thu Apr 25 13:03:20 2019 New Revision: 359233 URL: http://llvm.org/viewvc/llvm-project?rev=359233&view=rev Log: [Windows] Separate elements in -print-search-dirs with semicolons Path lists on windows should always be separated by semicolons, not colons. Reuse llvm::sys::EnvPathSeparator for this purpose (as that's also a path list that is separated in the same way). Alternatively, this could just be a local ifdef _WIN32 in this function, or generalizing the existing EnvPathSeparator to e.g. a llvm::sys::path::PathListSeparator? Differential Revision: https://reviews.llvm.org/D61121 Modified: cfe/trunk/lib/Driver/Driver.cpp Modified: cfe/trunk/lib/Driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=359233&r1=359232&r2=359233&view=diff == --- cfe/trunk/lib/Driver/Driver.cpp (original) +++ cfe/trunk/lib/Driver/Driver.cpp Thu Apr 25 13:03:20 2019 @@ -1695,7 +1695,7 @@ bool Driver::HandleImmediateArgs(const C bool separator = false; for (const std::string &Path : TC.getProgramPaths()) { if (separator) -llvm::outs() << ':'; +llvm::outs() << llvm::sys::EnvPathSeparator; llvm::outs() << Path; separator = true; } @@ -1706,7 +1706,7 @@ bool Driver::HandleImmediateArgs(const C for (const std::string &Path : TC.getFilePaths()) { // Always print a separator. ResourceDir was the first item shown. - llvm::outs() << ':'; + llvm::outs() << llvm::sys::EnvPathSeparator; // Interpretation of leading '=' is needed only for NetBSD. if (Path[0] == '=') llvm::outs() << sysroot << Path.substr(1); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359285 - [MinGW] Fix dllexport of explicit template instantiation
Author: mstorsjo Date: Fri Apr 26 01:09:51 2019 New Revision: 359285 URL: http://llvm.org/viewvc/llvm-project?rev=359285&view=rev Log: [MinGW] Fix dllexport of explicit template instantiation Contrary to MSVC, GCC/MinGW needs to have the dllexport attribute on the template instantiation declaration, not on the definition. Previously clang never marked explicit template instantiations as dllexport in MinGW mode, if the instantiation had a previous declaration, regardless of where the attribute was placed. This makes Clang behave like GCC in this regard, and allows using the same attribute form for both MinGW compilers. This fixes PR40256. Differential Revision: https://reviews.llvm.org/D61118 Added: cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/test/SemaCXX/dllexport.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=359285&r1=359284&r2=359285&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr 26 01:09:51 2019 @@ -2863,6 +2863,9 @@ def warn_attribute_dllimport_static_fiel def warn_attribute_dllexport_explicit_instantiation_decl : Warning< "explicit instantiation declaration should not be 'dllexport'">, InGroup>; +def warn_attribute_dllexport_explicit_instantiation_def : Warning< + "'dllexport' attribute ignored on explicit instantiation definition">, + InGroup; def warn_invalid_initializer_from_system_header : Warning< "invalid constructor form class in system header, should not be explicit">, InGroup>; Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=359285&r1=359284&r2=359285&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Apr 26 01:09:51 2019 @@ -5697,9 +5697,11 @@ void Sema::checkClassLevelDLLAttribute(C TemplateSpecializationKind TSK = Class->getTemplateSpecializationKind(); - // Ignore explicit dllexport on explicit class template instantiation declarations. + // Ignore explicit dllexport on explicit class template instantiation + // declarations, except in MinGW mode. if (ClassExported && !ClassAttr->isInherited() && - TSK == TSK_ExplicitInstantiationDeclaration) { + TSK == TSK_ExplicitInstantiationDeclaration && + !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) { Class->dropAttr(); return; } Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=359285&r1=359284&r2=359285&view=diff == --- cfe/trunk/lib/Sema/SemaTemplate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Apr 26 01:09:51 2019 @@ -8732,8 +8732,10 @@ DeclResult Sema::ActOnExplicitInstantiat ? TSK_ExplicitInstantiationDefinition : TSK_ExplicitInstantiationDeclaration; - if (TSK == TSK_ExplicitInstantiationDeclaration) { -// Check for dllexport class template instantiation declarations. + if (TSK == TSK_ExplicitInstantiationDeclaration && + !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) { +// Check for dllexport class template instantiation declarations, +// except for MinGW mode. for (const ParsedAttr &AL : Attr) { if (AL.getKind() == ParsedAttr::AT_DLLExport) { Diag(ExternLoc, @@ -8793,6 +8795,19 @@ DeclResult Sema::ActOnExplicitInstantiat TemplateSpecializationKind PrevDecl_TSK = PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared; + if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr && + Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) { +// Check for dllexport class template instantiation definitions in MinGW +// mode, if a previous declaration of the instantiation was seen. +for (const ParsedAttr &AL : Attr) { + if (AL.getKind() == ParsedAttr::AT_DLLExport) { +Diag(AL.getLoc(), + diag::warn_attribute_dllexport_explicit_instantiation_def); +break; + } +} + } + if (CheckExplicitInstantiation(*this, ClassTemplate, TemplateNameLoc, SS.isSet(), TSK)) return true; @@ -8949,6 +8964,14 @@ DeclResult Sema::ActOnExplicitInstantiat dllExportImportClassTemplateSpecialization(*this, Def); } +// In MinGW mode, export the template instanti
r359343 - [MinGW] Do dllexport inline methods in template instantiation
Author: mstorsjo Date: Fri Apr 26 12:31:46 2019 New Revision: 359343 URL: http://llvm.org/viewvc/llvm-project?rev=359343&view=rev Log: [MinGW] Do dllexport inline methods in template instantiation Normally, in MinGW mode, inline methods aren't dllexported. However, in the case of a dllimported template instantiation, the inline methods aren't instantiated locally, but referenced from the instantiation. Therefore, those methods also need to be dllexported, in the case of an instantiation. GCC suffers from the same issue, reported at [1], but the issue is still unresolved there. [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088 Differential Revision: https://reviews.llvm.org/D61176 Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=359343&r1=359342&r2=359343&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Apr 26 12:31:46 2019 @@ -5726,9 +5726,12 @@ void Sema::checkClassLevelDLLAttribute(C continue; if (MD->isInlined()) { -// MinGW does not import or export inline methods. +// MinGW does not import or export inline methods. But do it for +// template instantiations. if (!Context.getTargetInfo().getCXXABI().isMicrosoft() && -!Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) +!Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() && +TSK != TSK_ExplicitInstantiationDeclaration && +TSK != TSK_ExplicitInstantiationDefinition) continue; // MSVC versions before 2015 don't export the move assignment operators Modified: cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp?rev=359343&r1=359342&r2=359343&view=diff == --- cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp (original) +++ cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Fri Apr 26 12:31:46 2019 @@ -7,11 +7,9 @@ template class c { - void f(); + void f() {} }; -template void c::f() {} - template class __declspec(dllexport) c; // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359345 - [MinGW] Always emit local typeinfo
Author: mstorsjo Date: Fri Apr 26 12:31:51 2019 New Revision: 359345 URL: http://llvm.org/viewvc/llvm-project?rev=359345&view=rev Log: [MinGW] Always emit local typeinfo This makes sure that code built with headers for a statically linked libc++ also works when linking to the DLL version, when the DLL hasn't been built with --export-all-symbols. This matches what GCC for MinGW does for this test case. Differential Revision: https://reviews.llvm.org/D61177 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=359345&r1=359344&r2=359345&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Fri Apr 26 12:31:51 2019 @@ -2959,7 +2959,7 @@ static bool ShouldUseExternalRTTIDescrip bool IsDLLImport = RD->hasAttr(); // Don't import the RTTI but emit it locally. -if (CGM.getTriple().isWindowsGNUEnvironment() && IsDLLImport) +if (CGM.getTriple().isWindowsGNUEnvironment()) return false; if (CGM.getVTables().isVTableExternal(RD)) Modified: cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp?rev=359345&r1=359344&r2=359345&view=diff == --- cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp (original) +++ cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp Fri Apr 26 12:31:51 2019 @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK-UNIX %s // RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck -check-prefix=CHECK-LATE %s -// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck -check-prefixes=CHECK,CHECK-MINGW %s // RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | FileCheck -check-prefix=CHECK-LATE %s // The 'a' variants ask for the vtable first. @@ -29,7 +29,8 @@ struct Test0a { // V-table should be defined externally. Test0a::Test0a() { use(typeid(Test0a)); } // CHECK: @_ZTV6Test0a = external {{(dso_local )?}}unnamed_addr constant -// CHECK: @_ZTI6Test0a = external {{(dso_local )?}}constant +// CHECK-UNIX: @_ZTI6Test0a = external {{(dso_local )?}}constant +// CHECK-MINGW: @_ZTI6Test0a = linkonce_odr {{(dso_local )?}}constant // This is not a key function. void Test0a::foo() {} @@ -48,7 +49,8 @@ void Test0b::foo() {} // V-table should be defined externally. Test0b::Test0b() { use(typeid(Test0b)); } // CHECK: @_ZTV6Test0b = external {{(dso_local )?}}unnamed_addr constant -// CHECK: @_ZTI6Test0b = external {{(dso_local )?}}constant +// CHECK-UNIX: @_ZTI6Test0b = external {{(dso_local )?}}constant +// CHECK-MINGW: @_ZTI6Test0b = linkonce_odr {{(dso_local )?}}constant /*** Test1a **/ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r359342 - [MinGW] Don't let template instantiation declarations cover nested classes
Author: mstorsjo Date: Fri Apr 26 12:31:39 2019 New Revision: 359342 URL: http://llvm.org/viewvc/llvm-project?rev=359342&view=rev Log: [MinGW] Don't let template instantiation declarations cover nested classes An explicit template instantiation declaration used to let callers assume both outer and nested classes instantiations were defined in a different translation unit. If the instantiation is marked dllexport, only the outer class is exported, but the caller will try to reference the instantiation of both outer and inner classes. This makes MinGW mode match both MSVC and Windows Itanium, by having instantations only cover the outer class, and locally emitting definitions of the nested classes. Windows Itanium was changed to use this behavious in SVN r300804. This deviates from what GCC does, but should be safe (and only inflate the object file size a bit, but MSVC and Windows Itanium modes do the same), and fixes cases where inner classes aren't dllexported. This fixes missing references in combination with dllexported/imported template intantiations. GCC suffers from the same issue, reported at [1], but the issue is still unresolved there. The issue can probably be solved either by making dllexport cover all nested classes as well, or this way (matching MSVC). [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89087 Differential Revision: https://reviews.llvm.org/D61175 Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=359342&r1=359341&r2=359342&view=diff == --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original) +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Apr 26 12:31:39 2019 @@ -2685,10 +2685,14 @@ Sema::InstantiateClassMembers(SourceLoca continue; if ((Context.getTargetInfo().getCXXABI().isMicrosoft() || - Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) && + Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() || + Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) && TSK == TSK_ExplicitInstantiationDeclaration) { // In MSVC and Windows Itanium mode, explicit instantiation decl of the // outer class doesn't affect the inner class. +// In GNU mode, inner classes aren't dllexported. Don't let the +// instantiation cover the inner class, to avoid undefined references +// to inner classes that weren't exported. continue; } Modified: cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp?rev=359342&r1=359341&r2=359342&view=diff == --- cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp (original) +++ cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Fri Apr 26 12:31:39 2019 @@ -1,5 +1,10 @@ // RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s +#define JOIN2(x, y) x##y +#define JOIN(x, y) JOIN2(x, y) +#define UNIQ(name) JOIN(name, __LINE__) +#define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return &class::func; } + template class c { void f(); @@ -36,3 +41,10 @@ template class __declspec(dllexport) out // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv + +extern template class __declspec(dllimport) outer; +USEMEMFUNC(outer, f) +USEMEMFUNC(outer::inner, f) + +// CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv +// CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r360082 - [AArch64] Add __builtin_sponentry, for calling setjmp in MinGW
Author: mstorsjo Date: Mon May 6 14:19:07 2019 New Revision: 360082 URL: http://llvm.org/viewvc/llvm-project?rev=360082&view=rev Log: [AArch64] Add __builtin_sponentry, for calling setjmp in MinGW In MinGW, setjmp isn't expanded as a builtin in the compiler (like it is for MSVC), but manually hooked up as calls to the right underlying functions in headers. Using the actual CRT's real setjmp/longjmp functions requires this intrinsic. (Currently this is worked around by using MinGW specific reimplementations of setjmp/longjmp on aarch64.) Differential Revision: https://reviews.llvm.org/D61592 Added: cfe/trunk/test/CodeGen/builtin-sponentry.c Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def cfe/trunk/lib/CodeGen/CGBuiltin.cpp Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=360082&r1=360081&r2=360082&view=diff == --- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original) +++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon May 6 14:19:07 2019 @@ -86,6 +86,9 @@ LANGBUILTIN(__wfi, "v", "", ALL_MS_L LANGBUILTIN(__sev, "v", "", ALL_MS_LANGUAGES) LANGBUILTIN(__sevl, "v", "", ALL_MS_LANGUAGES) +// Misc +BUILTIN(__builtin_sponentry, "v*", "c") + TARGET_HEADER_BUILTIN(_BitScanForward, "UcUNi*UNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_BitScanReverse, "UcUNi*UNi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_BitScanForward64, "UcUNi*ULLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "") Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=360082&r1=360081&r2=360082&view=diff == --- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original) +++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon May 6 14:19:07 2019 @@ -7233,6 +7233,11 @@ Value *CodeGenFunction::EmitAArch64Built return Builder.CreateCall(F); } + if (BuiltinID == AArch64::BI__builtin_sponentry) { +llvm::Function *F = CGM.getIntrinsic(Intrinsic::sponentry); +return Builder.CreateCall(F); + } + // Find out if any arguments are required to be integer constant // expressions. unsigned ICEArguments = 0; Added: cfe/trunk/test/CodeGen/builtin-sponentry.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-sponentry.c?rev=360082&view=auto == --- cfe/trunk/test/CodeGen/builtin-sponentry.c (added) +++ cfe/trunk/test/CodeGen/builtin-sponentry.c Mon May 6 14:19:07 2019 @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple aarch64-windows-gnu -Oz -emit-llvm %s -o - | FileCheck %s + +void *test_sponentry() { + return __builtin_sponentry(); +} +// CHECK-LABEL: define dso_local i8* @test_sponentry() +// CHECK: = tail call i8* @llvm.sponentry() +// CHECK: ret i8* ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r360081 - [MinGW] Use SEH by default on AArch64
Author: mstorsjo Date: Mon May 6 14:19:01 2019 New Revision: 360081 URL: http://llvm.org/viewvc/llvm-project?rev=360081&view=rev Log: [MinGW] Use SEH by default on AArch64 The implementation of SEH is pretty mature at this point. Differential Revision: https://reviews.llvm.org/D61591 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/windows-exceptions.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=360081&r1=360080&r2=360081&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon May 6 14:19:01 2019 @@ -436,7 +436,8 @@ bool toolchains::MinGW::IsUnwindTablesDe if (ExceptionArg && ExceptionArg->getOption().matches(options::OPT_fseh_exceptions)) return true; - return getArch() == llvm::Triple::x86_64; + return getArch() == llvm::Triple::x86_64 || + getArch() == llvm::Triple::aarch64; } bool toolchains::MinGW::isPICDefault() const { @@ -451,7 +452,7 @@ bool toolchains::MinGW::isPICDefaultForc llvm::ExceptionHandling toolchains::MinGW::GetExceptionModel(const ArgList &Args) const { - if (getArch() == llvm::Triple::x86_64) + if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::aarch64) return llvm::ExceptionHandling::WinEH; return llvm::ExceptionHandling::DwarfCFI; } Modified: cfe/trunk/test/Driver/windows-exceptions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-exceptions.cpp?rev=360081&r1=360080&r2=360081&view=diff == --- cfe/trunk/test/Driver/windows-exceptions.cpp (original) +++ cfe/trunk/test/Driver/windows-exceptions.cpp Mon May 6 14:19:01 2019 @@ -2,8 +2,8 @@ // RUN: %clang -target x86_64-windows-msvc -c %s -### 2>&1 | FileCheck -check-prefix=MSVC %s // RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s // RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s -// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s -// RUN: %clang -target aarch64-windows-gnu -fseh-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s +// RUN: %clang -target aarch64-windows-gnu -fdwarf-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s +// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s MSVC-NOT: -fdwarf-exceptions MSVC-NOT: -fseh-exceptions ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343184 - [Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM
Author: mstorsjo Date: Thu Sep 27 01:24:15 2018 New Revision: 343184 URL: http://llvm.org/viewvc/llvm-project?rev=343184&view=rev Log: [Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM This fixes PR39090. Differential Revision: https://reviews.llvm.org/D52571 Modified: cfe/trunk/lib/Sema/SemaChecking.cpp cfe/trunk/test/SemaCXX/microsoft-varargs.cpp Modified: cfe/trunk/lib/Sema/SemaChecking.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=343184&r1=343183&r2=343184&view=diff == --- cfe/trunk/lib/Sema/SemaChecking.cpp (original) +++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Sep 27 01:24:15 2018 @@ -929,6 +929,7 @@ Sema::CheckBuiltinFunctionCall(FunctionD break; case Builtin::BI__va_start: { switch (Context.getTargetInfo().getTriple().getArch()) { +case llvm::Triple::aarch64: case llvm::Triple::arm: case llvm::Triple::thumb: if (SemaBuiltinVAStartARMMicrosoft(TheCall)) Modified: cfe/trunk/test/SemaCXX/microsoft-varargs.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/microsoft-varargs.cpp?rev=343184&r1=343183&r2=343184&view=diff == --- cfe/trunk/test/SemaCXX/microsoft-varargs.cpp (original) +++ cfe/trunk/test/SemaCXX/microsoft-varargs.cpp Thu Sep 27 01:24:15 2018 @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only %s -verify +// RUN: %clang_cc1 -triple aarch64-windows -fms-compatibility -fsyntax-only %s -verify // expected-no-diagnostics extern "C" { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r343537 - [MinGW] Allow using ASan
Author: mstorsjo Date: Mon Oct 1 13:53:25 2018 New Revision: 343537 URL: http://llvm.org/viewvc/llvm-project?rev=343537&view=rev Log: [MinGW] Allow using ASan Linking to ASan for MinGW is similar to MSVC, but MinGW always links the MSVCRT dynamically, so there is only one of the MSVC cases to consider. When linking to a shared compiler runtime library on MinGW, the suffix of the import library is .dll.a. The existing case of .dll as suffix for windows in general doesn't seem correct (since this is used for linking). As long as callers never actually set the Shared flag, the default static suffix of .lib also worked fine for import libraries as well. Differential Revision: https://reviews.llvm.org/D52538 Added: cfe/trunk/test/Driver/mingw-sanitizers.c Modified: cfe/trunk/lib/Driver/ToolChain.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.h Modified: cfe/trunk/lib/Driver/ToolChain.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=343537&r1=343536&r2=343537&view=diff == --- cfe/trunk/lib/Driver/ToolChain.cpp (original) +++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct 1 13:53:25 2018 @@ -367,8 +367,10 @@ std::string ToolChain::getCompilerRT(con TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment(); const char *Prefix = IsITANMSVCWindows ? "" : "lib"; - const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so") + const char *Suffix = Shared ? (Triple.isOSWindows() ? ".lib" : ".so") : (IsITANMSVCWindows ? ".lib" : ".a"); + if (Shared && Triple.isWindowsGNUEnvironment()) +Suffix = ".dll.a"; for (const auto &LibPath : getLibraryPaths()) { SmallString<128> P(LibPath); Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=343537&r1=343536&r2=343537&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Oct 1 13:53:25 2018 @@ -14,6 +14,7 @@ #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Options.h" +#include "clang/Driver/SanitizerArgs.h" #include "llvm/Option/ArgList.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" @@ -95,7 +96,7 @@ void tools::MinGW::Linker::ConstructJob( const char *LinkingOutput) const { const ToolChain &TC = getToolChain(); const Driver &D = TC.getDriver(); - // const SanitizerArgs &Sanitize = TC.getSanitizerArgs(); + const SanitizerArgs &Sanitize = TC.getSanitizerArgs(); ArgStringList CmdArgs; @@ -187,8 +188,6 @@ void tools::MinGW::Linker::ConstructJob( TC.AddFilePathLibArgs(Args, CmdArgs); AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA); - // TODO: Add ASan stuff here - // TODO: Add profile stuff here if (TC.ShouldLinkCXXStdlib(Args)) { @@ -231,6 +230,24 @@ void tools::MinGW::Linker::ConstructJob( if (Args.hasArg(options::OPT_pthread)) CmdArgs.push_back("-lpthread"); + if (Sanitize.needsAsanRt()) { +// MinGW always links against a shared MSVCRT. +CmdArgs.push_back( +TC.getCompilerRTArgString(Args, "asan_dynamic", true)); +CmdArgs.push_back( +TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk")); +CmdArgs.push_back(Args.MakeArgString("--require-defined")); +CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86 + ? "___asan_seh_interceptor" + : "__asan_seh_interceptor")); +// Make sure the linker consider all object files from the dynamic +// runtime thunk. +CmdArgs.push_back(Args.MakeArgString("--whole-archive")); +CmdArgs.push_back(Args.MakeArgString( +TC.getCompilerRT(Args, "asan_dynamic_runtime_thunk"))); +CmdArgs.push_back(Args.MakeArgString("--no-whole-archive")); + } + if (!HasWindowsApp) { // Add system libraries. If linking to libwindowsapp.a, that import // library replaces all these and we shouldn't accidentally try to @@ -407,6 +424,12 @@ toolchains::MinGW::GetExceptionModel(con return llvm::ExceptionHandling::DwarfCFI; } +SanitizerMask toolchains::MinGW::getSupportedSanitizers() const { + SanitizerMask Res = ToolChain::getSupportedSanitizers(); + Res |= SanitizerKind::Address; + return Res; +} + void toolchains::MinGW::AddCudaIncludeArgs(const ArgList &DriverArgs, ArgStringList &CC1Args) const { CudaInstallation.AddCudaIncludeArgs(DriverArgs, CC1Args); Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h URL: http://llvm
r343702 - [test] Use --sysroot instead of -B in print-multi-directory.c
Author: mstorsjo Date: Wed Oct 3 11:24:05 2018 New Revision: 343702 URL: http://llvm.org/viewvc/llvm-project?rev=343702&view=rev Log: [test] Use --sysroot instead of -B in print-multi-directory.c This avoids finding a similar matching GCC installation outside of the test directory tree in the surrounding environment, which would make the test fail. (This happened on Ubuntu 16.04.) Differential Revision: https://reviews.llvm.org/D52533 Modified: cfe/trunk/test/Driver/print-multi-directory.c Modified: cfe/trunk/test/Driver/print-multi-directory.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-multi-directory.c?rev=343702&r1=343701&r2=343702&view=diff == --- cfe/trunk/test/Driver/print-multi-directory.c (original) +++ cfe/trunk/test/Driver/print-multi-directory.c Wed Oct 3 11:24:05 2018 @@ -1,6 +1,6 @@ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \ // RUN: -target i386-none-linux \ -// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: -print-multi-directory \ // RUN: | FileCheck --match-full-lines --check-prefix=CHECK-X86-MULTILIBS %s @@ -9,7 +9,7 @@ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \ // RUN: -target i386-none-linux -m64 \ -// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \ +// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \ // RUN: -print-multi-directory \ // RUN: | FileCheck --match-full-lines --check-prefix=CHECK-X86_64-MULTILIBS %s ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r353010 - Provide a placement new definition for the SEH version of UnwindCursor
Author: mstorsjo Date: Sun Feb 3 14:16:53 2019 New Revision: 353010 URL: http://llvm.org/viewvc/llvm-project?rev=353010&view=rev Log: Provide a placement new definition for the SEH version of UnwindCursor This fixes compilation after SVN r352966 in SEH mode. Modified: libunwind/trunk/src/UnwindCursor.hpp Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=353010&r1=353009&r2=353010&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Sun Feb 3 14:16:53 2019 @@ -482,6 +482,10 @@ public: DISPATCHER_CONTEXT *getDispatcherContext() { return &_dispContext; } void setDispatcherContext(DISPATCHER_CONTEXT *disp) { _dispContext = *disp; } + // libunwind does not and should not depend on C++ library which means that we + // need our own defition of inline placement new. + static void *operator new(size_t, UnwindCursor *p) { return p; } + private: pint_t getLastPC() const { return _dispContext.ControlPc; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353402 - [clang-cl] support /Oy- on aarch64
Author: mstorsjo Date: Thu Feb 7 04:46:49 2019 New Revision: 353402 URL: http://llvm.org/viewvc/llvm-project?rev=353402&view=rev Log: [clang-cl] support /Oy- on aarch64 MSVC supports /Oy- on aarch64, so clang-cl should too. Patch by Nathan Froyd! Differential Revision: https://reviews.llvm.org/D57838 Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp cfe/trunk/test/Driver/cl-options.c Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=353402&r1=353401&r2=353402&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Feb 7 04:46:49 2019 @@ -1407,10 +1407,10 @@ static void TranslateOptArg(Arg *A, llvm DAL.AddFlagArg( A, Opts.getOption(options::OPT_fno_omit_frame_pointer)); } else { -// Don't warn about /Oy- in 64-bit builds (where +// Don't warn about /Oy- in x86-64 builds (where // SupportsForcingFramePointer is false). The flag having no effect // there is a compiler-internal optimization, and people shouldn't have -// to special-case their build files for 64-bit clang-cl. +// to special-case their build files for x86-64 clang-cl. A->claim(); } break; @@ -1441,8 +1441,8 @@ MSVCToolChain::TranslateArgs(const llvm: DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs()); const OptTable &Opts = getDriver().getOpts(); - // /Oy and /Oy- only has an effect under X86-32. - bool SupportsForcingFramePointer = getArch() == llvm::Triple::x86; + // /Oy and /Oy- don't have an effect on X86-64 + bool SupportsForcingFramePointer = getArch() != llvm::Triple::x86_64; // The -O[12xd] flag actually expands to several flags. We must desugar the // flags so that options embedded can be negated. For example, the '-O2' flag Modified: cfe/trunk/test/Driver/cl-options.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=353402&r1=353401&r2=353402&view=diff == --- cfe/trunk/test/Driver/cl-options.c (original) +++ cfe/trunk/test/Driver/cl-options.c Thu Feb 7 04:46:49 2019 @@ -178,6 +178,10 @@ // Oy_2: -momit-leaf-frame-pointer // Oy_2: -O2 +// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s +// Oy_aarch64: -mdisable-fp-elim +// Oy_aarch64: -O2 + // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s // O2O2: "-O2" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353917 - [MinGW] Add the profiling library when necessary
Author: mstorsjo Date: Tue Feb 12 23:26:54 2019 New Revision: 353917 URL: http://llvm.org/viewvc/llvm-project?rev=353917&view=rev Log: [MinGW] Add the profiling library when necessary Profiling still doesn't seem to work properly, but this at least hooks up the library and eases completing whatever is missing. Differential Revision: https://reviews.llvm.org/D58107 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/instrprof-ld.c Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=353917&r1=353916&r2=353917&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Feb 12 23:26:54 2019 @@ -264,6 +264,8 @@ void tools::MinGW::Linker::ConstructJob( CmdArgs.push_back(Args.MakeArgString("--no-whole-archive")); } + TC.addProfileRTLibs(Args, CmdArgs); + if (!HasWindowsApp) { // Add system libraries. If linking to libwindowsapp.a, that import // library replaces all these and we shouldn't accidentally try to Modified: cfe/trunk/test/Driver/instrprof-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353917&r1=353916&r2=353917&view=diff == --- cfe/trunk/test/Driver/instrprof-ld.c (original) +++ cfe/trunk/test/Driver/instrprof-ld.c Tue Feb 12 23:26:54 2019 @@ -121,3 +121,11 @@ // // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}" // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fuse-ld=lld \ +// RUN: -target x86_64-mingw32 -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s +// +// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}" +// CHECK-MINGW-X86-64: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353922 - [test] Fix the test from SVN r353917 when running without lld available
Author: mstorsjo Date: Tue Feb 12 23:50:21 2019 New Revision: 353922 URL: http://llvm.org/viewvc/llvm-project?rev=353922&view=rev Log: [test] Fix the test from SVN r353917 when running without lld available These tests still relies on the default linker not to be overridden via e.g. CLANG_DEFAULT_LINKER in cmake. Modified: cfe/trunk/test/Driver/instrprof-ld.c Modified: cfe/trunk/test/Driver/instrprof-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353922&r1=353921&r2=353922&view=diff == --- cfe/trunk/test/Driver/instrprof-ld.c (original) +++ cfe/trunk/test/Driver/instrprof-ld.c Tue Feb 12 23:50:21 2019 @@ -122,10 +122,10 @@ // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}" // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib" // -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fuse-ld=lld \ +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-mingw32 -fprofile-instr-generate \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s // -// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}" +// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-MINGW-X86-64: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r353946 - [test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEFAULT_LINKER
Author: mstorsjo Date: Wed Feb 13 05:13:45 2019 New Revision: 353946 URL: http://llvm.org/viewvc/llvm-project?rev=353946&view=rev Log: [test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEFAULT_LINKER Force -fuse-ld=ld, as some other tests in the same file do. Loosen the regex matching the linker tool name as well, as this can end up being -ld in case such a named tool exists. Modified: cfe/trunk/test/Driver/instrprof-ld.c Modified: cfe/trunk/test/Driver/instrprof-ld.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353946&r1=353945&r2=353946&view=diff == --- cfe/trunk/test/Driver/instrprof-ld.c (original) +++ cfe/trunk/test/Driver/instrprof-ld.c Wed Feb 13 05:13:45 2019 @@ -123,9 +123,9 @@ // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: -target x86_64-mingw32 -fprofile-instr-generate \ +// RUN: -target x86_64-mingw32 -fprofile-instr-generate -fuse-ld=ld \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s // -// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-MINGW-X86-64: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-MINGW-X86-64: "{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a" ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW
Author: mstorsjo Date: Thu Aug 31 01:29:59 2017 New Revision: 312224 URL: http://llvm.org/viewvc/llvm-project?rev=312224&view=rev Log: [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW This fixes cases where dynamic classes produced RTTI data with external linkage, producing linker errors about duplicate symbols. This touches code close to what was changed in SVN r244266, but this change doesn't break the tests added in that revision. Differential revision: https://reviews.llvm.org/D37206 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=312224&r1=312223&r2=312224&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 31 01:29:59 2017 @@ -2998,15 +2998,13 @@ static llvm::GlobalVariable::LinkageType if (RD->hasAttr() && ShouldUseExternalRTTIDescriptor(CGM, Ty)) return llvm::GlobalValue::ExternalLinkage; - if (RD->isDynamicClass()) { -llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD); -// MinGW won't export the RTTI information when there is a key function. -// Make sure we emit our own copy instead of attempting to dllimport it. -if (RD->hasAttr() && -llvm::GlobalValue::isAvailableExternallyLinkage(LT)) - LT = llvm::GlobalValue::LinkOnceODRLinkage; -return LT; - } + // MinGW always uses LinkOnceODRLinkage for type info. + if (RD->isDynamicClass() && + !CGM.getContext() + .getTargetInfo() + .getTriple() + .isWindowsGNUEnvironment()) +return CGM.getVTableLinkage(RD); } return llvm::GlobalValue::LinkOnceODRLinkage; Modified: cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp?rev=312224&r1=312223&r2=312224&view=diff == --- cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp (original) +++ cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Thu Aug 31 01:29:59 2017 @@ -2,7 +2,12 @@ struct A { int a; }; struct B : virtual A { int b; }; B b; +class C { + virtual ~C(); +}; +C::~C() {} +// CHECK: @_ZTI1C = linkonce_odr // CHECK: @_ZTI1B = linkonce_odr constant { i8*, i8*, i32, i32, i8*, i64 } // CHECK-SAME: i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*), // CHECK-SAME: i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1B, i32 0, i32 0), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r312229 - Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW"
Author: mstorsjo Date: Thu Aug 31 02:46:27 2017 New Revision: 312229 URL: http://llvm.org/viewvc/llvm-project?rev=312229&view=rev Log: Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW" Breaks on buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/4548/steps/test-check-all/logs/stdio The test in CodeGenCXX/virt-dtor-key.cpp tests using %itanium_abi_triple; on non-windows platforms, this resolves to the current platform triple (where there was no behaviour change), while on windows, it resolves to a mingw triple (where the behaviour was intentionally changed). Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=312229&r1=312228&r2=312229&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 31 02:46:27 2017 @@ -2998,13 +2998,15 @@ static llvm::GlobalVariable::LinkageType if (RD->hasAttr() && ShouldUseExternalRTTIDescriptor(CGM, Ty)) return llvm::GlobalValue::ExternalLinkage; - // MinGW always uses LinkOnceODRLinkage for type info. - if (RD->isDynamicClass() && - !CGM.getContext() - .getTargetInfo() - .getTriple() - .isWindowsGNUEnvironment()) -return CGM.getVTableLinkage(RD); + if (RD->isDynamicClass()) { +llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD); +// MinGW won't export the RTTI information when there is a key function. +// Make sure we emit our own copy instead of attempting to dllimport it. +if (RD->hasAttr() && +llvm::GlobalValue::isAvailableExternallyLinkage(LT)) + LT = llvm::GlobalValue::LinkOnceODRLinkage; +return LT; + } } return llvm::GlobalValue::LinkOnceODRLinkage; Modified: cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp?rev=312229&r1=312228&r2=312229&view=diff == --- cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp (original) +++ cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Thu Aug 31 02:46:27 2017 @@ -2,12 +2,7 @@ struct A { int a; }; struct B : virtual A { int b; }; B b; -class C { - virtual ~C(); -}; -C::~C() {} -// CHECK: @_ZTI1C = linkonce_odr // CHECK: @_ZTI1B = linkonce_odr constant { i8*, i8*, i32, i32, i8*, i64 } // CHECK-SAME: i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*), // CHECK-SAME: i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1B, i32 0, i32 0), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r312306 - Reland r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW
Author: mstorsjo Date: Thu Aug 31 23:41:55 2017 New Revision: 312306 URL: http://llvm.org/viewvc/llvm-project?rev=312306&view=rev Log: Reland r312224 - [ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW This fixes cases where dynamic classes produced RTTI data with external linkage, producing linker errors about duplicate symbols. This touches code close to what was changed in SVN r244266, but this change doesn't break the tests added in that revision. The previous version had missed to update CodeGenCXX/virt-dtor-key.cpp, which had a behaviour change only when running the testsuite on windows. Differential revision: https://reviews.llvm.org/D37327 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=312306&r1=312305&r2=312306&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Aug 31 23:41:55 2017 @@ -2998,15 +2998,13 @@ static llvm::GlobalVariable::LinkageType if (RD->hasAttr() && ShouldUseExternalRTTIDescriptor(CGM, Ty)) return llvm::GlobalValue::ExternalLinkage; - if (RD->isDynamicClass()) { -llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD); -// MinGW won't export the RTTI information when there is a key function. -// Make sure we emit our own copy instead of attempting to dllimport it. -if (RD->hasAttr() && -llvm::GlobalValue::isAvailableExternallyLinkage(LT)) - LT = llvm::GlobalValue::LinkOnceODRLinkage; -return LT; - } + // MinGW always uses LinkOnceODRLinkage for type info. + if (RD->isDynamicClass() && + !CGM.getContext() + .getTargetInfo() + .getTriple() + .isWindowsGNUEnvironment()) +return CGM.getVTableLinkage(RD); } return llvm::GlobalValue::LinkOnceODRLinkage; Modified: cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp?rev=312306&r1=312305&r2=312306&view=diff == --- cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp (original) +++ cfe/trunk/test/CodeGenCXX/rtti-mingw64.cpp Thu Aug 31 23:41:55 2017 @@ -2,7 +2,12 @@ struct A { int a; }; struct B : virtual A { int b; }; B b; +class C { + virtual ~C(); +}; +C::~C() {} +// CHECK: @_ZTI1C = linkonce_odr // CHECK: @_ZTI1B = linkonce_odr constant { i8*, i8*, i32, i32, i8*, i64 } // CHECK-SAME: i8* bitcast (i8** getelementptr inbounds (i8*, i8** @_ZTVN10__cxxabiv121__vmi_class_type_infoE, i64 2) to i8*), // CHECK-SAME: i8* getelementptr inbounds ([3 x i8], [3 x i8]* @_ZTS1B, i32 0, i32 0), Modified: cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp?rev=312306&r1=312305&r2=312306&view=diff == --- cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp (original) +++ cfe/trunk/test/CodeGenCXX/virt-dtor-key.cpp Thu Aug 31 23:41:55 2017 @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-linux -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-windows-gnu -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MINGW // CHECK: @_ZTI3foo = constant +// CHECK-MINGW: @_ZTI3foo = linkonce_odr class foo { foo(); virtual ~foo(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r312498 - Add MINGW_LIBRARIES to the linker flags
Author: mstorsjo Date: Mon Sep 4 12:46:53 2017 New Revision: 312498 URL: http://llvm.org/viewvc/llvm-project?rev=312498&view=rev Log: Add MINGW_LIBRARIES to the linker flags This is essential when building with -nodefaultlibs. This is similar to what already is done in libcxxabi in SVN r302760. Differential revision: https://reviews.llvm.org/D37207 Modified: libcxx/trunk/lib/CMakeLists.txt Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=312498&r1=312497&r2=312498&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Mon Sep 4 12:46:53 2017 @@ -91,6 +91,7 @@ else() add_library_flags_if(LIBCXX_HAS_GCC_S_LIB gcc_s) endif() add_library_flags_if(LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB atomic) +add_library_flags_if(MINGW "${MINGW_LIBRARIES}") # Add the unwinder library. if (LIBCXXABI_USE_LLVM_UNWINDER) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r312617 - Redirect strftime_l to the locale-ignorant strftime on mingw
Author: mstorsjo Date: Tue Sep 5 22:07:25 2017 New Revision: 312617 URL: http://llvm.org/viewvc/llvm-project?rev=312617&view=rev Log: Redirect strftime_l to the locale-ignorant strftime on mingw _strftime_l is only available in the numbered msvcrt versions (starting from msvcr80.dll). In the default configuration, mingw targets the unversioned msvcrt.dll - and there, _strftime_l is not available (not even on windows 10). If __MSVCRT_VERSION__ is set to a higher value (indicating a non-default target and wanting to link to msvcrXX.dll), use the correct function. Differential Revision: https://reviews.llvm.org/D37468 Modified: libcxx/trunk/include/support/win32/locale_win32.h Modified: libcxx/trunk/include/support/win32/locale_win32.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=312617&r1=312616&r2=312617&view=diff == --- libcxx/trunk/include/support/win32/locale_win32.h (original) +++ libcxx/trunk/include/support/win32/locale_win32.h Tue Sep 5 22:07:25 2017 @@ -100,7 +100,11 @@ isupper_l(int c, _locale_t loc) #define iswxdigit_l _iswxdigit_l #define towupper_l _towupper_l #define towlower_l _towlower_l +#if defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x0800 +#define strftime_l( __s, __l, __f, __tm, __loc ) strftime( __s, __l, __f, __tm ) +#else #define strftime_l _strftime_l +#endif #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) #define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ ) #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ ) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r313072 - Handle object files named *.obj in merge_archives.py
Author: mstorsjo Date: Tue Sep 12 13:54:15 2017 New Revision: 313072 URL: http://llvm.org/viewvc/llvm-project?rev=313072&view=rev Log: Handle object files named *.obj in merge_archives.py Differential Revision: https://reviews.llvm.org/D37133 Modified: libcxx/trunk/utils/merge_archives.py Modified: libcxx/trunk/utils/merge_archives.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/merge_archives.py?rev=313072&r1=313071&r2=313072&view=diff == --- libcxx/trunk/utils/merge_archives.py (original) +++ libcxx/trunk/utils/merge_archives.py Tue Sep 12 13:54:15 2017 @@ -118,7 +118,7 @@ def main(): execute_command_verbose([ar_exe, '-x', arc], cwd=temp_directory_root, verbose=args.verbose) -files = glob.glob(os.path.join(temp_directory_root, '*.o')) +files = glob.glob(os.path.join(temp_directory_root, '*.o*')) if not files: print_and_exit('Failed to glob for %s' % glob_path) cmd = [ar_exe, '-qc', args.output] + files ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r313122 - Use CMAKE_AR instead of the system default 'ar' for merging static libraries
Author: mstorsjo Date: Tue Sep 12 23:55:44 2017 New Revision: 313122 URL: http://llvm.org/viewvc/llvm-project?rev=313122&view=rev Log: Use CMAKE_AR instead of the system default 'ar' for merging static libraries Using the system default 'ar' might not be the right choice when cross compiling. Don't prepend the ar options by a dash, not all ar implementations support that (llvm-ar doesn't). Also pass the 's' option when creating the merged library, to create an index. Differential Revision: https://reviews.llvm.org/D37134 Modified: libcxx/trunk/lib/CMakeLists.txt libcxx/trunk/utils/merge_archives.py Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=313122&r1=313121&r2=313122&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Tue Sep 12 23:55:44 2017 @@ -270,6 +270,7 @@ if (LIBCXX_ENABLE_STATIC) ${PYTHON_EXECUTABLE} ${LIBCXX_SOURCE_DIR}/utils/merge_archives.py ARGS -o $ + --ar "${CMAKE_AR}" "$" "${MERGE_ARCHIVES_ABI_TARGET}" "${MERGE_ARCHIVES_SEARCH_PATHS}" Modified: libcxx/trunk/utils/merge_archives.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/merge_archives.py?rev=313122&r1=313121&r2=313122&view=diff == --- libcxx/trunk/utils/merge_archives.py (original) +++ libcxx/trunk/utils/merge_archives.py Tue Sep 12 23:55:44 2017 @@ -94,12 +94,18 @@ def main(): help='Paths to search for the libraries along', action='append', nargs=1) parser.add_argument( +'--ar', dest='ar_exe', required=False, +help='The ar executable to use, finds \'ar\' in the path if not given', +type=str, action='store') +parser.add_argument( 'archives', metavar='archives', nargs='+', help='The archives to merge') args = parser.parse_args() -ar_exe = distutils.spawn.find_executable('ar') +ar_exe = args.ar_exe +if not ar_exe: +ar_exe = distutils.spawn.find_executable('ar') if not ar_exe: print_and_exit("failed to find 'ar' executable") @@ -115,13 +121,13 @@ def main(): temp_directory_root = tempfile.mkdtemp('.libcxx.merge.archives') for arc in archives: -execute_command_verbose([ar_exe, '-x', arc], cwd=temp_directory_root, +execute_command_verbose([ar_exe, 'x', arc], cwd=temp_directory_root, verbose=args.verbose) files = glob.glob(os.path.join(temp_directory_root, '*.o*')) if not files: print_and_exit('Failed to glob for %s' % temp_directory_root) -cmd = [ar_exe, '-qc', args.output] + files +cmd = [ar_exe, 'qcs', args.output] + files execute_command_verbose(cmd, cwd=temp_directory_root, verbose=args.verbose) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r313232 - [Headers] Fix the return type of _InterlockedCompareExchange_rel
Author: mstorsjo Date: Thu Sep 14 00:04:59 2017 New Revision: 313232 URL: http://llvm.org/viewvc/llvm-project?rev=313232&view=rev Log: [Headers] Fix the return type of _InterlockedCompareExchange_rel This was a typo in SVN r282447, where it was added. Modified: cfe/trunk/lib/Headers/intrin.h Modified: cfe/trunk/lib/Headers/intrin.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/intrin.h?rev=313232&r1=313231&r2=313232&view=diff == --- cfe/trunk/lib/Headers/intrin.h (original) +++ cfe/trunk/lib/Headers/intrin.h Thu Sep 14 00:04:59 2017 @@ -832,7 +832,7 @@ _InterlockedCompareExchange_nf(long vola __ATOMIC_SEQ_CST, __ATOMIC_RELAXED); return _Comparand; } -static __inline__ short __DEFAULT_FN_ATTRS +static __inline__ long __DEFAULT_FN_ATTRS _InterlockedCompareExchange_rel(long volatile *_Destination, long _Exchange, long _Comparand) { __atomic_compare_exchange(_Destination, &_Comparand, &_Exchange, 0, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r313470 - Fix a typo in the documentation. NFC.
Author: mstorsjo Date: Sat Sep 16 13:52:05 2017 New Revision: 313470 URL: http://llvm.org/viewvc/llvm-project?rev=313470&view=rev Log: Fix a typo in the documentation. NFC. Modified: libunwind/trunk/docs/index.rst Modified: libunwind/trunk/docs/index.rst URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=313470&r1=313469&r2=313470&view=diff == --- libunwind/trunk/docs/index.rst (original) +++ libunwind/trunk/docs/index.rst Sat Sep 16 13:52:05 2017 @@ -15,7 +15,7 @@ that never materialized (e.g. remote unw The unwinder has two levels of API. The high level APIs are the `_Unwind_*` functions which implement functionality required by `__cxa_*` exception -funcionts. The low level APIs are the `unw_*` functions which are an interface +functions. The low level APIs are the `unw_*` functions which are an interface defined by the old HP libunwind project. Getting Started with libunwind ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r360862 - [PPC] Fix 32-bit build of libunwind
Author: mstorsjo Date: Wed May 15 23:49:20 2019 New Revision: 360862 URL: http://llvm.org/viewvc/llvm-project?rev=360862&view=rev Log: [PPC] Fix 32-bit build of libunwind Clang integrated assembler was unable to build libunwind PPC32 assembly code, present in functions used to save/restore register context. This change consists in replacing the assembly style used in libunwind source, to one that is compatible with both Clang integrated assembler as well as GNU assembler. Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D61792 Modified: libunwind/trunk/src/UnwindRegistersRestore.S libunwind/trunk/src/UnwindRegistersSave.S libunwind/trunk/src/assembly.h Modified: libunwind/trunk/src/UnwindRegistersRestore.S URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=360862&r1=360861&r2=360862&view=diff == --- libunwind/trunk/src/UnwindRegistersRestore.S (original) +++ libunwind/trunk/src/UnwindRegistersRestore.S Wed May 15 23:49:20 2019 @@ -395,119 +395,119 @@ Lnovec: #elif defined(__ppc__) DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv) -; -; void libunwind::Registers_ppc::jumpto() -; -; On entry: -; thread_state pointer is in r3 -; - - ; restore integral registerrs - ; skip r0 for now - ; skip r1 for now - lwz r2, 16(r3) - ; skip r3 for now - ; skip r4 for now - ; skip r5 for now - lwz r6, 32(r3) - lwz r7, 36(r3) - lwz r8, 40(r3) - lwz r9, 44(r3) - lwzr10, 48(r3) - lwzr11, 52(r3) - lwzr12, 56(r3) - lwzr13, 60(r3) - lwzr14, 64(r3) - lwzr15, 68(r3) - lwzr16, 72(r3) - lwzr17, 76(r3) - lwzr18, 80(r3) - lwzr19, 84(r3) - lwzr20, 88(r3) - lwzr21, 92(r3) - lwzr22, 96(r3) - lwzr23,100(r3) - lwzr24,104(r3) - lwzr25,108(r3) - lwzr26,112(r3) - lwzr27,116(r3) - lwzr28,120(r3) - lwzr29,124(r3) - lwzr30,128(r3) - lwzr31,132(r3) - - ; restore float registers - lfdf0, 160(r3) - lfdf1, 168(r3) - lfdf2, 176(r3) - lfdf3, 184(r3) - lfdf4, 192(r3) - lfdf5, 200(r3) - lfdf6, 208(r3) - lfdf7, 216(r3) - lfdf8, 224(r3) - lfdf9, 232(r3) - lfdf10,240(r3) - lfdf11,248(r3) - lfdf12,256(r3) - lfdf13,264(r3) - lfdf14,272(r3) - lfdf15,280(r3) - lfdf16,288(r3) - lfdf17,296(r3) - lfdf18,304(r3) - lfdf19,312(r3) - lfdf20,320(r3) - lfdf21,328(r3) - lfdf22,336(r3) - lfdf23,344(r3) - lfdf24,352(r3) - lfdf25,360(r3) - lfdf26,368(r3) - lfdf27,376(r3) - lfdf28,384(r3) - lfdf29,392(r3) - lfdf30,400(r3) - lfdf31,408(r3) - - ; restore vector registers if any are in use - lwzr5,156(r3) ; test VRsave - cmpwi r5,0 - beqLnovec - - subi r4,r1,16 - rlwinm r4,r4,0,0,27 ; mask low 4-bits - ; r4 is now a 16-byte aligned pointer into the red zone - ; the _vectorRegisters may not be 16-byte aligned so copy via red zone temp buffer - +// +// void libunwind::Registers_ppc::jumpto() +// +// On entry: +// thread_state pointer is in r3 +// + + // restore integral registerrs + // skip r0 for now + // skip r1 for now + lwz %r2, 16(%r3) + // skip r3 for now + // skip r4 for now + // skip r5 for now + lwz %r6, 32(%r3) + lwz %r7, 36(%r3) + lwz %r8, 40(%r3) + lwz %r9, 44(%r3) + lwz %r10, 48(%r3) + lwz %r11, 52(%r3) + lwz %r12, 56(%r3) + lwz %r13, 60(%r3) + lwz %r14, 64(%r3) + lwz %r15, 68(%r3) + lwz %r16, 72(%r3) + lwz %r17, 76(%r3) + lwz %r18, 80(%r3) + lwz %r19, 84(%r3) + lwz %r20, 88(%r3) + lwz %r21, 92(%r3) + lwz %r22, 96(%r3) + lwz %r23,100(%r3) + lwz %r24,104(%r3) + lwz %r25,108(%r3) + lwz %r26,112(%r3) + lwz %r27,116(%r3) + lwz %r28,120(%r3) + lwz %r29,124(%r3) + lwz %r30,128(%r3) + lwz %r31,132(%r3) + + // restore float registers + lfd %f0, 160(%r3) + lfd %f1, 168(%r3) + lfd %f2, 176(%r3) + lfd %f3, 184(%r3) + lfd %f4, 192(%r3) + lfd %f5, 200(%r3) + lfd %f6, 208(%r3) + lfd %f7, 216(%r3) + lfd %f8, 224(%r3) + lfd %f9, 232(%r3) + lfd %f10,240(%r3) + lfd %f11,248(%r3) + lfd %f12,256(%r3) + lfd %f13,264(%r3) + lfd %f14,272(%r3) + lfd %f15,280(%r3) + lfd %f16,288(%r3) + lfd %f17,296(%r3) + lfd %f18,304(%r3) + lfd %f19,312(%r3) + lfd %f20,320(%r3) + lfd %f21,328(%r3) + lfd %f22,336(%r3) + lfd %f23,344(%r3) + lfd %f24,352(%r3) + lfd %f25,360(%r3) + lfd %f26,368(%r3) + lfd %f27,376(%r3) + lfd %f28,384(%r3) + lfd %f29,392(%r3) + lfd %f30,400(%r3) + lfd %f31,408(%r3) + + // restore vector registers if any are in use + lwz %r5, 156(%r3) // test VRsave + cmpwi %r5, 0 + be
[libunwind] r360861 - [PPC64][libunwind] Fix r2 not properly restored
Author: mstorsjo Date: Wed May 15 23:49:13 2019 New Revision: 360861 URL: http://llvm.org/viewvc/llvm-project?rev=360861&view=rev Log: [PPC64][libunwind] Fix r2 not properly restored This change makes each unwind step inspect the instruction at the return address and, if needed, read r2 from its saved location and modify the context appropriately. The unwind logic is able to handle both ELFv1 and ELFv2 stacks. Reported by Bug 41050 Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D59694 Modified: libunwind/trunk/src/DwarfInstructions.hpp libunwind/trunk/src/assembly.h libunwind/trunk/test/lit.cfg Modified: libunwind/trunk/src/DwarfInstructions.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=360861&r1=360860&r2=360861&view=diff == --- libunwind/trunk/src/DwarfInstructions.hpp (original) +++ libunwind/trunk/src/DwarfInstructions.hpp Wed May 15 23:49:13 2019 @@ -232,6 +232,31 @@ int DwarfInstructions::stepWithDwa } #endif +#if defined(_LIBUNWIND_TARGET_PPC64) +#define PPC64_ELFV1_R2_LOAD_INST_ENCODING 0xe8410028u // ld r2,40(r1) +#define PPC64_ELFV1_R2_OFFSET 40 +#define PPC64_ELFV2_R2_LOAD_INST_ENCODING 0xe8410018u // ld r2,24(r1) +#define PPC64_ELFV2_R2_OFFSET 24 + // If the instruction at return address is a TOC (r2) restore, + // then r2 was saved and needs to be restored. + // ELFv2 ABI specifies that the TOC Pointer must be saved at SP + 24, + // while in ELFv1 ABI it is saved at SP + 40. + if (R::getArch() == REGISTERS_PPC64 && returnAddress != 0) { +pint_t sp = newRegisters.getRegister(UNW_REG_SP); +pint_t r2 = 0; +switch (addressSpace.get32(returnAddress)) { +case PPC64_ELFV1_R2_LOAD_INST_ENCODING: + r2 = addressSpace.get64(sp + PPC64_ELFV1_R2_OFFSET); + break; +case PPC64_ELFV2_R2_LOAD_INST_ENCODING: + r2 = addressSpace.get64(sp + PPC64_ELFV2_R2_OFFSET); + break; +} +if (r2) + newRegisters.setRegister(UNW_PPC64_R2, r2); + } +#endif + // Return address is address after call site instruction, so setting IP to // that does simualates a return. newRegisters.setIP(returnAddress); Modified: libunwind/trunk/src/assembly.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=360861&r1=360860&r2=360861&view=diff == --- libunwind/trunk/src/assembly.h (original) +++ libunwind/trunk/src/assembly.h Wed May 15 23:49:13 2019 @@ -36,6 +36,20 @@ #define SEPARATOR ; #endif +#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1) +#define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR +#define PPC64_OPD2 SEPARATOR \ + .p2align 3 SEPARATOR \ + .quad .Lfunc_begin0 SEPARATOR \ + .quad .TOC.@tocbase SEPARATOR \ + .quad 0 SEPARATOR \ + .text SEPARATOR \ +.Lfunc_begin0: +#else +#define PPC64_OPD1 +#define PPC64_OPD2 +#endif + #define GLUE2(a, b) a ## b #define GLUE(a, b) GLUE2(a, b) #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name) @@ -123,7 +137,9 @@ .globl SYMBOL_NAME(name) SEPARATOR \ HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR \ SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR \ - SYMBOL_NAME(name): + PPC64_OPD1 \ + SYMBOL_NAME(name): \ + PPC64_OPD2 #if defined(__arm__) #if !defined(__ARM_ARCH) Modified: libunwind/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/lit.cfg?rev=360861&r1=360860&r2=360861&view=diff == --- libunwind/trunk/test/lit.cfg (original) +++ libunwind/trunk/test/lit.cfg Wed May 15 23:49:13 2019 @@ -23,6 +23,9 @@ config.suffixes = ['.cpp', '.s'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) +# needed to test libunwind with code that throws exceptions +config.enable_exceptions = True + # Infer the libcxx_test_source_root for configuration import. # If libcxx_source_root isn't specified in the config, assume that the libcxx # and libunwind source directories are sibling directories. ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r348981 - Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.
Author: mstorsjo Date: Wed Dec 12 14:24:42 2018 New Revision: 348981 URL: http://llvm.org/viewvc/llvm-project?rev=348981&view=rev Log: Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC. This requires making Registers_*::getRegisterName static. Differential Revision: https://reviews.llvm.org/D55610 Modified: libunwind/trunk/src/Registers.hpp libunwind/trunk/src/UnwindCursor.hpp Modified: libunwind/trunk/src/Registers.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=348981&r1=348980&r2=348981&view=diff == --- libunwind/trunk/src/Registers.hpp (original) +++ libunwind/trunk/src/Registers.hpp Wed Dec 12 14:24:42 2018 @@ -42,7 +42,7 @@ public: boolvalidVectorRegister(int) const { return false; } v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86; } @@ -248,7 +248,7 @@ public: boolvalidVectorRegister(int) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64; } @@ -561,7 +561,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC; } @@ -1126,7 +1126,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64; } @@ -1768,7 +1768,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64; } @@ -2038,7 +2038,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto() { restoreSavedFloatRegisters(); restoreCoreAndJumpTo(); @@ -2518,7 +2518,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K; } @@ -2714,7 +2714,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS; } @@ -3035,7 +3035,7 @@ public: boolvalidVectorRegister(int num) const; v128getVectorRegister(int num) const; voidsetVectorRegister(int num, v128 value); - const char *getRegisterName(int num); + static const char *getRegisterName(int num); voidjumpto(); static int lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS; } Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=348981&r1=348980&r2=348981&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Wed Dec 12 14:24:42 2018 @@ -804,113 +804,7 @@ template void U template const char *UnwindCursor::getRegisterName(int regNum) { - switch (regNum) { -#if defined(_LIBUNWIND_TARGET_X86_64) - case UNW_REG_IP: return "rip"; - case UNW_X86_64_RAX: return "rax"; - case UNW_X86_64_RDX: return "rdx"; - case UNW_X86_64_RCX: return "rcx"; - case UNW_X86_64_RBX: return "rbx"; - case UNW_REG_SP: - case UNW_X86_64_RSP: retur
r349256 - [MinGW] Produce a vtable and RTTI for dllexported classes without a key function
Author: mstorsjo Date: Sat Dec 15 00:08:11 2018 New Revision: 349256 URL: http://llvm.org/viewvc/llvm-project?rev=349256&view=rev Log: [MinGW] Produce a vtable and RTTI for dllexported classes without a key function This matches what GCC does in these situations. This fixes compiling Qt in debug mode. In release mode, references to the vtable of this particular class ends up optimized away, but in debug mode, the compiler creates references to the vtable, which is expected to be dllexported from a different DLL. Make sure the dllexported version actually ends up emitted. Differential Revision: https://reviews.llvm.org/D55698 Added: cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=349256&r1=349255&r2=349256&view=diff == --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Dec 15 00:08:11 2018 @@ -5528,6 +5528,9 @@ static void ReferenceDllExportedMembers( // declaration. return; + if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) +S.MarkVTableUsed(Class->getLocation(), Class, true); + for (Decl *Member : Class->decls()) { // Defined static variables that are members of an exported base // class must be marked export too. Added: cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp?rev=349256&view=auto == --- cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp (added) +++ cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp Sat Dec 15 00:08:11 2018 @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix=GNU %s + +class __declspec(dllexport) QAbstractLayoutStyleInfo { +public: + QAbstractLayoutStyleInfo() : m_isWindow(false) {} + virtual ~QAbstractLayoutStyleInfo() {} + + virtual bool hasChangedCore() const { return false; } + + virtual void invalidate() {} + + virtual double windowMargin(bool orientation) const = 0; + + bool isWindow() const { return m_isWindow; } + +protected: + bool m_isWindow; +}; + +// GNU-DAG: @_ZTV24QAbstractLayoutStyleInfo = weak_odr dso_local dllexport +// GNU-DAG: @_ZTS24QAbstractLayoutStyleInfo = linkonce_odr +// GNU-DAG: @_ZTI24QAbstractLayoutStyleInfo = linkonce_odr ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349452 - [Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled
Author: mstorsjo Date: Tue Dec 18 00:36:10 2018 New Revision: 349452 URL: http://llvm.org/viewvc/llvm-project?rev=349452&view=rev Log: [Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled For targets where SEH exceptions are used by default (on MinGW, only x86_64 so far), -munwind-tables are added automatically. If -fseh-exeptions is enabled on a target where SEH exeptions are availble but not enabled by default yet (aarch64), we need to pass -munwind-tables if -fseh-exceptions was specified. Differential Revision: https://reviews.llvm.org/D55749 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/windows-exceptions.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=349452&r1=349451&r2=349452&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Dec 18 00:36:10 2018 @@ -429,6 +429,12 @@ bool toolchains::MinGW::HasNativeLLVMSup } bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList &Args) const { + Arg *ExceptionArg = Args.getLastArg(options::OPT_fsjlj_exceptions, + options::OPT_fseh_exceptions, + options::OPT_fdwarf_exceptions); + if (ExceptionArg && + ExceptionArg->getOption().matches(options::OPT_fseh_exceptions)) +return true; return getArch() == llvm::Triple::x86_64; } Modified: cfe/trunk/test/Driver/windows-exceptions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-exceptions.cpp?rev=349452&r1=349451&r2=349452&view=diff == --- cfe/trunk/test/Driver/windows-exceptions.cpp (original) +++ cfe/trunk/test/Driver/windows-exceptions.cpp Tue Dec 18 00:36:10 2018 @@ -2,8 +2,11 @@ // RUN: %clang -target x86_64-windows-msvc -c %s -### 2>&1 | FileCheck -check-prefix=MSVC %s // RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s // RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s +// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-DWARF %s +// RUN: %clang -target aarch64-windows-gnu -fseh-exceptions -c %s -### 2>&1 | FileCheck -check-prefix=MINGW-SEH %s MSVC-NOT: -fdwarf-exceptions MSVC-NOT: -fseh-exceptions MINGW-DWARF: -fdwarf-exceptions +MINGW-SEH: -munwind-tables MINGW-SEH: -fseh-exceptions ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349453 - [unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC.
Author: mstorsjo Date: Tue Dec 18 00:36:16 2018 New Revision: 349453 URL: http://llvm.org/viewvc/llvm-project?rev=349453&view=rev Log: [unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC. Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=349453&r1=349452&r2=349453&view=diff == --- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original) +++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Tue Dec 18 00:36:16 2018 @@ -4467,7 +4467,7 @@ static Decl *findInDeclListOfDC(DeclCont return ND; } return nullptr; -}; +} TEST_P(ASTImporterLookupTableTest, FriendWhichIsnotFoundByNormalLookupShouldBeFoundByImporterSpecificLookup) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r349532 - [SEH] Add initial support for AArch64
Author: mstorsjo Date: Tue Dec 18 12:05:59 2018 New Revision: 349532 URL: http://llvm.org/viewvc/llvm-project?rev=349532&view=rev Log: [SEH] Add initial support for AArch64 This doesn't yet implement inspecting the .pdata/.xdata to find the LSDA pointer (in UnwindCursor::getInfoFromSEH), but normal C++ exception handling seems to run just fine without it. (The only place I can see where it's even referenced is in unwind_phase2_forced, and I can't find a codepath where libcxxabi would end up calling that.) Differential Revision: https://reviews.llvm.org/D55674 Modified: libunwind/trunk/include/__libunwind_config.h libunwind/trunk/src/Unwind-seh.cpp libunwind/trunk/src/UnwindCursor.hpp Modified: libunwind/trunk/include/__libunwind_config.h URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=349532&r1=349531&r2=349532&view=diff == --- libunwind/trunk/include/__libunwind_config.h (original) +++ libunwind/trunk/include/__libunwind_config.h Tue Dec 18 12:05:59 2018 @@ -57,7 +57,11 @@ # elif defined(__aarch64__) # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_CONTEXT_SIZE 66 -# define _LIBUNWIND_CURSOR_SIZE 78 +# if defined(__SEH__) +#define _LIBUNWIND_CURSOR_SIZE 164 +# else +#define _LIBUNWIND_CURSOR_SIZE 78 +# endif # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 # elif defined(__arm__) # define _LIBUNWIND_TARGET_ARM 1 Modified: libunwind/trunk/src/Unwind-seh.cpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=349532&r1=349531&r2=349532&view=diff == --- libunwind/trunk/src/Unwind-seh.cpp (original) +++ libunwind/trunk/src/Unwind-seh.cpp Tue Dec 18 12:05:59 2018 @@ -87,6 +87,8 @@ _GCC_specific_handler(PEXCEPTION_RECORD disp->ContextRecord->Rdx = ms_exc->ExceptionInformation[3]; #elif defined(__arm__) disp->ContextRecord->R1 = ms_exc->ExceptionInformation[3]; +#elif defined(__aarch64__) + disp->ContextRecord->X1 = ms_exc->ExceptionInformation[3]; #endif } // This is the collided unwind to the landing pad. Nothing to do. @@ -172,12 +174,16 @@ _GCC_specific_handler(PEXCEPTION_RECORD exc->private_[2] = disp->TargetPc; unw_get_reg(&cursor, UNW_ARM_R0, &retval); unw_get_reg(&cursor, UNW_ARM_R1, &exc->private_[3]); +#elif defined(__aarch64__) +exc->private_[2] = disp->TargetPc; +unw_get_reg(&cursor, UNW_ARM64_X0, &retval); +unw_get_reg(&cursor, UNW_ARM64_X1, &exc->private_[3]); #endif unw_get_reg(&cursor, UNW_REG_IP, &target); ms_exc->ExceptionCode = STATUS_GCC_UNWIND; #ifdef __x86_64__ ms_exc->ExceptionInformation[2] = disp->TargetIp; -#elif defined(__arm__) +#elif defined(__arm__) || defined(__aarch64__) ms_exc->ExceptionInformation[2] = disp->TargetPc; #endif ms_exc->ExceptionInformation[3] = exc->private_[3]; @@ -447,6 +453,12 @@ _unw_init_seh(unw_cursor_t *cursor, CONT auto *co = reinterpret_cast(cursor); co->setInfoBasedOnIPRegister(); return UNW_ESUCCESS; +#elif defined(_LIBUNWIND_TARGET_AARCH64) + new ((void *)cursor) UnwindCursor( + context, LocalAddressSpace::sThisAddressSpace); + auto *co = reinterpret_cast(cursor); + co->setInfoBasedOnIPRegister(); + return UNW_ESUCCESS; #else return UNW_EINVAL; #endif @@ -458,6 +470,8 @@ _unw_seh_get_disp_ctx(unw_cursor_t *curs return reinterpret_cast *>(cursor)->getDispatcherContext(); #elif defined(_LIBUNWIND_TARGET_ARM) return reinterpret_cast *>(cursor)->getDispatcherContext(); +#elif defined(_LIBUNWIND_TARGET_AARCH64) + return reinterpret_cast *>(cursor)->getDispatcherContext(); #else return nullptr; #endif @@ -469,6 +483,8 @@ _unw_seh_set_disp_ctx(unw_cursor_t *curs reinterpret_cast *>(cursor)->setDispatcherContext(disp); #elif defined(_LIBUNWIND_TARGET_ARM) reinterpret_cast *>(cursor)->setDispatcherContext(disp); +#elif defined(_LIBUNWIND_TARGET_AARCH64) + reinterpret_cast *>(cursor)->setDispatcherContext(disp); #endif } Modified: libunwind/trunk/src/UnwindCursor.hpp URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=349532&r1=349531&r2=349532&view=diff == --- libunwind/trunk/src/UnwindCursor.hpp (original) +++ libunwind/trunk/src/UnwindCursor.hpp Tue Dec 18 12:05:59 2018 @@ -615,6 +615,13 @@ UnwindCursor::UnwindCursor(unw_con d.d = r.getFloatRegister(i); _msContext.D[i - UNW_ARM_D0] = d.w; } +#elif defined(_LIBUNWIND_TARGET_AARCH64) + for (int i = UNW_ARM64_X0; i <= UNW_ARM64_X30; ++i) +_msContext.X[i - UNW_ARM64_X0] = r.getRegister(i); + _msContext.Sp = r.getRegister(UNW_REG_SP); + _msContext.Pc = r.getRegister(UNW_REG_IP); + for (int i = UNW_ARM64_D0; i <= UNW_ARM64_D31; ++i) +_msContext.V[
r373078 - [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode
Author: mstorsjo Date: Fri Sep 27 05:25:19 2019 New Revision: 373078 URL: http://llvm.org/viewvc/llvm-project?rev=373078&view=rev Log: [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode This matches how GCC handles it, see e.g. https://gcc.godbolt.org/z/HPplnl. GCC documents the gnu_inline attribute with "In C++, this attribute does not depend on extern in any way, but it still requires the inline keyword to enable its special behavior." The previous behaviour of gnu_inline in C++, without the extern keyword, can be traced back to the original commit that added support for gnu_inline, SVN r69045. Differential Revision: https://reviews.llvm.org/D67414 Added: cfe/trunk/test/SemaCXX/gnu_inline.cpp Modified: cfe/trunk/docs/ReleaseNotes.rst cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/AST/Decl.cpp cfe/trunk/lib/Sema/SemaDeclAttr.cpp cfe/trunk/test/CodeGen/inline.c cfe/trunk/test/SemaCUDA/gnu-inline.cu cfe/trunk/test/SemaCXX/undefined-inline.cpp Modified: cfe/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=373078&r1=373077&r2=373078&view=diff == --- cfe/trunk/docs/ReleaseNotes.rst (original) +++ cfe/trunk/docs/ReleaseNotes.rst Fri Sep 27 05:25:19 2019 @@ -128,7 +128,10 @@ C11 Feature Support C++ Language Changes in Clang - -- ... +- The behaviour of the `gnu_inline` attribute now matches GCC, for cases + where used without the `extern` keyword. As this is a change compared to + how it behaved in previous Clang versions, a warning is emitted for this + combination. C++1z Feature Support ^ Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=373078&r1=373077&r2=373078&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep 27 05:25:19 2019 @@ -3008,6 +3008,10 @@ def warn_gnu_inline_attribute_requires_i "'gnu_inline' attribute requires function to be marked 'inline'," " attribute ignored">, InGroup; +def warn_gnu_inline_cplusplus_without_extern : Warning< + "'gnu_inline' attribute without 'extern' in C++ treated as externally" + " available, this changed in Clang 10">, + InGroup>; def err_attribute_vecreturn_only_vector_member : Error< "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">; def err_attribute_vecreturn_only_pod_record : Error< Modified: cfe/trunk/lib/AST/Decl.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=373078&r1=373077&r2=373078&view=diff == --- cfe/trunk/lib/AST/Decl.cpp (original) +++ cfe/trunk/lib/AST/Decl.cpp Fri Sep 27 05:25:19 2019 @@ -3261,6 +3261,9 @@ bool FunctionDecl::doesDeclarationForceE return true; } + if (Context.getLangOpts().CPlusPlus) +return false; + if (Context.getLangOpts().GNUInline || hasAttr()) { // With GNU inlining, a declaration with 'inline' but not 'extern', forces // an externally visible definition. @@ -3289,9 +3292,6 @@ bool FunctionDecl::doesDeclarationForceE return FoundBody; } - if (Context.getLangOpts().CPlusPlus) -return false; - // C99 6.7.4p6: // [...] If all of the file scope declarations for a function in a // translation unit include the inline function specifier without extern, @@ -3371,6 +3371,8 @@ bool FunctionDecl::isInlineDefinitionExt // If it's not the case that both 'inline' and 'extern' are // specified on the definition, then this inline definition is // externally visible. +if (Context.getLangOpts().CPlusPlus) + return false; if (!(isInlineSpecified() && getStorageClass() == SC_Extern)) return true; Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=373078&r1=373077&r2=373078&view=diff == --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original) +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Sep 27 05:25:19 2019 @@ -4255,6 +4255,9 @@ static void handleGNUInlineAttr(Sema &S, return; } + if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != SC_Extern) +S.Diag(AL.getLoc(), diag::warn_gnu_inline_cplusplus_without_extern); + D->addAttr(::new (S.Context) GNUInlineAttr(S.Context, AL)); } Modified: cfe/trunk/test/CodeGen/inline.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline.c?rev=373078&r1=373077&r2=373078&view=diff ===
r329946 - [MinGW] Look for libc++ headers in a triplet prefixed path as well
Author: mstorsjo Date: Thu Apr 12 13:07:38 2018 New Revision: 329946 URL: http://llvm.org/viewvc/llvm-project?rev=329946&view=rev Log: [MinGW] Look for libc++ headers in a triplet prefixed path as well This makes it consistent with libstdc++ and the other default include directories. If these headers are found in both locations and one isn't a symlink to the other, this will cause errors due to libc++ headers having wrapper headers for some standard C headers, wrappers that do #include_next the actual one. If the same libc++ standard C wrapper header exists in more than one include directory before the real system one, the header include guard will stop it from doing another #include_next to pick up the real one, breaking things. As this is a rather uncommon situation, this should be acceptable and toolchain maintainers can adapt accordingly if necessary. Also simplify some of the existing code with a local variable. Differential Revision: https://reviews.llvm.org/D45500 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/test/Driver/mingw.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=329946&r1=329945&r2=329946&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Thu Apr 12 13:07:38 2018 @@ -453,11 +453,14 @@ void toolchains::MinGW::AddClangCXXStdli DriverArgs.hasArg(options::OPT_nostdincxx)) return; + StringRef Slash = llvm::sys::path::get_separator(); + switch (GetCXXStdlibType(DriverArgs)) { case ToolChain::CST_Libcxx: +addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" + + Slash + "c++" + Slash + "v1"); addSystemInclude(DriverArgs, CC1Args, - Base + "include" + llvm::sys::path::get_separator() + - "c++" + llvm::sys::path::get_separator() + "v1"); + Base + "include" + Slash + "c++" + Slash + "v1"); break; case ToolChain::CST_Libstdcxx: @@ -472,7 +475,7 @@ void toolchains::MinGW::AddClangCXXStdli llvm::sys::path::append(CppIncludeBases[3], "include", "c++"); for (auto &CppIncludeBase : CppIncludeBases) { addSystemInclude(DriverArgs, CC1Args, CppIncludeBase); - CppIncludeBase += llvm::sys::path::get_separator(); + CppIncludeBase += Slash; addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch); addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward"); } Modified: cfe/trunk/test/Driver/mingw.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=329946&r1=329945&r2=329946&view=diff == --- cfe/trunk/test/Driver/mingw.cpp (original) +++ cfe/trunk/test/Driver/mingw.cpp Thu Apr 12 13:07:38 2018 @@ -3,6 +3,10 @@ // CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include" +// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s +// CHECK_MINGW_CLANG_TREE_LIBCXX: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1" + + // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++" // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r330244 - [MinGW] Look for a cross sysroot relative to the clang binary
Author: mstorsjo Date: Wed Apr 18 01:47:26 2018 New Revision: 330244 URL: http://llvm.org/viewvc/llvm-project?rev=330244&view=rev Log: [MinGW] Look for a cross sysroot relative to the clang binary If found, prefer this over looking for a similar gcc later in the system path. Differential Revision: https://reviews.llvm.org/D45504 Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp cfe/trunk/lib/Driver/ToolChains/MinGW.h Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=330244&r1=330243&r2=330244&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Wed Apr 18 01:47:26 2018 @@ -275,7 +275,8 @@ void toolchains::MinGW::findGccLibDir() Archs.emplace_back(getTriple().getArchName()); Archs[0] += "-w64-mingw32"; Archs.emplace_back("mingw32"); - Arch = Archs[0].str(); + if (Arch.empty()) +Arch = Archs[0].str(); // lib: Arch Linux, Ubuntu, Windows // lib64: openSUSE Linux for (StringRef CandidateLib : {"lib", "lib64"}) { @@ -302,6 +303,24 @@ llvm::ErrorOr toolchains::M return make_error_code(std::errc::no_such_file_or_directory); } +llvm::ErrorOr toolchains::MinGW::findClangRelativeSysroot() { + llvm::SmallVector, 2> Subdirs; + Subdirs.emplace_back(getTriple().str()); + Subdirs.emplace_back(getTriple().getArchName()); + Subdirs[1] += "-w64-mingw32"; + Twine ClangRoot = + llvm::sys::path::parent_path(getDriver().getInstalledDir()) + + llvm::sys::path::get_separator(); + for (StringRef CandidateSubdir : Subdirs) { +Twine Subdir = ClangRoot + CandidateSubdir; +if (llvm::sys::fs::is_directory(Subdir)) { + Arch = CandidateSubdir; + return Subdir.str(); +} + } + return make_error_code(std::errc::no_such_file_or_directory); +} + toolchains::MinGW::MinGW(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) { @@ -309,6 +328,10 @@ toolchains::MinGW::MinGW(const Driver &D if (getDriver().SysRoot.size()) Base = getDriver().SysRoot; + // Look for /../; if found, use /.. as the + // base as it could still be a base for a gcc setup with libgcc. + else if (llvm::ErrorOr TargetSubdir = findClangRelativeSysroot()) +Base = llvm::sys::path::parent_path(TargetSubdir.get()); else if (llvm::ErrorOr GPPName = findGcc()) Base = llvm::sys::path::parent_path( llvm::sys::path::parent_path(GPPName.get())); Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=330244&r1=330243&r2=330244&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Wed Apr 18 01:47:26 2018 @@ -96,6 +96,7 @@ private: mutable std::unique_ptr Compiler; void findGccLibDir(); llvm::ErrorOr findGcc(); + llvm::ErrorOr findClangRelativeSysroot(); }; } // end namespace toolchains ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r330277 - [MinGW] Try to fix asan testing after r330244
Author: mstorsjo Date: Wed Apr 18 10:34:29 2018 New Revision: 330277 URL: http://llvm.org/viewvc/llvm-project?rev=330277&view=rev Log: [MinGW] Try to fix asan testing after r330244 Twines shouldn't be stored as they can refer to temporaries. Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=330277&r1=330276&r2=330277&view=diff == --- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Wed Apr 18 10:34:29 2018 @@ -308,14 +308,13 @@ llvm::ErrorOr toolchains::M Subdirs.emplace_back(getTriple().str()); Subdirs.emplace_back(getTriple().getArchName()); Subdirs[1] += "-w64-mingw32"; - Twine ClangRoot = - llvm::sys::path::parent_path(getDriver().getInstalledDir()) + - llvm::sys::path::get_separator(); + StringRef ClangRoot = + llvm::sys::path::parent_path(getDriver().getInstalledDir()); + StringRef Sep = llvm::sys::path::get_separator(); for (StringRef CandidateSubdir : Subdirs) { -Twine Subdir = ClangRoot + CandidateSubdir; -if (llvm::sys::fs::is_directory(Subdir)) { +if (llvm::sys::fs::is_directory(ClangRoot + Sep + CandidateSubdir)) { Arch = CandidateSubdir; - return Subdir.str(); + return (ClangRoot + Sep + CandidateSubdir).str(); } } return make_error_code(std::errc::no_such_file_or_directory); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r330696 - [GCC] Match a GCC version with a patch suffix without a third version component
Author: mstorsjo Date: Tue Apr 24 01:50:11 2018 New Revision: 330696 URL: http://llvm.org/viewvc/llvm-project?rev=330696&view=rev Log: [GCC] Match a GCC version with a patch suffix without a third version component Previously it would only accept a string as a GCC version if it had either two components and no suffix, or three components with an optional suffix. Debian and ubuntu provided mingw compilers have lib/gcc/target entries like "5.3-posix" and "5.3-win32". This doesn't try to make any specific preference between them (other than lexical sorting of the suffix). Differential Revision: https://reviews.llvm.org/D45505 Added: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/.keep cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32/.keep cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/include/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/include/.keep Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp cfe/trunk/test/Driver/mingw.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=330696&r1=330695&r2=330696&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 24 01:50:11 2018 @@ -1594,21 +1594,29 @@ Generic_GCC::GCCVersion Generic_GCC::GCC GoodVersion.MajorStr = First.first.str(); if (First.second.empty()) return GoodVersion; - if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) + StringRef MinorStr = Second.first; + if (Second.second.empty()) { +if (size_t EndNumber = MinorStr.find_first_not_of("0123456789")) { + GoodVersion.PatchSuffix = MinorStr.substr(EndNumber); + MinorStr = MinorStr.slice(0, EndNumber); +} + } + if (MinorStr.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0) return BadVersion; - GoodVersion.MinorStr = Second.first.str(); + GoodVersion.MinorStr = MinorStr.str(); // First look for a number prefix and parse that if present. Otherwise just // stash the entire patch string in the suffix, and leave the number // unspecified. This covers versions strings such as: // 5(handled above) // 4.4 + // 4.4-patched // 4.4.0 // 4.4.x // 4.4.2-rc4 // 4.4.x-patched // And retains any patch number it finds. - StringRef PatchText = GoodVersion.PatchSuffix = Second.second.str(); + StringRef PatchText = Second.second.str(); if (!PatchText.empty()) { if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) { // Try to parse the number and any suffix. Added: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep?rev=330696&view=auto == (empty) Added: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c%2B%2B/backward/.keep?rev=330696&view=auto == (empty) Added: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_p
r330695 - [test] Fix a typo in a test directory name. NFC.
Author: mstorsjo Date: Tue Apr 24 01:49:57 2018 New Revision: 330695 URL: http://llvm.org/viewvc/llvm-project?rev=330695&view=rev Log: [test] Fix a typo in a test directory name. NFC. Added: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/ cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/.keep - copied, changed from r330681, cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep Removed: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep Removed: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/86_64-w64-mingw32/.keep?rev=330694&view=auto == (empty) Copied: cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/.keep (from r330681, cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep) URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/x86_64-w64-mingw32/.keep?p2=cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/x86_64-w64-mingw32/.keep&p1=cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/86_64-w64-mingw32/.keep&r1=330681&r2=330695&rev=330695&view=diff == (empty) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r330710 - [GCC] Don't keep a StringRef to a temporary std::string
Author: mstorsjo Date: Tue Apr 24 04:57:02 2018 New Revision: 330710 URL: http://llvm.org/viewvc/llvm-project?rev=330710&view=rev Log: [GCC] Don't keep a StringRef to a temporary std::string This fixes failures in asan builds and possibly other buildbots as well, after SVN r330696. Prior to that revision, the std::string was stored in another variable, before assigning to a StringRef. Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=330710&r1=330709&r2=330710&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 24 04:57:02 2018 @@ -1616,7 +1616,7 @@ Generic_GCC::GCCVersion Generic_GCC::GCC // 4.4.2-rc4 // 4.4.x-patched // And retains any patch number it finds. - StringRef PatchText = Second.second.str(); + StringRef PatchText = Second.second; if (!PatchText.empty()) { if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) { // Try to parse the number and any suffix. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits