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

Commit

Permalink
Merge pull request #10 from raoulstrackx/raoul/libunwind_clang_support
Browse files Browse the repository at this point in the history
Support for compilation with clang
  • Loading branch information
jethrogb authored Mar 9, 2020
2 parents 5125c16 + 800f951 commit 185a40d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
10 changes: 7 additions & 3 deletions libunwind/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ if (RUST_SGX)
# on older platforms.
#
# See https:/rust-lang/rust/issues/34978
list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
list(APPEND LIBUNWIND_COMPILE_FLAGS -Wa,-mrelax-relocations=no)
else()
list(APPEND LIBUNWIND_COMPILE_FLAGS)
endif()

# Sources
list(APPEND LIBUNWIND_C_SOURCES UnwindRustSgx.c)
Expand Down Expand Up @@ -119,9 +123,9 @@ string(REPLACE ";" " " LIBUNWIND_C_FLAGS "${LIBUNWIND_C_FLAGS}")
string(REPLACE ";" " " LIBUNWIND_LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}")

set_property(SOURCE ${LIBUNWIND_CXX_SOURCES}
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_CXX_FLAGS} ${LIBUNWIND_CXX_FLAGS}")
APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_CXX_FLAGS}")
set_property(SOURCE ${LIBUNWIND_C_SOURCES}
APPEND_STRING PROPERTY COMPILE_FLAGS " ${CMAKE_C_FLAGS} ${LIBUNWIND_C_FLAGS}")
APPEND_STRING PROPERTY COMPILE_FLAGS " ${LIBUNWIND_C_FLAGS}")

# Add a object library that contains the compiled source files.
add_library(unwind_objects OBJECT ${LIBUNWIND_SOURCES} ${LIBUNWIND_HEADERS})
Expand Down
3 changes: 3 additions & 0 deletions libunwind/src/UnwindLevel1.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
// to export these functions from libunwind.so as well.
#define _LIBUNWIND_UNWIND_LEVEL1_EXTERNAL_LINKAGE 1

#ifndef __clang__
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif

#pragma GCC diagnostic ignored "-Wempty-body"

#include <inttypes.h>
Expand Down
1 change: 1 addition & 0 deletions libunwind/src/UnwindRustSgx.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <stddef.h>
#include "UnwindRustSgx.h"

#pragma GCC diagnostic ignored "-Wunused-parameter"

#define max_log 256

Expand Down
7 changes: 6 additions & 1 deletion libunwind/src/UnwindRustSgxSnprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
* on all source code distributions
*/

#pragma GCC diagnostic ignored "-Wconversion"
#ifndef __clang__
#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
#else
#pragma GCC diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers"
#endif

#pragma GCC diagnostic ignored "-Wconversion"
#pragma GCC diagnostic ignored "-Wfloat-conversion"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wstrict-overflow"
Expand Down
4 changes: 4 additions & 0 deletions libunwind/src/libunwind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
//
//===----------------------------------------------------------------------===//

#ifndef __clang__
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif

#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wmissing-braces"
#pragma GCC diagnostic ignored "-Wsign-conversion"
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
Expand Down

0 comments on commit 185a40d

Please sign in to comment.