Merge pull request #786 from despair86/master

fixes for arcane unix platforms
pull/791/head
Jeff 5 years ago committed by GitHub
commit c99c5d7b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,6 +13,7 @@ project(${PROJECT_NAME} C CXX)
option(USE_AVX2 "enable avx2 code" )
option(USE_NETNS "enable networking namespace support. Linux only" )
option(AMD_RYZEN_HACK "hack for AMD Ryzen FPU bug (support FMA3 and FMA4 in FPU, but does not show in CPUID)" )
option(NATIVE_BUILD "optimise for host system and FPU, may not be portable" )
if (NOT MSVC)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads")
endif()
@ -106,13 +107,10 @@ if(WITH_SHELLHOOKS)
add_definitions(-DENABLE_SHELLHOOKS)
endif(WITH_SHELLHOOKS)
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
# Always build PIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(ABSEIL_DIR vendor/abseil-cpp)
add_subdirectory(vendor/gtest)
add_subdirectory(${ABSEIL_DIR})
include_directories(SYSTEM ${ABSEIL_DIR})
@ -160,6 +158,13 @@ if(AMD_RYZEN_HACK AND USE_AVX2)
message(WARNING "This option may be removed in a future release. Contact your computer manufacturer for updated ROMs or microcode patches.")
endif(AMD_RYZEN_HACK AND USE_AVX2)
if(NATIVE_BUILD)
message(WARNING "May fail at runtime if the floating-point unit on the target system does not implement required features, some platforms will check this for you")
set(CRYPTO_FLAGS -march=native -mfpmath=sse -mtune=native)
endif()
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)

@ -85,14 +85,12 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-freebsd.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(FS_LIB NAMES c++fs c++experimental stdc++fs)
if(FS_LIB STREQUAL FS_LIB-NOTFOUND)
add_subdirectory(vendor)
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/cppbackport-master/lib")
add_definitions(-DLOKINET_USE_CPPBACKPORT)
set(FS_LIB cppbackport)
endif()
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-darwin.c ${TT_ROOT}/tuntap-unix-bsd.c)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
set(LIBTUNTAP_IMPL ${TT_ROOT}/tuntap-unix-sunos.c)
@ -103,6 +101,8 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
include_directories("${CMAKE_CURRENT_LIST_DIR}/../vendor/cppbackport-master/lib")
add_definitions(-DLOKINET_USE_CPPBACKPORT)
set(FS_LIB cppbackport)
else()
set(FS_LIB stdc++fs)
endif()
else()
message(FATAL_ERROR "Your operating system is not supported yet")

@ -1,2 +1,3 @@
#pragma once
#include <stdint.h>
typedef int32_t crypto_int32;
typedef int32_t crypto_int32;

@ -1,2 +1,3 @@
#pragma once
#include <stdint.h>
typedef uint32_t crypto_uint32;
typedef uint32_t crypto_uint32;

@ -1,5 +1,4 @@
#include "params.h"
#include <sodium/crypto_uint32.h>
#include "rq.h"
void

@ -26,6 +26,10 @@ typedef unsigned int in_addr_t;
#include <sys/socket.h>
#endif
#ifndef __cplusplus
#include <stdbool.h>
#endif
#include <sys/types.h>
bool

@ -62,7 +62,7 @@ struct LinkLayerTest : public test::LlarpTest< NoOpCrypto >
localLoopBack()
{
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|| (__APPLE__ && __MACH__)
|| (__APPLE__ && __MACH__) || (__sun)
return "lo0";
#else
return "lo";

@ -4739,7 +4739,7 @@ void UnitTest::AddTestPartResult(
((defined(__clang__) || defined(__GNUC__)) && \
(defined(__x86_64__) || defined(__i386__)))
// with clang/gcc we can achieve the same effect on x86 by invoking int3
asm("int3");
asm("int $0x3");
#else
// Dereference nullptr through a volatile pointer to prevent the compiler
// from removing. We use this rather than abort() or __builtin_trap() for

Loading…
Cancel
Save