Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libunwind/CMakeLists.txt6
-rw-r--r--libunwind/src/AddressSpace.hpp2
-rw-r--r--libunwind/src/CMakeLists.txt13
-rw-r--r--libunwind/src/DwarfParser.hpp2
-rw-r--r--libunwind/src/UnwindCursor.hpp14
-rw-r--r--libunwind/src/UnwindLevel1.c2
-rw-r--r--libunwind/src/assembly.h4
-rw-r--r--libunwind/src/config.h9
-rw-r--r--libunwind/src/libunwind.cpp4
9 files changed, 41 insertions, 15 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 5a06805f05f1..d5cbf589a26c 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -242,7 +242,11 @@ if (LIBUNWIND_USES_ARM_EHABI AND NOT CXX_SUPPORTS_FUNWIND_TABLES_FLAG)
endif()
add_cxx_compile_flags_if_supported(-fno-exceptions)
-add_cxx_compile_flags_if_supported(-fno-rtti)
+if (CMAKE_C_COMPILER_ID STREQUAL "PGI")
+ add_cxx_compile_flags_if_supported(--no_rtti)
+else()
+ add_cxx_compile_flags_if_supported(-fno-rtti)
+endif()
# Ensure that we don't depend on C++ standard library.
if (CXX_SUPPORTS_NOSTDINCXX_FLAG)
diff --git a/libunwind/src/AddressSpace.hpp b/libunwind/src/AddressSpace.hpp
index 36c9f5a9e36f..dc8cd4e01416 100644
--- a/libunwind/src/AddressSpace.hpp
+++ b/libunwind/src/AddressSpace.hpp
@@ -606,7 +606,9 @@ inline bool LocalAddressSpace::findUnwindSections(pint_t targetAddr,
return static_cast<bool>(found);
#endif
+#ifndef __PGIC__
return false;
+#endif
}
inline bool LocalAddressSpace::findOtherFDE(pint_t targetAddr, pint_t &fde) {
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 61df2737be75..adea58fc82e9 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -22,9 +22,14 @@ set(LIBUNWIND_C_SOURCES
UnwindLevel1-gcc-ext.c
Unwind-sjlj.c
)
+set(C99_FLAG "-std=c99")
+if (CMAKE_CXX_COMPILER_ID STREQUAL PGI)
+ set(C99_FLAG "-c99")
+endif()
+
set_source_files_properties(${LIBUNWIND_C_SOURCES}
PROPERTIES
- COMPILE_FLAGS "-std=c99")
+ COMPILE_FLAGS ${C99_FLAG})
set(LIBUNWIND_ASM_SOURCES
UnwindRegistersRestore.S
@@ -139,6 +144,9 @@ set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
add_library(unwind_shared_objects OBJECT EXCLUDE_FROM_ALL ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
if(CMAKE_C_COMPILER_ID STREQUAL MSVC)
target_compile_options(unwind_shared_objects PRIVATE /GR-)
+ # Check the CXX ID because CMake is perplexed about NVCXX as the C compiler.
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL PGI)
+ elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL NVCXX)
else()
target_compile_options(unwind_shared_objects PRIVATE -fno-rtti)
endif()
@@ -176,6 +184,9 @@ endif()
add_library(unwind_static_objects OBJECT EXCLUDE_FROM_ALL ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
if(CMAKE_C_COMPILER_ID STREQUAL MSVC)
target_compile_options(unwind_static_objects PRIVATE /GR-)
+# Check the CXX ID because CMake is perplexed about NVCXX as the C compiler.
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL PGI)
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL NVCXX)
else()
target_compile_options(unwind_static_objects PRIVATE -fno-rtti)
endif()
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp
index b5a53166fc3f..99b8b29a9ca5 100644
--- a/libunwind/src/DwarfParser.hpp
+++ b/libunwind/src/DwarfParser.hpp
@@ -795,8 +795,10 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
break;
#else
+#ifndef __PGIC__
(void)arch;
#endif
+#endif
default:
operand = opcode & 0x3F;
diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index b8bd9bc59010..d4bd3aa96a32 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -424,9 +424,9 @@ private:
class _LIBUNWIND_HIDDEN AbstractUnwindCursor {
public:
- // NOTE: provide a class specific placement deallocation function (S5.3.4 p20)
- // This avoids an unnecessary dependency to libc++abi.
- void operator delete(void *, size_t) {}
+ static void * operator new(size_t, void *p) { return p; }
+ static void operator delete(void *, size_t) {}
+ static void operator delete(void *, void *) {}
virtual ~AbstractUnwindCursor() {}
virtual bool validReg(int) { _LIBUNWIND_ABORT("validReg not implemented"); }
@@ -509,10 +509,6 @@ 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<A, R> *p) { return p; }
-
private:
pint_t getLastPC() const { return _dispContext.ControlPc; }
@@ -945,10 +941,6 @@ public:
virtual void *get_registers() { return &_registers; }
#endif
- // 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<A, R> *p) { return p; }
-
private:
#if defined(_LIBUNWIND_ARM_EHABI)
diff --git a/libunwind/src/UnwindLevel1.c b/libunwind/src/UnwindLevel1.c
index 84f865e591fc..9ceb71b5cf01 100644
--- a/libunwind/src/UnwindLevel1.c
+++ b/libunwind/src/UnwindLevel1.c
@@ -281,9 +281,11 @@ unwind_phase2(unw_context_t *uc, unw_cursor_t *cursor, _Unwind_Exception *except
}
}
+#ifndef __PGIC__
// Clean up phase did not resume at the frame that the search phase
// said it would...
return _URC_FATAL_PHASE2_ERROR;
+#endif
}
static _Unwind_Reason_Code
diff --git a/libunwind/src/assembly.h b/libunwind/src/assembly.h
index fb07d04071af..d1ccc358e531 100644
--- a/libunwind/src/assembly.h
+++ b/libunwind/src/assembly.h
@@ -15,6 +15,10 @@
#ifndef UNWIND_ASSEMBLY_H
#define UNWIND_ASSEMBLY_H
+#if defined(__PGIC__) && defined(__linux__)
+ #define __ELF__
+#endif
+
#if defined(__linux__) && defined(__CET__)
#include <cet.h>
#define _LIBUNWIND_CET_ENDBR _CET_ENDBR
diff --git a/libunwind/src/config.h b/libunwind/src/config.h
index cc41b817acf6..f6855354d369 100644
--- a/libunwind/src/config.h
+++ b/libunwind/src/config.h
@@ -55,6 +55,11 @@
#endif
#endif
+#if defined(__PGIC__)
+ #undef _LIBUNWIND_HIDE_SYMBOLS
+ #define _LIBUNWIND_HIDE_SYMBOLS
+#endif
+
#if defined(_LIBUNWIND_HIDE_SYMBOLS)
// The CMake file passes -fvisibility=hidden to control ELF/Mach-O visibility.
#define _LIBUNWIND_EXPORT
@@ -73,6 +78,10 @@
#define XSTR(a) STR(a)
#define SYMBOL_NAME(name) XSTR(__USER_LABEL_PREFIX__) #name
+#if defined(__PGIC__) && defined(__linux__)
+ #define __ELF__
+#endif
+
#if defined(__APPLE__)
#if defined(_LIBUNWIND_HIDE_SYMBOLS)
#define _LIBUNWIND_ALIAS_VISIBILITY(name) __asm__(".private_extern " name);
diff --git a/libunwind/src/libunwind.cpp b/libunwind/src/libunwind.cpp
index b8b41ff25e54..71c02216750d 100644
--- a/libunwind/src/libunwind.cpp
+++ b/libunwind/src/libunwind.cpp
@@ -66,7 +66,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
#elif defined(__mips64)
# define REGISTER_KIND Registers_mips_newabi
#elif defined(__mips__)
-# warning The MIPS architecture is not supported with this ABI and environment!
+# error The MIPS architecture is not supported with this ABI and environment!
#elif defined(__sparc__) && defined(__arch64__)
#define REGISTER_KIND Registers_sparc64
#elif defined(__sparc__)
@@ -81,7 +81,7 @@ _LIBUNWIND_HIDDEN int __unw_init_local(unw_cursor_t *cursor,
# error Architecture not supported
#endif
// Use "placement new" to allocate UnwindCursor in the cursor buffer.
- new (reinterpret_cast<UnwindCursor<LocalAddressSpace, REGISTER_KIND> *>(cursor))
+ new (static_cast<void *>(cursor))
UnwindCursor<LocalAddressSpace, REGISTER_KIND>(
context, LocalAddressSpace::sThisAddressSpace);
#undef REGISTER_KIND