zydis: build static lib
* for GCC2 build with a modern GCC as suggested by waddlesplash * make the headers compatible with GCC2 Change-Id: Ice74eeddbe10bc8f9cf9ae90baa833a46bb3c676 Reviewed-on: https://review.haiku-os.org/c/haiku/+/7848 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
cb130a72e8
commit
06b1eff6ec
@@ -61,10 +61,12 @@ ZYAN_INLINE ZyanU64 ZyanAbsI64(ZyanI64 x)
|
|||||||
// INT_MIN special case. Can't use the value directly because GCC thinks
|
// INT_MIN special case. Can't use the value directly because GCC thinks
|
||||||
// it's too big for an INT64 literal, however is perfectly happy to accept
|
// it's too big for an INT64 literal, however is perfectly happy to accept
|
||||||
// this expression. This is also hit INT64_MIN is defined in `stdint.h`.
|
// this expression. This is also hit INT64_MIN is defined in `stdint.h`.
|
||||||
|
#if defined(__GNUC__) && (__GNUC__ >= 4)
|
||||||
if (x == (-0x7fffffffffffffff - 1))
|
if (x == (-0x7fffffffffffffff - 1))
|
||||||
{
|
{
|
||||||
return 0x8000000000000000u;
|
return 0x8000000000000000u;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return (ZyanU64)(x < 0 ? -x : x);
|
return (ZyanU64)(x < 0 ? -x : x);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,9 @@ typedef ZyanU8 ZydisTokenType;
|
|||||||
/* Token */
|
/* Token */
|
||||||
/* ---------------------------------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#if !defined(__HAIKU__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the `ZydisFormatterToken` struct.
|
* Defines the `ZydisFormatterToken` struct.
|
||||||
@@ -147,7 +149,9 @@ typedef struct ZydisFormatterToken_
|
|||||||
ZyanU8 next;
|
ZyanU8 next;
|
||||||
} ZydisFormatterToken;
|
} ZydisFormatterToken;
|
||||||
|
|
||||||
|
#if !defined(__HAIKU__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the `ZydisFormatterTokenConst` data-type.
|
* Defines the `ZydisFormatterTokenConst` data-type.
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ extern "C" {
|
|||||||
/* Enums and types */
|
/* Enums and types */
|
||||||
/* ============================================================================================== */
|
/* ============================================================================================== */
|
||||||
|
|
||||||
#if !defined(ZYAN_APPLE)
|
#if !defined(ZYAN_APPLE) && (!defined(__HAIKU__) || (defined(__GNUC__) && (__GNUC__ >= 4)))
|
||||||
# pragma pack(push, 1)
|
# pragma pack(push, 1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ typedef struct ZydisShortString_
|
|||||||
ZyanU8 size;
|
ZyanU8 size;
|
||||||
} ZydisShortString;
|
} ZydisShortString;
|
||||||
|
|
||||||
#if !defined(ZYAN_APPLE)
|
#if !defined(ZYAN_APPLE) && (!defined(__HAIKU__) || (defined(__GNUC__) && (__GNUC__ >= 4)))
|
||||||
# pragma pack(pop)
|
# pragma pack(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ SubInclude HAIKU_TOP src libs stdc++ ;
|
|||||||
SubInclude HAIKU_TOP src libs udis86 ;
|
SubInclude HAIKU_TOP src libs udis86 ;
|
||||||
SubInclude HAIKU_TOP src libs uuid ;
|
SubInclude HAIKU_TOP src libs uuid ;
|
||||||
SubInclude HAIKU_TOP src libs util ;
|
SubInclude HAIKU_TOP src libs util ;
|
||||||
|
SubInclude HAIKU_TOP src libs zydis ;
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
SubDir HAIKU_TOP src libs zydis ;
|
||||||
|
|
||||||
|
local zydisSourceDirectory = [ FDirName $(HAIKU_TOP) src libs zydis ] ;
|
||||||
|
UseHeaders [ LibraryHeaders zydis ] : true ;
|
||||||
|
UseHeaders [ FDirName $(zydisSourceDirectory) Zydis ] : true ;
|
||||||
|
|
||||||
|
SubDirCcFlags -Wno-error=missing-prototypes ;
|
||||||
|
|
||||||
|
DEFINES += __posix ;
|
||||||
|
DEFINES += ZYDIS_DISABLE_ENCODER ;
|
||||||
|
|
||||||
|
local zydisSources =
|
||||||
|
Decoder.c
|
||||||
|
DecoderData.c
|
||||||
|
Disassembler.c
|
||||||
|
Formatter.c
|
||||||
|
FormatterBuffer.c
|
||||||
|
FormatterATT.c
|
||||||
|
FormatterBase.c
|
||||||
|
FormatterIntel.c
|
||||||
|
MetaInfo.c
|
||||||
|
Mnemonic.c
|
||||||
|
Register.c
|
||||||
|
SharedData.c
|
||||||
|
String.c
|
||||||
|
Utils.c
|
||||||
|
Zydis.c
|
||||||
|
;
|
||||||
|
|
||||||
|
local zycoreSources =
|
||||||
|
Zycore.c
|
||||||
|
Allocator.c
|
||||||
|
Bitset.c
|
||||||
|
Format.c
|
||||||
|
List.c
|
||||||
|
String.c
|
||||||
|
Vector.c
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
|
||||||
|
# GCC 2 can't compile C11, so we use the modern GCC .
|
||||||
|
original_TARGET_CC_x86_gcc2 = $(TARGET_CC_x86_gcc2) ;
|
||||||
|
TARGET_CC_x86_gcc2 = $(TARGET_CC_x86) -Wa,-mrelax-relocations=no ;
|
||||||
|
}
|
||||||
|
|
||||||
|
SOURCE_GRIST = [ FGrist $(SUBDIR_TOKENS) zydis ] ;
|
||||||
|
MakeLocate [ FGristFiles $(zydisSources:S=$(SUFOBJ)) ]
|
||||||
|
: [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) zydis ] ;
|
||||||
|
StaticLibrary libzydis.a : $(zydisSources) ;
|
||||||
|
LOCATE on [ FGristFiles $(zydisSources) ] = [ FDirName $(zydisSourceDirectory) Zydis ] ;
|
||||||
|
|
||||||
|
SOURCE_GRIST = [ FGrist $(SUBDIR_TOKENS) zycore ] ;
|
||||||
|
MakeLocate [ FGristFiles $(zycoreSources:S=$(SUFOBJ)) ]
|
||||||
|
: [ FDirName $(TARGET_DEBUG_$(DEBUG)_LOCATE_TARGET) zycore ] ;
|
||||||
|
StaticLibrary libzydis.a : $(zycoreSources)
|
||||||
|
;
|
||||||
|
LOCATE on [ FGristFiles $(zycoreSources) ] = [ FDirName $(zydisSourceDirectory) Zycore ] ;
|
||||||
|
|
||||||
|
if $(TARGET_PACKAGING_ARCH) = x86_gcc2 {
|
||||||
|
TARGET_CC_x86_gcc2 = $(original_TARGET_CC_x86_gcc2) ;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user