mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 23:51:56 +00:00
e5a743c4f6
Summary: A set of of linux x86_64 internal syscall helpers have also been added. This change does not try to be perfect with respect to OS and machine abstractions. A TODO note has been added at places where such abstractions would help and make the arrangement scalable and cleaner. Addressing the TODOs and building such abstractions is not in the scope of this change. It is hoped that follow up changes cleaning up the problem areas and addressing the TODOs will better illustrate the need for the changes. This change also does not try to imitate mmap and munmap implementations of other libcs. The idea here is to put in the bare minimum required to obtain a working mmap and munmap, and then add the rest of the functionality on an as needed basis. Reviewers: abrachet, phosek, stanshebs, theraven Subscribers: mgorny, MaskRay, jfb, libc-commits Tags: #libc-project Differential Revision: https://reviews.llvm.org/D71634
189 lines
5.2 KiB
TableGen
189 lines
5.2 KiB
TableGen
def StdC : StandardSpec<"stdc"> {
|
|
ConstType ConstVoidPtr = ConstType<VoidPtr>;
|
|
RestrictedPtrType VoidRestrictedPtr = RestrictedPtrType<VoidType>;
|
|
ConstType ConstVoidRestrictedPtr = ConstType<VoidRestrictedPtr>;
|
|
|
|
PtrType CharPtr = PtrType<CharType>;
|
|
ConstType ConstCharPtr = ConstType<CharPtr>;
|
|
RestrictedPtrType CharRestrictedPtr = RestrictedPtrType<CharType>;
|
|
ConstType ConstCharRestrictedPtr = ConstType<CharRestrictedPtr>;
|
|
|
|
HeaderSpec String = HeaderSpec<
|
|
"string.h",
|
|
[
|
|
Macro<"NULL">,
|
|
],
|
|
[
|
|
SizeTType,
|
|
],
|
|
[
|
|
FunctionSpec<
|
|
"memcpy",
|
|
RetValSpec<VoidPtr>,
|
|
[ArgSpec<VoidRestrictedPtr>,
|
|
ArgSpec<ConstVoidRestrictedPtr>,
|
|
ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"memmove",
|
|
RetValSpec<VoidPtr>,
|
|
[ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"memcmp",
|
|
RetValSpec<IntType>,
|
|
[ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"memchr",
|
|
RetValSpec<VoidPtr>,
|
|
[ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"memset",
|
|
RetValSpec<VoidPtr>,
|
|
[ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strcpy",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strncpy",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<CharRestrictedPtr>,
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strcat",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strncat",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strcmp",
|
|
RetValSpec<IntType>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strcoll",
|
|
RetValSpec<IntType>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strncmp",
|
|
RetValSpec<IntType>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strxfrm",
|
|
RetValSpec<SizeTType>,
|
|
[ArgSpec<CharRestrictedPtr>,
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
ArgSpec<SizeTType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strchr",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strcspn",
|
|
RetValSpec<SizeTType>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strpbrk",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strrchr",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strspn",
|
|
RetValSpec<SizeTType>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strstr",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strtok",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
|
|
>,
|
|
FunctionSpec<
|
|
"strerror",
|
|
RetValSpec<CharPtr>,
|
|
[ArgSpec<IntType>]
|
|
>,
|
|
FunctionSpec<
|
|
"strlen",
|
|
RetValSpec<SizeTType>,
|
|
[ArgSpec<ConstCharPtr>]
|
|
>,
|
|
]
|
|
>;
|
|
|
|
HeaderSpec Math = HeaderSpec<
|
|
"math.h",
|
|
[], // Macros
|
|
[
|
|
NamedType<"float_t">,
|
|
NamedType<"double_t">,
|
|
],
|
|
[
|
|
FunctionSpec<"acos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
|
|
FunctionSpec<"acosl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
|
|
]
|
|
>;
|
|
|
|
HeaderSpec StdIO = HeaderSpec<
|
|
"stdio.h",
|
|
[], // Macros
|
|
[ // Types
|
|
SizeTType,
|
|
],
|
|
[
|
|
FunctionSpec<
|
|
"snprintf",
|
|
RetValSpec<IntType>,
|
|
[ArgSpec<CharPtr>,
|
|
ArgSpec<SizeTType>,
|
|
ArgSpec<ConstCharRestrictedPtr>,
|
|
ArgSpec<VarArgType>]
|
|
>,
|
|
]
|
|
>;
|
|
|
|
HeaderSpec Errno = HeaderSpec<
|
|
"errno.h",
|
|
[
|
|
Macro<"errno">,
|
|
Macro<"EDOM">,
|
|
Macro<"EILSEQ">,
|
|
Macro<"ERANGE">,
|
|
],
|
|
[], // Types
|
|
[] // Functions
|
|
>;
|
|
|
|
let Headers = [
|
|
Errno,
|
|
Math,
|
|
String,
|
|
StdIO,
|
|
];
|
|
}
|