[libcxx] r326027 - Cleanup __config indention NFC
Author: logan Date: Fri Feb 23 23:57:32 2018 New Revision: 326027 URL: http://llvm.org/viewvc/llvm-project?rev=326027&view=rev Log: Cleanup __config indention NFC This commit indents each level by two space characters, e.g. #if defined(CONDITION) # define _LIBCPP_NAME VALUE #else # define _LIBCPP_NAME VALUE #endif The simple #ifndef, #define, and #endif sequences are not indented, e.g. #ifndef _LIBCPP_NAME #define _LIBCPP_NAME ... #endif Modified: libcxx/trunk/include/__config Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=326027&r1=326026&r2=326027&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Fri Feb 23 23:57:32 2018 @@ -12,9 +12,9 @@ #define _LIBCPP_CONFIG #if defined(_MSC_VER) && !defined(__clang__) -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER +# endif #endif #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -24,13 +24,13 @@ #ifdef __cplusplus #ifdef __GNUC__ -#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) +# define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__) // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme // introduced in GCC 5.0. -#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) +# define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__) #else -#define _GNUC_VER 0 -#define _GNUC_VER_NEW 0 +# define _GNUC_VER 0 +# define _GNUC_VER_NEW 0 #endif #define _LIBCPP_VERSION 7000 @@ -40,63 +40,63 @@ #endif #if defined(__ELF__) -#define _LIBCPP_OBJECT_FORMAT_ELF 1 +# define _LIBCPP_OBJECT_FORMAT_ELF 1 #elif defined(__MACH__) -#define _LIBCPP_OBJECT_FORMAT_MACHO 1 +# define _LIBCPP_OBJECT_FORMAT_MACHO 1 #elif defined(_WIN32) -#define _LIBCPP_OBJECT_FORMAT_COFF 1 +# define _LIBCPP_OBJECT_FORMAT_COFF 1 #elif defined(__wasm__) -#define _LIBCPP_OBJECT_FORMAT_WASM 1 +# define _LIBCPP_OBJECT_FORMAT_WASM 1 #else -#error Unknown object file format +# error Unknown object file format #endif #if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2 // Change short string representation so that string data starts at offset 0, // improving its alignment in some cases. -#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT +# define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT // Fix deque iterator type in order to support incomplete types. -#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE +# define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE // Fix undefined behavior in how std::list stores its linked nodes. -#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __tree stores its end and parent nodes. -#define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB // Fix undefined behavior in how __hash_table stores its pointer types. -#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB -#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB -#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE +# define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB +# define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB +# define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE // Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr // provided under the alternate keyword __nullptr, which changes the mangling // of nullptr_t. This option is ABI incompatible with GCC in C++03 mode. -#define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR +# define _LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR // Define the `pointer_safety` enum as a C++11 strongly typed enumeration // instead of as a class simulating an enum. If this option is enabled // `pointer_safety` and `get_pointer_safety()` will no longer be available // in C++03. -#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE +# define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE // Define a key function for `bad_function_call` in the library, to centralize // its vtable and typeinfo to libc++ rather than having all other libraries // using that class define their own copies. -#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION // Enable optimized version of __do_get_(un)signed which avoids redundant copies. -#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET +# define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET // Use the smallest possible integer type to represent the index of the variant. // Previously libc++ used "unsigned int" exclusivly. -#define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION +# define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION #elif _LIBCPP_ABI_VERSION == 1 -#if !defined(_LIBCPP_OBJECT_FORMAT_COFF) +# if !defined(_LIBCPP_OBJECT_FORMAT_COFF) // Enable compiling copies of now inl
[libcxxabi] r283100 - [CMake] Fix libc++abi standalone cmake build.
Author: logan Date: Mon Oct 3 06:08:17 2016 New Revision: 283100 URL: http://llvm.org/viewvc/llvm-project?rev=283100&view=rev Log: [CMake] Fix libc++abi standalone cmake build. The cmake files install directory has been changed to ${prefix}/lib/cmake/llvm since r259821. Searching cmake modules in ${prefix}/share/llvm/cmake will result in fatal errors. This commit fixes the out-of-tree build by changing the CMake module search path to: "$(llvm-config --obj-root)/lib/cmake/llvm" Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=283100&r1=283099&r2=283100&view=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Mon Oct 3 06:08:17 2016 @@ -49,7 +49,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake") +set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24081: [CMake] Fix libc++abi standalone cmake build.
logan closed this revision. logan added a comment. Thanks for reviewing. Committed as rL283100. https://reviews.llvm.org/D24081 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24084: [CMake] Cleanup libunwind lookup code.
logan added a comment. Ping. Any further comments? Or, should we duplicate `` in multiple repositories? https://reviews.llvm.org/D24084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r283118 - [lit] Allow more file extensions for test cases.
Author: logan Date: Mon Oct 3 11:00:22 2016 New Revision: 283118 URL: http://llvm.org/viewvc/llvm-project?rev=283118&view=rev Log: [lit] Allow more file extensions for test cases. This commit splits the file extensions before determining the test format. This allows libc++abi to add assembly-based test cases. Modified: libcxx/trunk/test/libcxx/test/format.py Modified: libcxx/trunk/test/libcxx/test/format.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/format.py?rev=283118&r1=283117&r2=283118&view=diff == --- libcxx/trunk/test/libcxx/test/format.py (original) +++ libcxx/trunk/test/libcxx/test/format.py Mon Oct 3 11:00:22 2016 @@ -65,9 +65,11 @@ class LibcxxTestFormat(object): def _execute(self, test, lit_config): name = test.path_in_suite[-1] -is_sh_test = name.endswith('.sh.cpp') +name_root, name_ext = os.path.splitext(name) +is_sh_test = name_root.endswith('.sh') is_pass_test = name.endswith('.pass.cpp') is_fail_test = name.endswith('.fail.cpp') +assert is_sh_test or name_ext == '.cpp', 'non-cpp file must be sh test' if test.config.unsupported: return (lit.Test.UNSUPPORTED, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24087: [lit] Allow more file extensions for test cases.
logan closed this revision. logan added a comment. Thanks for reviewing. Committed as rL283118 with the suggested change regarding to `is_sh_test` assertion. https://reviews.llvm.org/D24087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan added a comment. Ping? Any other comments? https://reviews.llvm.org/D24082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24085: arm: Fix ttype encoding assertion failure.
logan added inline comments. > mclow.lists wrote in cxa_personality.cpp:363 > It's not clear to me how this accomplishes what you want. > You're looking for `00/10/90`, right? Why not just check for that? > > Why are you anding with 0x0f ? > Before, this would pass only a single value - `DW_EH_PE_absptr` (aka 0) > With this change, it passes 32 values: 00, 03, 10, 13, 20, 23, and so on. > > Was that your intent? `ttypeEncoding` is encoded with following rules: 1. Lower 4 bits stand for the representation of the data, such as `absptr`, `uleb128`, `udata1`, `udata2`, `udata4`, `udata8`, etc. These bits control the way we extract the bytes from the exception table. 2. Upper 4 bits stand for the post processing action, such as `pcrel`, `indirect`, etc. For example, if `pcrel` is specified, then we should add the value, which was read in step 1, with the address of the value. My intention is to weaken the assertion (only assert the essential assumption) so that we don't have to alter the assertion if there are new configurations that I am not aware of or new compiler which is generating different ttypeEncoding. Since the upcoming lines (L365) only uses `sizeof(uintptr_t)` to decode the TType pointer, it is not necessary to impose restriction on the upper 4 bits. That's the reason why I wrote `ttypeEncoding & 0xf`. For the same reason, both `absptr` and `udata` have the same meaning (4 bytes in the exception table) in this context, thus I am adding extra `(ttypeEncoding & 0x0f) == DW_EH_PE_udata4`. https://reviews.llvm.org/D24085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r280251 - Wrap LIBCXXABI_USE_LLVM_UNWINDER with defined().
Author: logan Date: Wed Aug 31 10:16:40 2016 New Revision: 280251 URL: http://llvm.org/viewvc/llvm-project?rev=280251&view=rev Log: Wrap LIBCXXABI_USE_LLVM_UNWINDER with defined(). This commit fixes -Wundef by replacing: #if !LIBCXXABI_USE_LLVM_UNWINDER with: #if !defined(LIBCXXABI_USE_LLVM_UNWINDER) 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=280251&r1=280250&r2=280251&view=diff == --- libcxxabi/trunk/src/cxa_personality.cpp (original) +++ libcxxabi/trunk/src/cxa_personality.cpp Wed Aug 31 10:16:40 2016 @@ -1035,7 +1035,7 @@ static _Unwind_Reason_Code continue_unwi } // ARM register names -#if !LIBCXXABI_USE_LLVM_UNWINDER +#if !defined(LIBCXXABI_USE_LLVM_UNWINDER) static const uint32_t REG_UCB = 12; // Register to save _Unwind_Control_Block #endif static const uint32_t REG_SP = 13; @@ -1071,7 +1071,7 @@ __gxx_personality_v0(_Unwind_State state bool native_exception = (unwind_exception->exception_class & get_vendor_and_language) == (kOurExceptionClass & get_vendor_and_language); -#if !LIBCXXABI_USE_LLVM_UNWINDER +#if !defined(LIBCXXABI_USE_LLVM_UNWINDER) // Copy the address of _Unwind_Control_Block to r12 so that // _Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() can // return correct address. ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24080: [lit] Replace print with lit_config.note().
logan created this revision. logan added reviewers: mclow.lists, rengolin, EricWF. logan added a subscriber: cfe-commits. This commit replaces print statement with lit_config.note(). This fixes python3 support for check-libcxxabi. https://reviews.llvm.org/D24080 Files: test/lit.cfg Index: test/lit.cfg === --- test/lit.cfg +++ test/lit.cfg @@ -55,7 +55,7 @@ cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi') if cfg_variant: -print 'Using configuration variant: %s' % cfg_variant +lit_config.note('Using configuration variant: %s' % cfg_variant) # Load the Configuration class from the module name .test.config. config_module_name = '.'.join([cfg_variant, 'test', 'config']) Index: test/lit.cfg === --- test/lit.cfg +++ test/lit.cfg @@ -55,7 +55,7 @@ cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi') if cfg_variant: -print 'Using configuration variant: %s' % cfg_variant +lit_config.note('Using configuration variant: %s' % cfg_variant) # Load the Configuration class from the module name .test.config. config_module_name = '.'.join([cfg_variant, 'test', 'config']) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24085: arm: Fix ttype encoding assertion failure.
logan created this revision. logan added reviewers: mclow.lists, rengolin. logan added a subscriber: cfe-commits. Herald added subscribers: samparker, rengolin, aemerson. GCC 4.7 or newer emits 0x90 (indirect | pcrel) as the ttype encoding. This would hit an assertion in cxa_personality.cpp. This commit fixes the problem by relaxing the assertion. http://llvm.org/PR28884 https://reviews.llvm.org/D24085 Files: src/cxa_personality.cpp test/lit.cfg test/lit.site.cfg.in test/native/arm-linux-eabi/lit.local.cfg test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s Index: test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s === --- /dev/null +++ test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s @@ -0,0 +1,96 @@ +@ RUN: %cxx %flags %link_flags %s -o %t.exe +@ RUN: %exec %t.exe + +@ PURPOSE: Check that 0x90 is a valid value for ttype encoding. + +@ NOTE: +@ +@ This file is generated from the following C++ source code and then change the +@ `TType Encoding` to 0x90. +@ +@ ``` +@ int main() { +@ try { +@ throw 5; +@ } catch (int i) { +@ if (i != 5) +@ abort(); +@ return 0; +@ } +@ } +@ ``` + + .syntax unified + + .text + .globl main + .p2align 2 + .type main,%function +main: @ @main +.Lfunc_begin0: + .fnstart +@ BB#0: @ %entry + .save {r11, lr} + push {r11, lr} + .setfp r11, sp + mov r11, sp + mov r0, #4 + bl __cxa_allocate_exception + mov r1, #5 + str r1, [r0] +.Ltmp0: + ldr r1, .LCPI0_0 + mov r2, #0 + bl __cxa_throw +.Ltmp1: + +@ BB#2: @ %lpad +.Ltmp2: + bl __cxa_begin_catch + ldr r0, [r0] + cmp r0, #5 + bne .LBB0_4 +@ BB#3: @ %if.end + bl __cxa_end_catch + mov r0, #0 + pop {r11, lr} + bx lr +.LBB0_4:@ %if.then + bl abort + .p2align 2 +@ BB#5: +.LCPI0_0: + .long _ZTIi +.Lfunc_end0: + + .size main, .Lfunc_end0-main + .globl __gxx_personality_v0 + .personality __gxx_personality_v0 + .handlerdata + .p2align 2 +GCC_except_table0: +.Lexception0: + .byte 255 @ @LPStart Encoding = omit + .byte 0x90@ @TType Encoding = indirect | pcrel + .asciz "\257\200" @ @TType base offset + .byte 3 @ Call site Encoding = udata4 + .byte 39 @ Call site table length + .long .Lfunc_begin0-.Lfunc_begin0 @ >> Call Site 1 << + .long .Ltmp0-.Lfunc_begin0@ Call between .Lfunc_begin0 and .Ltmp0 + .long 0 @ has no landing pad + .byte 0 @ On action: cleanup + .long .Ltmp0-.Lfunc_begin0@ >> Call Site 2 << + .long .Ltmp1-.Ltmp0 @ Call between .Ltmp0 and .Ltmp1 + .long .Ltmp2-.Lfunc_begin0@ jumps to .Ltmp2 + .byte 1 @ On action: 1 + .long .Ltmp1-.Lfunc_begin0@ >> Call Site 3 << + .long .Lfunc_end0-.Ltmp1 @ Call between .Ltmp1 and .Lfunc_end0 + .long 0 @ has no landing pad + .byte 0 @ On action: cleanup + .byte 1 @ >> Action Record 1 << +@ Catch TypeInfo 1 + .byte 0 @ No further actions +@ >> Catch TypeInfos << + .long _ZTIi(target2) @ TypeInfo 1 + .p2align 2 + .fnend Index: test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s === --- /dev/null +++ test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s @@ -0,0 +1,97 @@ +@ RUN: %cxx %flags %link_flags %s -o %t.exe +@ RUN: %exec %t.exe + +@ PURPOSE: Check that 0x00 is a valid value for ttype encoding. LLVM and +@ GCC 4.6 are generating 0x00 as ttype encoding. libc++abi should provide +@ legacy support. + +@ NOTE: +@ +@ This file is generated from the following C++ source code: +@ +@ ``` +@ int main() { +@ try { +@ throw 5; +@ } catch (int i) { +@ if (i != 5) +@ abort(); +@ return 0; +@ } +@ } +@ ``` + + .syntax unified + + .text + .globl main + .p2align 2 + .type main,%function +main: @ @main +.Lfunc_begin0: + .fnstart +@ BB#0: @ %entry + .save {r11, lr} + push {r11, lr} + .setfp r11, sp + mov r11, sp + mov r0, #4 + bl __cxa_allocate_exception + mov r1, #5 + str r1, [r0] +.Ltmp0: + ldr r1, .LCPI0_0 + mov r2, #0 + bl __cxa_throw +.Ltmp1: + +@ BB#2: @ %lpad +.Ltmp2: + bl __cxa_begin_catch + ldr r0, [r0] + cmp r0, #5 + bne .LBB0_4 +@ BB#3: @ %if.end + bl __cxa_end_catch + mov r0, #0 + pop {r11, lr} + bx lr +.LBB0_4:@ %if.then + bl abort + .p2align 2 +@ BB#5: +.LCPI0_0: + .long _ZTIi +.Lfunc_end0: + + .size main, .Lfunc_end0-main + .globl __gx
[PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.
logan created this revision. logan added reviewers: mclow.lists, rengolin, EricWF. logan added a subscriber: cfe-commits. Herald added a subscriber: aemerson. This commit fixes __aeabi_idiv() link error when we are building libc++abi with compiler-rt. When compiler-rt is enabled, the option `--rtlib=compiler-rt` will be added to link flags. However, if `-nodefaultlibs` is specified simultaneously, `--rtlib` will be ignored and compiler-rt libraries will not be linked. Consequently, several ARM built-in functions, e.g. __aeabi_idiv(), will not be available. https://reviews.llvm.org/D24083 Files: src/CMakeLists.txt Index: src/CMakeLists.txt === --- src/CMakeLists.txt +++ src/CMakeLists.txt @@ -70,7 +70,9 @@ # Setup flags. append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC) -append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) +if (NOT LIBCXXABI_USE_COMPILER_RT) + append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) +endif() set(LIBCXXABI_SHARED_LINK_FLAGS) Index: src/CMakeLists.txt === --- src/CMakeLists.txt +++ src/CMakeLists.txt @@ -70,7 +70,9 @@ # Setup flags. append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_HAS_FPIC_FLAG -fPIC) -append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) +if (NOT LIBCXXABI_USE_COMPILER_RT) + append_if(LIBCXXABI_LINK_FLAGS LIBCXXABI_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs) +endif() set(LIBCXXABI_SHARED_LINK_FLAGS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan created this revision. logan added reviewers: mclow.lists, rengolin, EricWF. logan added a subscriber: cfe-commits. Herald added subscribers: samparker, rengolin, aemerson. This commit fixes libc++abi build when LLVM unwinder (libunwind_llvm) is not enabled. This commit fixes the problem by removing "LLVM_NATIVE_ARCH MATCHES ARM" from CMakeLists.txt so that LIBCXXABI_USE_LLVM_UNWINDER will only be defined when LLVM unwinder is enabled. We need LIBCXXABI_USE_LLVM_UNWINDER becase there is a subtle difference between the unwinder from libgcc and the one from libunwind_llvm. For the unwinder from libgcc, we have to initialize register r12 with the address of _Unwind_Control_Block; otherwise, _Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() won't work properly. Consequently, there is an extra _Unwind_SetGR() when LLVM unwinder is disabled. Check cxa_personality.cpp for details. https://reviews.llvm.org/D24082 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -339,7 +339,7 @@ endif() # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation. -if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) +if (LIBCXXABI_USE_LLVM_UNWINDER) add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1) endif() Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -339,7 +339,7 @@ endif() # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation. -if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) +if (LIBCXXABI_USE_LLVM_UNWINDER) add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24084: [CMake] Cleanup libunwind lookup code.
logan created this revision. logan added reviewers: mclow.lists, rengolin, EricWF, danalbert, thakis. logan added a subscriber: cfe-commits. This commit refines the code for libunwind lookup. First, this commit will always search for libunwind no matter LLVM unwinder is enabled or not. We have to do so because we need the modified "unwind.h" from libunwind. (Note: which is bundled with clang/gcc is not sufficient.) Second, this commit removes LIBCXXABI_LIBUNWIND_INCLUDE_INTERNAL and refines the find_path() function. Now, it looks similar to the one for libc++. Third, this commit removes LIBCXXABI_LIBUNWIND_SOURCES since it haven't been used for a while. (Note: The reference to "libunwind_ext.h" has been removed since r241993.) https://reviews.llvm.org/D24084 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -137,6 +137,7 @@ message(FATAL_ERROR "libc++abi must be built as either a shared or static library.") endif() +# Find libc++ include path and source path. find_path( LIBCXXABI_LIBCXX_INCLUDES vector @@ -167,6 +168,25 @@ set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH "Specify path to libc++ source." FORCE) +# Find libunwind include path (for unwind.h) +find_path( + LIBCXXABI_LIBUNWIND_INCLUDES + libunwind.h + PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} +${LIBCXXABI_LIBUNWIND_PATH}/include +${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} +${LLVM_MAIN_SRC_DIR}/projects/libunwind/include + NO_DEFAULT_PATH +) + +if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND") + message(WARNING "LIBCXXABI_LIBUNWIND_INCLUDES was not specified and couldn't be infered.") + set(LIBCXXABI_LIBUNWIND_INCLUDES "") +endif() + +set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH +"Specify path to libunwind includes." FORCE) + #=== # Configure System #=== @@ -351,40 +371,13 @@ # Setup Source Code #=== -set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH -"Specify path to libunwind includes." FORCE) -set(LIBCXXABI_LIBUNWIND_PATH "${LIBCXXABI_LIBUNWIND_PATH}" CACHE PATH -"Specify path to libunwind source." FORCE) +# Add libunwind include to header search path (for unwind.h) +if (LIBCXXABI_LIBUNWIND_INCLUDES) + include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES}") +endif() +# Add libc++abi include to header search path. include_directories(include) -if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) - find_path( -LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL -libunwind.h -PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} - ${LIBCXXABI_LIBUNWIND_PATH}/include - ${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} - ${LLVM_MAIN_SRC_DIR}/projects/libunwind/include -NO_DEFAULT_PATH - ) - - find_path( -LIBCXXABI_LIBUNWIND_SOURCES -libunwind_ext.h -PATHS ${LIBCXXABI_LIBUNWIND_PATH}/src/ - ${LIBCXXABI_LIBUNWIND_INCLUDES}/../src/ - ${LLVM_MAIN_SRC_DIR}/projects/libunwind/src/ -NO_DEFAULT_PATH - ) - - if (LIBCXXABI_LIBUNWIND_SOURCES STREQUAL "LIBCXXABI_LIBUNWIND_SOURCES-NOTFOUND") -message(WARNING "LIBCXXABI_LIBUNWIND_SOURCES was not specified and couldn't be infered.") -set(LIBCXXABI_LIBUNWIND_SOURCES "") - endif() - - include_directories("${LIBCXXABI_LIBUNWIND_INCLUDES_INTERNAL}") - include_directories("${LIBCXXABI_LIBUNWIND_SOURCES}") -endif() # Add source code. This also contains all of the logic for deciding linker flags # soname, etc... Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -137,6 +137,7 @@ message(FATAL_ERROR "libc++abi must be built as either a shared or static library.") endif() +# Find libc++ include path and source path. find_path( LIBCXXABI_LIBCXX_INCLUDES vector @@ -167,6 +168,25 @@ set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH "Specify path to libc++ source." FORCE) +# Find libunwind include path (for unwind.h) +find_path( + LIBCXXABI_LIBUNWIND_INCLUDES + libunwind.h + PATHS ${LIBCXXABI_LIBUNWIND_INCLUDES} +${LIBCXXABI_LIBUNWIND_PATH}/include +${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBUNWIND_INCLUDES} +${LLVM_MAIN_SRC_DIR}/projects/libunwind/include + NO_DEFAULT_PATH +) + +if (LIBCXXABI_LIBUNWIND_INCLUDES STREQUAL "LIBCXXABI_LIBUNWIND_INCLUDES-NOTFOUND") + message(WARNING "LIBCXXABI_LIBUNWIND_INCLUDES was not specified and couldn't be infered.") + set(LIBCXXABI_LIBUNWIND_INCLUDES "") +endif() + +set(LIBCXXABI_LIBUNWIND_INCLUDES "${LIBCXXABI_LIBUNWIND_INCLUDES}" CACHE PATH
[PATCH] D24081: [CMake] Fix libc++abi standalone cmake build.
logan created this revision. logan added reviewers: mclow.lists, rengolin, EricWF. logan added a subscriber: cfe-commits. The cmake files install directory has been changed to ${prefix}/lib/cmake/llvm since r259821. Searching cmake modules in ${prefix}/share/llvm/cmake will result in fatal errors. This commit fixes the out-of-tree build by changing the CMake module search path to: "$(llvm-config --obj-root)/lib/cmake/llvm" https://reviews.llvm.org/D24081 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -49,7 +49,7 @@ set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake") +set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -49,7 +49,7 @@ set(LLVM_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") -set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/share/llvm/cmake") +set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py") else() message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.
logan added a comment. Yes. This is what we have today. We can either (1) specify the path to libunwind or (2) manually download `unwind.h` header from libunwind project and place it to `include` directory. https://reviews.llvm.org/D24084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24087: [lit] Allow more file extensions for test cases.
logan created this revision. logan added reviewers: mclow.lists, EricWF. logan added a subscriber: cfe-commits. This commit splits the file extensions before determining the test format. This allows libc++abi to add assembly-based test cases. https://reviews.llvm.org/D24087 Files: test/libcxx/test/format.py Index: test/libcxx/test/format.py === --- test/libcxx/test/format.py +++ test/libcxx/test/format.py @@ -65,9 +65,10 @@ def _execute(self, test, lit_config): name = test.path_in_suite[-1] -is_sh_test = name.endswith('.sh.cpp') -is_pass_test = name.endswith('.pass.cpp') -is_fail_test = name.endswith('.fail.cpp') +name_root, name_ext = os.path.splitext(name) +is_sh_test = name_root.endswith('.sh') +is_pass_test = name_root.endswith('.pass') +is_fail_test = name_root.endswith('.fail') if test.config.unsupported: return (lit.Test.UNSUPPORTED, Index: test/libcxx/test/format.py === --- test/libcxx/test/format.py +++ test/libcxx/test/format.py @@ -65,9 +65,10 @@ def _execute(self, test, lit_config): name = test.path_in_suite[-1] -is_sh_test = name.endswith('.sh.cpp') -is_pass_test = name.endswith('.pass.cpp') -is_fail_test = name.endswith('.fail.cpp') +name_root, name_ext = os.path.splitext(name) +is_sh_test = name_root.endswith('.sh') +is_pass_test = name_root.endswith('.pass') +is_fail_test = name_root.endswith('.fail') if test.config.unsupported: return (lit.Test.UNSUPPORTED, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.
logan added a comment. In https://reviews.llvm.org/D24084#530433, @rengolin wrote: > That is a horrible dependency... I never hit it because I always test libc++ > with libunwind. I think the best solution is to move/merge `libunwind/include/unwind.h` to/with `clang/lib/Headers/unwind.h`. And, modify the libc++abi code base, so that libc++abi can accept the `` bundled with clang or gcc. However, it takes time to reach that point. https://reviews.llvm.org/D24084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D19910: [unwinder] Get rid of unused code
logan accepted this revision. logan added a comment. This revision is now accepted and ready to land. Sorry for the late reply. Thanks for your work. Yes, this is correct. However, it seems that this differential can be closed since it has been committed as https://reviews.llvm.org/rL271737. https://reviews.llvm.org/D19910 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24084: [CMake] Cleanup libunwind lookup code.
logan added a comment. In https://reviews.llvm.org/D24084#532724, @asl wrote: > I totally agree with Renato. What part of libc++abi requires exactly > libunwind's unwind.h, what is the dependency? To be specific, we need: - Structure Definition: `_Unwind_Control_Block` (missing from `` bundled with clang) - Function Declarations: `_Unwind_GetLanguageSpecificData()`, `_Unwind_GetRegionStart()`, `_Unwind_{Get,Set}{IP,GR}()`, `_Unwind_{Get,Set}_VRS()`, `_Unwind_RaiseException()` This is the status quo after `libunwind` was spun off (or splitted) last year. https://reviews.llvm.org/D24084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r280484 - [lit] Replace print with lit_config.note().
Author: logan Date: Fri Sep 2 08:56:05 2016 New Revision: 280484 URL: http://llvm.org/viewvc/llvm-project?rev=280484&view=rev Log: [lit] Replace print with lit_config.note(). This commit replaces print statement with lit_config.note(). This fixes python3 support for check-libcxxabi. Modified: libcxxabi/trunk/test/lit.cfg Modified: libcxxabi/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.cfg?rev=280484&r1=280483&r2=280484&view=diff == --- libcxxabi/trunk/test/lit.cfg (original) +++ libcxxabi/trunk/test/lit.cfg Fri Sep 2 08:56:05 2016 @@ -55,7 +55,7 @@ config.test_exec_root = os.path.join(obj cfg_variant = getattr(config, 'configuration_variant', 'libcxxabi') if cfg_variant: -print 'Using configuration variant: %s' % cfg_variant +lit_config.note('Using configuration variant: %s' % cfg_variant) # Load the Configuration class from the module name .test.config. config_module_name = '.'.join([cfg_variant, 'test', 'config']) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24080: [lit] Replace print with lit_config.note().
logan added a comment. Thanks. Committed as https://reviews.llvm.org/rL280484. https://reviews.llvm.org/D24080 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24087: [lit] Allow more file extensions for test cases.
logan added inline comments. Comment at: test/libcxx/test/format.py:69 @@ +68,3 @@ +name_root, name_ext = os.path.splitext(name) +is_sh_test = name_root.endswith('.sh') +is_pass_test = name_root.endswith('.pass') EricWF wrote: > Since we only support `.sh.XXX` tests let's only loosen the restriction there > for now. Do you mean that it is preferred to revert following two lines back? For example: is_sh_test = name_root.endswith('.sh') is_pass_test = name.endswith('.pass.cpp') is_fail_test = name.endswith('.fail.cpp') assert is_sh_test or name_ext == '.cpp' https://reviews.llvm.org/D24087 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D24083: [CMake] Fix libc++abi __aeabi_idiv() link error.
logan added a comment. Hi @rengolin and @EricWF, After tracing the commit log of clang, it seems that `--rtlib=` is ignored intentionally when `-nodefaultlibs` is present. (see also: https://reviews.llvm.org/rL254535) And, unfortunately, we don't have a command line option to ask clang to link compiler-rt built-in library along (regardless the `-nodefaultlibs` option.) One solution might be adding the `libclang_rt.builtins.${arch}.a` detection rules[1] to CMakeLists.txt, and manually specify `-lclang_rt.builtins-${arch}.a` when `LIBCXXABI_USE_COMPILER_RT` is enabled. How do you think about this solution? [1] There is a function named `ToolChain::getCompilerRT()` in `${clang}/lib/Driver/ToolChain.cpp` which is responsible to detect and pick the correct compiler-rt library. https://reviews.llvm.org/D24083 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24085: arm: Fix ttype encoding assertion failure.
logan added inline comments. Comment at: src/cxa_personality.cpp:363 + "Unexpected TTypeEncoding"); (void)ttypeEncoding; mclow.lists wrote: > logan wrote: > > mclow.lists wrote: > > > It's not clear to me how this accomplishes what you want. > > > You're looking for `00/10/90`, right? Why not just check for that? > > > > > > Why are you anding with 0x0f ? > > > Before, this would pass only a single value - `DW_EH_PE_absptr` (aka 0) > > > With this change, it passes 32 values: 00, 03, 10, 13, 20, 23, and so on. > > > > > > Was that your intent? > > > > > `ttypeEncoding` is encoded with following rules: > > > > 1. Lower 4 bits stand for the representation of the data, such as `absptr`, > > `uleb128`, `udata1`, `udata2`, `udata4`, `udata8`, etc. These bits control > > the way we extract the bytes from the exception table. > > > > 2. Upper 4 bits stand for the post processing action, such as `pcrel`, > > `indirect`, etc. For example, if `pcrel` is specified, then we should add > > the value, which was read in step 1, with the address of the value. > > > > My intention is to weaken the assertion (only assert the essential > > assumption) so that we don't have to alter the assertion if there are new > > configurations that I am not aware of or new compiler which is generating > > different ttypeEncoding. > > > > Since the upcoming lines (L365) only uses `sizeof(uintptr_t)` to decode the > > TType pointer, it is not necessary to impose restriction on the upper 4 > > bits. That's the reason why I wrote `ttypeEncoding & 0xf`. For the same > > reason, both `absptr` and `udata` have the same meaning (4 bytes in the > > exception table) in this context, thus I am adding extra `(ttypeEncoding & > > 0x0f) == DW_EH_PE_udata4`. > Ok; thanks for the explanation. However, I'm still concerned. > The assert is there to catch bad assumptions. (i.e, this can never happen). > > the old code would assert on 255 of 256 possible values. > It turns out that this is too strict - there are at least three values that > we need to pass. > > But your assertion passes 32 possible values (out of 256). So if something > goes wrong, and a random value for `ttypeEncoding` gets passed in here, > there's a 1 in 8 chance that the assertion will not fire. *Thats* my > concern. It should never be an issue, because we don't have bugs, and never > pass random values around, right? ;-) > > As for "dealing with new configurations" or "new compilers", I would say > those are very infrequent events; and I wouldn't worry about them until they > happen. (Demonstrations that I am misinformed here are welcome) Thanks. I'll update the patch soon. https://reviews.llvm.org/D24085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24085: arm: Fix ttype encoding assertion failure.
logan updated this revision to Diff 76394. logan added a comment. Refine assertions to address the comments from mclow.lists. https://reviews.llvm.org/D24085 Files: src/cxa_personality.cpp test/lit.cfg test/lit.site.cfg.in test/native/arm-linux-eabi/lit.local.cfg test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s Index: test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s === --- /dev/null +++ test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s @@ -0,0 +1,96 @@ +@ RUN: %cxx %flags %link_flags %s -o %t.exe +@ RUN: %exec %t.exe + +@ PURPOSE: Check that 0x90 is a valid value for ttype encoding. + +@ NOTE: +@ +@ This file is generated from the following C++ source code and then change the +@ `TType Encoding` to 0x90. +@ +@ ``` +@ int main() { +@ try { +@ throw 5; +@ } catch (int i) { +@ if (i != 5) +@ abort(); +@ return 0; +@ } +@ } +@ ``` + + .syntax unified + + .text + .globl main + .p2align 2 + .type main,%function +main: @ @main +.Lfunc_begin0: + .fnstart +@ BB#0: @ %entry + .save {r11, lr} + push {r11, lr} + .setfp r11, sp + mov r11, sp + mov r0, #4 + bl __cxa_allocate_exception + mov r1, #5 + str r1, [r0] +.Ltmp0: + ldr r1, .LCPI0_0 + mov r2, #0 + bl __cxa_throw +.Ltmp1: + +@ BB#2: @ %lpad +.Ltmp2: + bl __cxa_begin_catch + ldr r0, [r0] + cmp r0, #5 + bne .LBB0_4 +@ BB#3: @ %if.end + bl __cxa_end_catch + mov r0, #0 + pop {r11, lr} + bx lr +.LBB0_4:@ %if.then + bl abort + .p2align 2 +@ BB#5: +.LCPI0_0: + .long _ZTIi +.Lfunc_end0: + + .size main, .Lfunc_end0-main + .globl __gxx_personality_v0 + .personality __gxx_personality_v0 + .handlerdata + .p2align 2 +GCC_except_table0: +.Lexception0: + .byte 255 @ @LPStart Encoding = omit + .byte 0x90@ @TType Encoding = indirect | pcrel + .asciz "\257\200" @ @TType base offset + .byte 3 @ Call site Encoding = udata4 + .byte 39 @ Call site table length + .long .Lfunc_begin0-.Lfunc_begin0 @ >> Call Site 1 << + .long .Ltmp0-.Lfunc_begin0@ Call between .Lfunc_begin0 and .Ltmp0 + .long 0 @ has no landing pad + .byte 0 @ On action: cleanup + .long .Ltmp0-.Lfunc_begin0@ >> Call Site 2 << + .long .Ltmp1-.Ltmp0 @ Call between .Ltmp0 and .Ltmp1 + .long .Ltmp2-.Lfunc_begin0@ jumps to .Ltmp2 + .byte 1 @ On action: 1 + .long .Ltmp1-.Lfunc_begin0@ >> Call Site 3 << + .long .Lfunc_end0-.Ltmp1 @ Call between .Ltmp1 and .Lfunc_end0 + .long 0 @ has no landing pad + .byte 0 @ On action: cleanup + .byte 1 @ >> Action Record 1 << +@ Catch TypeInfo 1 + .byte 0 @ No further actions +@ >> Catch TypeInfos << + .long _ZTIi(target2) @ TypeInfo 1 + .p2align 2 + .fnend Index: test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s === --- /dev/null +++ test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s @@ -0,0 +1,97 @@ +@ RUN: %cxx %flags %link_flags %s -o %t.exe +@ RUN: %exec %t.exe + +@ PURPOSE: Check that 0x00 is a valid value for ttype encoding. LLVM and +@ GCC 4.6 are generating 0x00 as ttype encoding. libc++abi should provide +@ legacy support. + +@ NOTE: +@ +@ This file is generated from the following C++ source code: +@ +@ ``` +@ int main() { +@ try { +@ throw 5; +@ } catch (int i) { +@ if (i != 5) +@ abort(); +@ return 0; +@ } +@ } +@ ``` + + .syntax unified + + .text + .globl main + .p2align 2 + .type main,%function +main: @ @main +.Lfunc_begin0: + .fnstart +@ BB#0: @ %entry + .save {r11, lr} + push {r11, lr} + .setfp r11, sp + mov r11, sp + mov r0, #4 + bl __cxa_allocate_exception + mov r1, #5 + str r1, [r0] +.Ltmp0: + ldr r1, .LCPI0_0 + mov r2, #0 + bl __cxa_throw +.Ltmp1: + +@ BB#2: @ %lpad +.Ltmp2: + bl __cxa_begin_catch + ldr r0, [r0] + cmp r0, #5 + bne .LBB0_4 +@ BB#3: @ %if.end + bl __cxa_end_catch + mov r0, #0 + pop {r11, lr} + bx lr +.LBB0_4:@ %if.then + bl abort + .p2align 2 +@ BB#5: +.LCPI0_0: + .long _ZTIi +.Lfunc_end0: + + .size main, .Lfunc_end0-main + .globl __gxx_personality_v0 + .personality __gxx_personality_v0 + .handlerdata + .p2align 2 +GCC_except_table0: +.Lexception0: + .byte 255 @ @LPStart Encoding = omit + .byte 0 @ @TType Encoding = absptr + .asciz "\257\
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan added a comment. Hi @EricWF and @mclow.lists: Do you have any comments? https://reviews.llvm.org/D24082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan added a comment. Hi @EricWF: Thanks for your comment. However, I think `OFF` is a better default for ARM (just like other platforms.) I usually use `libc++abi` without `libunwind` since `libgcc` is quite stable and usually linked by default. Besides, it is much more tricky to get the libc++/libc++abi/libunwind/compiler-rt combo work. The situation goes even worse when you are linking `libgcc` together. Logan https://reviews.llvm.org/D24082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan added a comment. Hi @EricWF: Would you mind if I commit this patch as-is? I believe `OFF` will is the better default value for ARM as well. Thanks. Logan https://reviews.llvm.org/D24082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r286759 - [CMake] Fix libc++abi arm build w/o libunwind.
Author: logan Date: Sun Nov 13 08:42:15 2016 New Revision: 286759 URL: http://llvm.org/viewvc/llvm-project?rev=286759&view=rev Log: [CMake] Fix libc++abi arm build w/o libunwind. This commit fixes libc++abi build when LLVM unwinder (libunwind_llvm) is not enabled. This commit fixes the problem by removing "LLVM_NATIVE_ARCH MATCHES ARM" from CMakeLists.txt so that LIBCXXABI_USE_LLVM_UNWINDER will only be defined when LLVM unwinder is enabled. We need LIBCXXABI_USE_LLVM_UNWINDER becase there is a subtle difference between the unwinder from libgcc and the one from libunwind_llvm. For the unwinder from libgcc, we have to initialize register r12 with the address of _Unwind_Control_Block; otherwise, _Unwind_GetLanguageSpecificData() and _Unwind_GetRegionStart() won't work properly. Consequently, there is an extra _Unwind_SetGR() when LLVM unwinder is disabled. Check cxa_personality.cpp for details. Modified: libcxxabi/trunk/CMakeLists.txt Modified: libcxxabi/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/CMakeLists.txt?rev=286759&r1=286758&r2=286759&view=diff == --- libcxxabi/trunk/CMakeLists.txt (original) +++ libcxxabi/trunk/CMakeLists.txt Sun Nov 13 08:42:15 2016 @@ -362,7 +362,7 @@ if (MSVC) endif() # Define LIBCXXABI_USE_LLVM_UNWINDER for conditional compilation. -if (LIBCXXABI_USE_LLVM_UNWINDER OR LLVM_NATIVE_ARCH MATCHES ARM) +if (LIBCXXABI_USE_LLVM_UNWINDER) add_definitions(-DLIBCXXABI_USE_LLVM_UNWINDER=1) endif() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D24082: [CMake] Fix libc++abi arm build w/o libunwind.
logan closed this revision. logan added a comment. Thanks. Committed as https://reviews.llvm.org/rL286759. https://reviews.llvm.org/D24082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r286760 - arm: Fix ttype encoding assertion failure.
Author: logan Date: Sun Nov 13 08:44:41 2016 New Revision: 286760 URL: http://llvm.org/viewvc/llvm-project?rev=286760&view=rev Log: arm: Fix ttype encoding assertion failure. GCC 4.7 or newer emits 0x90 (indirect | pcrel) as the ttype encoding. This would hit an assertion in cxa_personality.cpp. This commit fixes the problem by relaxing the assertion. Added: libcxxabi/trunk/test/native/ libcxxabi/trunk/test/native/arm-linux-eabi/ libcxxabi/trunk/test/native/arm-linux-eabi/lit.local.cfg libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-90.pass.sh.s Modified: libcxxabi/trunk/src/cxa_personality.cpp libcxxabi/trunk/test/lit.cfg libcxxabi/trunk/test/lit.site.cfg.in Modified: libcxxabi/trunk/src/cxa_personality.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=286760&r1=286759&r2=286760&view=diff == --- libcxxabi/trunk/src/cxa_personality.cpp (original) +++ libcxxabi/trunk/src/cxa_personality.cpp Sun Nov 13 08:44:41 2016 @@ -348,7 +348,10 @@ get_shim_type_info(uint64_t ttypeIndex, call_terminate(native_exception, unwind_exception); } -assert(ttypeEncoding == DW_EH_PE_absptr && "Unexpected TTypeEncoding"); +assert(((ttypeEncoding == DW_EH_PE_absptr) || // LLVM or GCC 4.6 +(ttypeEncoding == DW_EH_PE_pcrel) || // GCC 4.7 baremetal +(ttypeEncoding == (DW_EH_PE_pcrel | DW_EH_PE_indirect))) && // GCC 4.7 linux + "Unexpected TTypeEncoding"); (void)ttypeEncoding; const uint8_t* ttypePtr = classInfo - ttypeIndex * sizeof(uintptr_t); @@ -415,7 +418,10 @@ exception_spec_can_catch(int64_t specInd call_terminate(false, unwind_exception); } -assert(ttypeEncoding == DW_EH_PE_absptr && "Unexpected TTypeEncoding"); +assert(((ttypeEncoding == DW_EH_PE_absptr) || // LLVM or GCC 4.6 +(ttypeEncoding == DW_EH_PE_pcrel) || // GCC 4.7 baremetal +(ttypeEncoding == (DW_EH_PE_pcrel | DW_EH_PE_indirect))) && // GCC 4.7 linux + "Unexpected TTypeEncoding"); (void)ttypeEncoding; // specIndex is negative of 1-based byte offset into classInfo; Modified: libcxxabi/trunk/test/lit.cfg URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.cfg?rev=286760&r1=286759&r2=286760&view=diff == --- libcxxabi/trunk/test/lit.cfg (original) +++ libcxxabi/trunk/test/lit.cfg Sun Nov 13 08:44:41 2016 @@ -18,7 +18,7 @@ if 'PYLINT_IMPORT' in os.environ: config.name = 'libc++abi' # suffixes: A list of file extensions to treat as test files. -config.suffixes = ['.cpp'] +config.suffixes = ['.cpp', '.s'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) Modified: libcxxabi/trunk/test/lit.site.cfg.in URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/lit.site.cfg.in?rev=286760&r1=286759&r2=286760&view=diff == --- libcxxabi/trunk/test/lit.site.cfg.in (original) +++ libcxxabi/trunk/test/lit.site.cfg.in Sun Nov 13 08:44:41 2016 @@ -16,6 +16,8 @@ config.executor = "@LIBC config.libcxxabi_shared = "@LIBCXXABI_ENABLE_SHARED@" config.enable_shared= "@LIBCXX_ENABLE_SHARED@" config.enable_exceptions= "@LIBCXXABI_ENABLE_EXCEPTIONS@" +config.host_triple = "@LLVM_HOST_TRIPLE@" +config.target_triple= "@TARGET_TRIPLE@" # Let the main config do the real work. lit_config.load_config(config, "@LIBCXXABI_SOURCE_DIR@/test/lit.cfg") Added: libcxxabi/trunk/test/native/arm-linux-eabi/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/native/arm-linux-eabi/lit.local.cfg?rev=286760&view=auto == --- libcxxabi/trunk/test/native/arm-linux-eabi/lit.local.cfg (added) +++ libcxxabi/trunk/test/native/arm-linux-eabi/lit.local.cfg Sun Nov 13 08:44:41 2016 @@ -0,0 +1,6 @@ +def is_arm_linux_eabi(triple): +return ('arm' in triple) and ('linux' in triple) and ('eabi' in triple) + +is_native = config.root.host_triple == config.root.target_triple +if not is_native or not is_arm_linux_eabi(config.root.host_triple): +config.unsupported = True Added: libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s?rev=286760&view=auto == --- libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s (added) +++ libcxxabi/trunk/test/native/arm-linux-eabi/ttype-encoding-00.pass.sh.s Sun Nov 13 08:44:41 201
[PATCH] D24085: arm: Fix ttype encoding assertion failure.
logan closed this revision. logan added a comment. Thanks for reviewing. Committed as https://reviews.llvm.org/rL286760. https://reviews.llvm.org/D24085 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added a comment. In general, it looks good to me if the comments are addressed. Sorry for not replying responsively. Not sure why I missed the follow-up e-mails after @rengolin's reply. Comment at: lib/Headers/unwind.h:61 @@ +60,3 @@ +#define _UNWIND_ARM_EHABI 0 +#endif + Since this is `unwind.h`, I feel that we can get a step further and use `__ARM_EABI_UNWINDER__` to get more compatibility to GCC's unwind.h. Here's the change: ``` #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ !defined(__ARM_DWARF_EH__) #define __ARM_EABI_UNWINDER__ 1 #endif ``` Comment at: lib/Headers/unwind.h:89 @@ -81,1 +88,3 @@ _URC_NO_REASON = 0, +#if _UNWIND_ARM_EHABI + _URC_OK = 0, /* used by ARM EHABI */ ``` #ifdef __ARM_EABI_UNWINDER__ ``` Comment at: lib/Headers/unwind.h:166 @@ -152,1 +165,3 @@ +#if _UNWIND_ARM_EHABI +typedef uint32_t _Unwind_State; ``` #ifdef __ARM_EABI_UNWINDER__ ``` http://reviews.llvm.org/D15883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added inline comments. Comment at: lib/Headers/unwind.h:61 @@ +60,3 @@ +#define _UNWIND_ARM_EHABI 0 +#endif + compnerd wrote: > logan wrote: > > Since this is `unwind.h`, I feel that we can get a step further and use > > `__ARM_EABI_UNWINDER__` to get more compatibility to GCC's unwind.h. > > > > Here's the change: > > > > ``` > > #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ > > !defined(__ARM_DWARF_EH__) > > #define __ARM_EABI_UNWINDER__ 1 > > #endif > > ``` > I dont know if we really need to imitate GCC's macros here. Am I mistaken in > that they assume that `__ARM_EABI_UNWINDER__` has been set to 1 externally if > targeting such an environment? I think that it is better to use the reserved > namespace and intrude into libunwind's namespace as already done here. > Am I mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been set > to 1 externally if targeting such an environment? Although this is an implementation detail, it was defined by `unwind.h` in the implementation of GCC. Remark: `__ARM_EABI_UNWINDER__` is not a pre-defined macro in GCC and Clang (can be checked with ` gcc -dM -E - < /dev/null`.) BTW, some applications or libraries need this macro to be defined after including `` (such as uclibc, boost, or libc++abi 3.0.) I remembered that someone suggested to use `__ARM_EABI_UNWINDER__` instead of `LIBCXXABI_ARM_EHABI` when I was fixing libc++abi several years ago. I chose `LIBCXXABI_ARM_EHABI` simply because `__ARM_EABI_UNWINDER__` wasn't provided by clang at that time. I am less concerned to namespace pollution, because this is already the de facto implementation in GCC world and the macro names start with underscores are reserved for compiler or standard libraries by convention. Since this is file a public header and will be used for a long time, I personally believe that it will be better to use an existing name with the same meaning instead of introducing a new name. In addition, this will make it easier to port the application between gcc and clang. http://reviews.llvm.org/D15883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added inline comments. Comment at: lib/Headers/unwind.h:61 @@ +60,3 @@ +#define _UNWIND_ARM_EHABI 0 +#endif + compnerd wrote: > logan wrote: > > compnerd wrote: > > > logan wrote: > > > > Since this is `unwind.h`, I feel that we can get a step further and use > > > > `__ARM_EABI_UNWINDER__` to get more compatibility to GCC's unwind.h. > > > > > > > > Here's the change: > > > > > > > > ``` > > > > #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ > > > > !defined(__ARM_DWARF_EH__) > > > > #define __ARM_EABI_UNWINDER__ 1 > > > > #endif > > > > ``` > > > I dont know if we really need to imitate GCC's macros here. Am I > > > mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been set to > > > 1 externally if targeting such an environment? I think that it is better > > > to use the reserved namespace and intrude into libunwind's namespace as > > > already done here. > > > Am I mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been > > > set to 1 externally if targeting such an environment? > > > > Although this is an implementation detail, it was defined by `unwind.h` in > > the implementation of GCC. > > > > Remark: `__ARM_EABI_UNWINDER__` is not a pre-defined macro in GCC and Clang > > (can be checked with ` gcc -dM -E - < /dev/null`.) > > > > BTW, some applications or libraries need this macro to be defined after > > including `` (such as uclibc, boost, or libc++abi 3.0.) I > > remembered that someone suggested to use `__ARM_EABI_UNWINDER__` instead of > > `LIBCXXABI_ARM_EHABI` when I was fixing libc++abi several years ago. I > > chose `LIBCXXABI_ARM_EHABI` simply because `__ARM_EABI_UNWINDER__` wasn't > > provided by clang at that time. > > > > I am less concerned to namespace pollution, because this is already the de > > facto implementation in GCC world and the macro names start with > > underscores are reserved for compiler or standard libraries by convention. > > > > Since this is file a public header and will be used for a long time, I > > personally believe that it will be better to use an existing name with the > > same meaning instead of introducing a new name. In addition, this will > > make it easier to port the application between gcc and clang. > I just checked, libc++abi has no use of this macro, nor does boost 1.60. > uclibc only defines `__ARM_EABI_UNWINDER__`, but does not use it. I also > checked glibc and musl, and glibc like uclibc defines it while musl has no > references to it. This is injecting itself into the compiler namespace and > is misleading, so I think I would really rather prefer the current patch as > is. > I just checked, libc++abi has no use of this macro, nor does boost 1.60. > uclibc only defines __ARM_EABI_UNWINDER__, but does not use it. I also > checked glibc and musl, and glibc like uclibc defines it while musl has no > references to it. For uClibc++ and Boost I only did a simple Google search while writing the previous reply. Sorry for the brevity. Although uClibc++ itself does not use `__ARM_EABI_UNWINDER__`, some third-party ARM ports are using this macro. For example, [toyroot](https://github.com/luckboy/toyroot), a small build system for small linux distribution, is maintaining a [local patch](https://github.com/luckboy/toyroot/blob/master/patch/uClibc%2B%2B-0.2.4-arm-eabi-unwinder.patch). Yet another example, [Aboriginal Linux](http://landley.net/aboriginal/) has [another patch](http://www.landley.net/hg/aboriginal/file/tip/sources/patches/uClibc%2B%2B-unwind-cxx.patch) that requires this macro. Someone even sent a [patch](http://lists.uclibc.org/pipermail/uclibc/2012-June/046915.html) to uClibc++ mailing list. For Boost, I am referring to [this thread](http://lists.boost.org/Archives/boost/2008/04/136332.php), although it seems not being committed. For libc++abi, I am referring to the [earlier version](http://llvm.org/klaus/libcxxabi/blob/8b547a338373b6e149d8ceed34bbf6a979a1e10d/src/cxa_exception.hpp) (roughly 3.4.) You won't find `__ARM_EABI_UNWINDER__` in libc++abi master branch because I removed it in [05d51bcf07](http://llvm.org/klaus/libcxxabi/commit/05d51bcf07d0ec1c40785b4a860fd917410b4be1/) when I was implementing the ARM EHABI support. I remembered in the [review comments](http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20140414/103125.html) Jonathan even suggested me to use `__ARM_EABI_UNWINDER__` instead. I couldn't do so because `__ARM_EABI_UNWINDER__` was not defined by `/lib/Headers/unwind.h`. The main purpose to mention these projects is to demonstrate that `__ARM_EABI_UNWINDER__` is a common knownledge between unwinder or personality developers. Many of us will come up with `__ARM_EABI_UNWINDER__` when we need to distinguish ARM EHABI code and Itanium code. > This is injecting itself into the compiler namespace and is misleading, so I > think I would really rather prefer the
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added inline comments. Comment at: lib/Headers/unwind.h:61 @@ +60,3 @@ +#define _UNWIND_ARM_EHABI 0 +#endif + logan wrote: > compnerd wrote: > > logan wrote: > > > compnerd wrote: > > > > logan wrote: > > > > > Since this is `unwind.h`, I feel that we can get a step further and > > > > > use `__ARM_EABI_UNWINDER__` to get more compatibility to GCC's > > > > > unwind.h. > > > > > > > > > > Here's the change: > > > > > > > > > > ``` > > > > > #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ > > > > > !defined(__ARM_DWARF_EH__) > > > > > #define __ARM_EABI_UNWINDER__ 1 > > > > > #endif > > > > > ``` > > > > I dont know if we really need to imitate GCC's macros here. Am I > > > > mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been set > > > > to 1 externally if targeting such an environment? I think that it is > > > > better to use the reserved namespace and intrude into libunwind's > > > > namespace as already done here. > > > > Am I mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been > > > > set to 1 externally if targeting such an environment? > > > > > > Although this is an implementation detail, it was defined by `unwind.h` > > > in the implementation of GCC. > > > > > > Remark: `__ARM_EABI_UNWINDER__` is not a pre-defined macro in GCC and > > > Clang (can be checked with ` gcc -dM -E - < /dev/null`.) > > > > > > BTW, some applications or libraries need this macro to be defined after > > > including `` (such as uclibc, boost, or libc++abi 3.0.) I > > > remembered that someone suggested to use `__ARM_EABI_UNWINDER__` instead > > > of `LIBCXXABI_ARM_EHABI` when I was fixing libc++abi several years ago. > > > I chose `LIBCXXABI_ARM_EHABI` simply because `__ARM_EABI_UNWINDER__` > > > wasn't provided by clang at that time. > > > > > > I am less concerned to namespace pollution, because this is already the > > > de facto implementation in GCC world and the macro names start with > > > underscores are reserved for compiler or standard libraries by convention. > > > > > > Since this is file a public header and will be used for a long time, I > > > personally believe that it will be better to use an existing name with > > > the same meaning instead of introducing a new name. In addition, this > > > will make it easier to port the application between gcc and clang. > > I just checked, libc++abi has no use of this macro, nor does boost 1.60. > > uclibc only defines `__ARM_EABI_UNWINDER__`, but does not use it. I also > > checked glibc and musl, and glibc like uclibc defines it while musl has no > > references to it. This is injecting itself into the compiler namespace and > > is misleading, so I think I would really rather prefer the current patch as > > is. > > I just checked, libc++abi has no use of this macro, nor does boost 1.60. > > uclibc only defines __ARM_EABI_UNWINDER__, but does not use it. I also > > checked glibc and musl, and glibc like uclibc defines it while musl has no > > references to it. > > For uClibc++ and Boost I only did a simple Google search while writing the > previous reply. Sorry for the brevity. > > Although uClibc++ itself does not use `__ARM_EABI_UNWINDER__`, some > third-party ARM ports are using this macro. For example, > [toyroot](https://github.com/luckboy/toyroot), a small build system for small > linux distribution, is maintaining a [local > patch](https://github.com/luckboy/toyroot/blob/master/patch/uClibc%2B%2B-0.2.4-arm-eabi-unwinder.patch). > Yet another example, [Aboriginal Linux](http://landley.net/aboriginal/) has > [another > patch](http://www.landley.net/hg/aboriginal/file/tip/sources/patches/uClibc%2B%2B-unwind-cxx.patch) > that requires this macro. Someone even sent a > [patch](http://lists.uclibc.org/pipermail/uclibc/2012-June/046915.html) to > uClibc++ mailing list. > > For Boost, I am referring to [this > thread](http://lists.boost.org/Archives/boost/2008/04/136332.php), although > it seems not being committed. > > For libc++abi, I am referring to the [earlier > version](http://llvm.org/klaus/libcxxabi/blob/8b547a338373b6e149d8ceed34bbf6a979a1e10d/src/cxa_exception.hpp) > (roughly 3.4.) You won't find `__ARM_EABI_UNWINDER__` in libc++abi master > branch because I removed it in > [05d51bcf07](http://llvm.org/klaus/libcxxabi/commit/05d51bcf07d0ec1c40785b4a860fd917410b4be1/) > when I was implementing the ARM EHABI support. I remembered in the [review > comments](http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20140414/103125.html) > Jonathan even suggested me to use `__ARM_EABI_UNWINDER__` instead. I > couldn't do so because `__ARM_EABI_UNWINDER__` was not defined by > `/lib/Headers/unwind.h`. > > The main purpose to mention these projects is to demonstrate that > `__ARM_EABI_UNWINDER__` is a common knownledge between unwinder or > personality developers. Many of us will come up with `__ARM_E
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added inline comments. Comment at: lib/Headers/unwind.h:61 @@ +60,3 @@ +#define _UNWIND_ARM_EHABI 0 +#endif + compnerd wrote: > logan wrote: > > logan wrote: > > > compnerd wrote: > > > > logan wrote: > > > > > compnerd wrote: > > > > > > logan wrote: > > > > > > > Since this is `unwind.h`, I feel that we can get a step further > > > > > > > and use `__ARM_EABI_UNWINDER__` to get more compatibility to > > > > > > > GCC's unwind.h. > > > > > > > > > > > > > > Here's the change: > > > > > > > > > > > > > > ``` > > > > > > > #if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ > > > > > > > !defined(__ARM_DWARF_EH__) > > > > > > > #define __ARM_EABI_UNWINDER__ 1 > > > > > > > #endif > > > > > > > ``` > > > > > > I dont know if we really need to imitate GCC's macros here. Am I > > > > > > mistaken in that they assume that `__ARM_EABI_UNWINDER__` has been > > > > > > set to 1 externally if targeting such an environment? I think that > > > > > > it is better to use the reserved namespace and intrude into > > > > > > libunwind's namespace as already done here. > > > > > > Am I mistaken in that they assume that `__ARM_EABI_UNWINDER__` has > > > > > > been set to 1 externally if targeting such an environment? > > > > > > > > > > Although this is an implementation detail, it was defined by > > > > > `unwind.h` in the implementation of GCC. > > > > > > > > > > Remark: `__ARM_EABI_UNWINDER__` is not a pre-defined macro in GCC and > > > > > Clang (can be checked with ` gcc -dM -E - < /dev/null`.) > > > > > > > > > > BTW, some applications or libraries need this macro to be defined > > > > > after including `` (such as uclibc, boost, or libc++abi > > > > > 3.0.) I remembered that someone suggested to use > > > > > `__ARM_EABI_UNWINDER__` instead of `LIBCXXABI_ARM_EHABI` when I was > > > > > fixing libc++abi several years ago. I chose `LIBCXXABI_ARM_EHABI` > > > > > simply because `__ARM_EABI_UNWINDER__` wasn't provided by clang at > > > > > that time. > > > > > > > > > > I am less concerned to namespace pollution, because this is already > > > > > the de facto implementation in GCC world and the macro names start > > > > > with underscores are reserved for compiler or standard libraries by > > > > > convention. > > > > > > > > > > Since this is file a public header and will be used for a long time, > > > > > I personally believe that it will be better to use an existing name > > > > > with the same meaning instead of introducing a new name. In > > > > > addition, this will make it easier to port the application between > > > > > gcc and clang. > > > > I just checked, libc++abi has no use of this macro, nor does boost > > > > 1.60. uclibc only defines `__ARM_EABI_UNWINDER__`, but does not use > > > > it. I also checked glibc and musl, and glibc like uclibc defines it > > > > while musl has no references to it. This is injecting itself into the > > > > compiler namespace and is misleading, so I think I would really rather > > > > prefer the current patch as is. > > > > I just checked, libc++abi has no use of this macro, nor does boost > > > > 1.60. uclibc only defines __ARM_EABI_UNWINDER__, but does not use it. I > > > > also checked glibc and musl, and glibc like uclibc defines it while > > > > musl has no references to it. > > > > > > For uClibc++ and Boost I only did a simple Google search while writing > > > the previous reply. Sorry for the brevity. > > > > > > Although uClibc++ itself does not use `__ARM_EABI_UNWINDER__`, some > > > third-party ARM ports are using this macro. For example, > > > [toyroot](https://github.com/luckboy/toyroot), a small build system for > > > small linux distribution, is maintaining a [local > > > patch](https://github.com/luckboy/toyroot/blob/master/patch/uClibc%2B%2B-0.2.4-arm-eabi-unwinder.patch). > > > Yet another example, [Aboriginal Linux](http://landley.net/aboriginal/) > > > has [another > > > patch](http://www.landley.net/hg/aboriginal/file/tip/sources/patches/uClibc%2B%2B-unwind-cxx.patch) > > > that requires this macro. Someone even sent a > > > [patch](http://lists.uclibc.org/pipermail/uclibc/2012-June/046915.html) > > > to uClibc++ mailing list. > > > > > > For Boost, I am referring to [this > > > thread](http://lists.boost.org/Archives/boost/2008/04/136332.php), > > > although it seems not being committed. > > > > > > For libc++abi, I am referring to the [earlier > > > version](http://llvm.org/klaus/libcxxabi/blob/8b547a338373b6e149d8ceed34bbf6a979a1e10d/src/cxa_exception.hpp) > > > (roughly 3.4.) You won't find `__ARM_EABI_UNWINDER__` in libc++abi > > > master branch because I removed it in > > > [05d51bcf07](http://llvm.org/klaus/libcxxabi/commit/05d51bcf07d0ec1c40785b4a860fd917410b4be1/) > > > when I was implementing the ARM EHABI support. I remembered in the > > > [review > > > comments](http://lists.llvm.org/pipermail/cfe-commits/Week-of-
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan accepted this revision. logan added a comment. LGTM. It is good to go now. @timonvo, do you have commit access? Or, do you need some assistance? http://reviews.llvm.org/D15883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r262178 - Add ARM EHABI-related constants to unwind.h.
Author: logan Date: Sun Feb 28 09:01:42 2016 New Revision: 262178 URL: http://llvm.org/viewvc/llvm-project?rev=262178&view=rev Log: Add ARM EHABI-related constants to unwind.h. Adds a number of constants, defined in the ARM EHABI spec, to the Clang lib/Headers/unwind.h header. This is prerequisite for landing http://reviews.llvm.org/D15781, as previously discussed there. Patch by Timon Van Overveldt. 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=262178&r1=262177&r2=262178&view=diff == --- cfe/trunk/lib/Headers/unwind.h (original) +++ cfe/trunk/lib/Headers/unwind.h Sun Feb 28 09:01:42 2016 @@ -79,6 +79,10 @@ struct _Unwind_Context; struct _Unwind_Exception; typedef enum { _URC_NO_REASON = 0, +#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__ARM_DWARF_EH__) + _URC_OK = 0, /* used by ARM EHABI */ +#endif _URC_FOREIGN_EXCEPTION_CAUGHT = 1, _URC_FATAL_PHASE2_ERROR = 2, @@ -88,7 +92,11 @@ typedef enum { _URC_END_OF_STACK = 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 + _URC_CONTINUE_UNWIND = 8, +#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \ +!defined(__ARM_DWARF_EH__) + _URC_FAILURE = 9 /* used by ARM EHABI */ +#endif } _Unwind_Reason_Code; typedef enum { @@ -150,6 +158,15 @@ typedef enum { _UVRSR_FAILED = 2 } _Unwind_VRS_Result; +#if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__ARM_DWARF_EH__) +typedef uint32_t _Unwind_State; +#define _US_VIRTUAL_UNWIND_FRAME ((_Unwind_State)0) +#define _US_UNWIND_FRAME_STARTING ((_Unwind_State)1) +#define _US_UNWIND_FRAME_RESUME ((_Unwind_State)2) +#define _US_ACTION_MASK ((_Unwind_State)3) +#define _US_FORCE_UNWIND ((_Unwind_State)8) +#endif + _Unwind_VRS_Result _Unwind_VRS_Get(struct _Unwind_Context *__context, _Unwind_VRS_RegClass __regclass, uint32_t __regno, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15883: Add ARM EHABI-related constants to unwind.h.
logan added a comment. Hi @timonvo, I have committed this change as http://reviews.llvm.org/rL262178. Thanks for your work. Let's move forward to http://reviews.llvm.org/D15781. http://reviews.llvm.org/D15883 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18217: [libcxx] Fix -Wdeprecated warnings
logan added a subscriber: logan. logan added a comment. The simple replacement from `throw()` to `_NOEXCEPT` looks fine. But, why are you adding adding some copy constructors and assignment operators? May you briefly explain the reason? Besides, I have some concern with the `= default` specifier in some C++98 headers, e.g. ``. What will happen if the user is compiling with `-std=c++98`? And, unfortunately, I am not familiar with libc++ code base. I think you will need approvals from @mclow.lists or @EricWF. http://reviews.llvm.org/D18217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15613: Fix ARM __cxa_end_cleanup() and gc-sections.
logan created this revision. logan added reviewers: rengolin, danalbert, kevin.qin, echristo, srhines. logan added a subscriber: cfe-commits. Herald added subscribers: rengolin, aemerson. This commit adds SHF_ALLOC and SHF_EXECINSTR section flags to .text.__cxa_end_cleanup section. This fixes a link error when we are using integrated-as and ld.gold (with -Wl,--gc-sections and -Wl,--fatal-warnings.) Detailed Explanation: 1. There might be some issue with LLVM integrated-as, so that there is no default section flags for text sections. (This will be fixed in an independent commit.) 2. ld.gold will skip the external symbols in the section without SHF_ALLOC. This is the reason why .text.__cxa_end_cleanup_impl section is discarded even though it is referenced by __cxa_end_cleanup(). This commit workaround the problem by specifying the section flag explicitly. Fix http://llvm.org/PR21292 http://reviews.llvm.org/D15613 Files: src/cxa_exception.cpp Index: src/cxa_exception.cpp === --- src/cxa_exception.cpp +++ src/cxa_exception.cpp @@ -334,7 +334,7 @@ } asm ( -" .pushsection.text.__cxa_end_cleanup\n" +" .pushsection.text.__cxa_end_cleanup,\"ax\",%progbits\n" " .globl __cxa_end_cleanup\n" " .type __cxa_end_cleanup,%function\n" "__cxa_end_cleanup:\n" Index: src/cxa_exception.cpp === --- src/cxa_exception.cpp +++ src/cxa_exception.cpp @@ -334,7 +334,7 @@ } asm ( -" .pushsection .text.__cxa_end_cleanup\n" +" .pushsection .text.__cxa_end_cleanup,\"ax\",%progbits\n" " .globl __cxa_end_cleanup\n" " .type __cxa_end_cleanup,%function\n" "__cxa_end_cleanup:\n" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15613: Fix ARM __cxa_end_cleanup() and gc-sections.
logan added a comment. @echristo: IMO, I prefer not to add such comment for two reasons: 1. It will obscure the main idea of this piece of code. 2. It is common to specify the section flags (compilers will emit these flags by default as well), so it is unlikely to be removed in the future. Besides, one can always figure out the reason by checking the commit logs. http://reviews.llvm.org/D15613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r256241 - Fix ARM __cxa_end_cleanup() and gc-sections.
Author: logan Date: Tue Dec 22 08:38:30 2015 New Revision: 256241 URL: http://llvm.org/viewvc/llvm-project?rev=256241&view=rev Log: Fix ARM __cxa_end_cleanup() and gc-sections. This commit adds SHF_ALLOC and SHF_EXECINSTR section flags to `.text.__cxa_end_cleanup` section. This fixes a link error when we are using integrated-as and `ld.gold` (with `-Wl,--gc-sections` and `-Wl,--fatal-warnings`.) Detailed Explanation: 1. There might be some problem with LLVM integrated-as. It is not emitting any section flags for text sections. (This will be fixed in an independent commit.) 2. `ld.gold` will skip the external symbols in the section without SHF_ALLOC. This is the reason why `.text.__cxa_end_cleanup_impl` section is discarded even though it is referenced by `__cxa_end_cleanup()`. This commit workaround the problem by specifying the section flags explicitly. Fix http://llvm.org/PR21292 Modified: libcxxabi/trunk/src/cxa_exception.cpp Modified: libcxxabi/trunk/src/cxa_exception.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_exception.cpp?rev=256241&r1=256240&r2=256241&view=diff == --- libcxxabi/trunk/src/cxa_exception.cpp (original) +++ libcxxabi/trunk/src/cxa_exception.cpp Tue Dec 22 08:38:30 2015 @@ -334,7 +334,7 @@ __cxa_end_cleanup_impl() } asm ( -" .pushsection.text.__cxa_end_cleanup\n" +" .pushsection.text.__cxa_end_cleanup,\"ax\",%progbits\n" " .globl __cxa_end_cleanup\n" " .type __cxa_end_cleanup,%function\n" "__cxa_end_cleanup:\n" ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15613: Fix ARM __cxa_end_cleanup() and gc-sections.
logan closed this revision. logan added a comment. Thanks! Committed as http://reviews.llvm.org/rL256241. http://reviews.llvm.org/D15613 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits