Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Commit 185a40d

Browse files
authored
Merge pull request #10 from raoulstrackx/raoul/libunwind_clang_support
Support for compilation with clang
2 parents 5125c16 + 800f951 commit 185a40d

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

libunwind/src/CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ if (RUST_SGX)
5656
# on older platforms.
5757
#
5858
# See https://github.com/rust-lang/rust/issues/34978
59-
list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no)
59+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
60+
list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no)
61+
else()
62+
list(APPEND LIBUNWIND_COMPILE_FLAGS)
63+
endif()
6064

6165
# Sources
6266
list(APPEND LIBUNWIND_C_SOURCES UnwindRustSgx.c)
@@ -119,9 +123,9 @@ string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
119123
string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}")
120124

121125
set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
122-
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}")
126+
APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_CXX_FLAGS}")
123127
set_property(SOURCE ${LIBUNWIND_C_SOURCES}
124-
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}")
128+
APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_C_FLAGS}")
125129

126130
# Add a object library that contains the compiled source files.
127131
add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})

libunwind/src/UnwindLevel1.c

+3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
// to export these functions from libunwind.so as well.
2020
#define _LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE 1
2121

22+
#ifndef __clang__
2223
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
24+
#endif
25+
2326
#pragma GCC diagnostic ignored "-Wempty-body"
2427

2528
#include <inttypes.h>

libunwind/src/UnwindRustSgx.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <stddef.h>
1818
#include "UnwindRustSgx.h"
1919

20+
#pragma GCC diagnostic ignored "-Wunused-parameter"
2021

2122
#define max_log 256
2223

libunwind/src/UnwindRustSgxSnprintf.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
* on all source code distributions
66
*/
77

8-
#pragma GCC diagnostic ignored "-Wconversion"
8+
#ifndef __clang__
99
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
10+
#else
11+
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
12+
#endif
13+
14+
#pragma GCC diagnostic ignored "-Wconversion"
1015
#pragma GCC diagnostic ignored "-Wfloat-conversion"
1116
#pragma GCC diagnostic ignored "-Wsign-conversion"
1217
#pragma GCC diagnostic ignored "-Wstrict-overflow"

libunwind/src/libunwind.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#ifndef __clang__
1314
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
15+
#endif
16+
17+
#pragma GCC diagnostic ignored "-Wunused-parameter"
1418
#pragma GCC diagnostic ignored "-Wmissing-braces"
1519
#pragma GCC diagnostic ignored "-Wsign-conversion"
1620
#pragma GCC diagnostic ignored "-Wstrict-aliasing"

0 commit comments

Comments
 (0)