mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 13:58:40 +00:00
apply linux notes from martins; simplify build.sh; simplify some linux layer code; fix incorrect linux api usage; get gcc builds up and running
This commit is contained in:
@@ -1,63 +1,73 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -eu
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# --- Unpack Arguments --------------------------------------------------------
|
# --- Unpack Arguments --------------------------------------------------------
|
||||||
for arg in "$@"; do declare $arg='1'; done
|
for arg in "$@"; do declare $arg='1'; done
|
||||||
if [ ! "$gcc" = "1" ]; then clang=1; fi
|
if [ ! -v gcc ]; then clang=1; fi
|
||||||
if [ ! "$release" = "1" ]; then debug=1; fi
|
if [ ! -v release ]; then debug=1; fi
|
||||||
if [ "$debug" = "1" ]; then release=0 && echo "[debug mode]"; fi
|
if [ -v debug ]; then echo "[debug mode]"; fi
|
||||||
if [ "$release" = "1" ]; then debug=0 && echo "[release mode]"; fi
|
if [ -v release ]; then echo "[release mode]"; fi
|
||||||
if [ "$clang" = "1" ]; then gcc=0 && echo "[clang compile]"; fi
|
if [ -v clang ]; then compiler="${CC:-clang}"; echo "[clang compile]"; fi
|
||||||
if [ "$gcc" = "1" ]; then clang=0 && echo "[gcc compile]"; fi
|
if [ -v gcc ]; then compiler="${CC:-gcc}"; echo "[gcc compile]"; fi
|
||||||
|
|
||||||
# --- Unpack Command Line Build Arguments -------------------------------------
|
# --- Unpack Command Line Build Arguments -------------------------------------
|
||||||
auto_compile_flags=''
|
auto_compile_flags=''
|
||||||
|
|
||||||
# --- Compile/Link Line Definitions -------------------------------------------
|
# --- Compile/Link Line Definitions -------------------------------------------
|
||||||
clang_common='-I../src/ -I../local/ -gcodeview -fdiagnostics-absolute-paths -Wall -Wno-unknown-warning-option -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Wno-for-loop-analysis -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf'
|
clang_common='-I../src/ -I../local/ -g -Wno-unknown-warning-option -fdiagnostics-absolute-paths -Wall -Wno-missing-braces -Wno-unused-function -Wno-writable-strings -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-register -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-single-bit-bitfield-constant-conversion -Wno-compare-distinct-pointer-types -Wno-initializer-overrides -Wno-incompatible-pointer-types-discards-qualifiers -Wno-for-loop-analysis -Xclang -flto-visibility-public-std -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf'
|
||||||
clang_debug="clang -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}"
|
clang_debug="$compiler -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}"
|
||||||
clang_release="clang -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}"
|
clang_release="$compiler -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}"
|
||||||
clang_link="-lpthread"
|
clang_link="-lpthread -lm -lrt -ldl"
|
||||||
clang_out="-o"
|
clang_out="-o"
|
||||||
|
gcc_common='-I../src/ -I../local/ -g -Wno-unknown-warning-option -Wall -Wno-missing-braces -Wno-unused-function -Wno-attributes -Wno-unused-value -Wno-unused-variable -Wno-unused-local-typedef -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-compare-distinct-pointer-types -D_USE_MATH_DEFINES -Dstrdup=_strdup -Dgnu_printf=printf'
|
||||||
|
gcc_debug="$compiler -g -O0 -DBUILD_DEBUG=1 ${gcc_common} ${auto_compile_flags}"
|
||||||
|
gcc_release="$compiler -g -O2 -DBUILD_DEBUG=0 ${gcc_common} ${auto_compile_flags}"
|
||||||
|
gcc_link="-lpthread -lm -lrt -ldl"
|
||||||
|
gcc_out="-o"
|
||||||
|
|
||||||
# --- Per-Build Settings ------------------------------------------------------
|
# --- Per-Build Settings ------------------------------------------------------
|
||||||
link_dll="-fPIC"
|
link_dll="-fPIC"
|
||||||
link_os_gfx="-lX11 -lXext"
|
link_os_gfx="-lX11 -lXext"
|
||||||
|
|
||||||
# --- Choose Compile/Link Lines -----------------------------------------------
|
# --- Choose Compile/Link Lines -----------------------------------------------
|
||||||
if [ "$clang" = "1" ]; then compile_debug="$clang_debug"; fi
|
if [ -v gcc ]; then compile_debug="$gcc_debug"; fi
|
||||||
if [ "$clang" = "1" ]; then compile_release="$clang_release"; fi
|
if [ -v gcc ]; then compile_release="$gcc_release"; fi
|
||||||
if [ "$clang" = "1" ]; then compile_link="$clang_link"; fi
|
if [ -v gcc ]; then compile_link="$gcc_link"; fi
|
||||||
if [ "$clang" = "1" ]; then out="$clang_out"; fi
|
if [ -v gcc ]; then out="$gcc_out"; fi
|
||||||
if [ "$debug" = "1" ]; then compile="$compile_debug"; fi
|
if [ -v clang ]; then compile_debug="$clang_debug"; fi
|
||||||
if [ "$release" = "1" ]; then compile="$compile_release"; fi
|
if [ -v clang ]; then compile_release="$clang_release"; fi
|
||||||
|
if [ -v clang ]; then compile_link="$clang_link"; fi
|
||||||
|
if [ -v clang ]; then out="$clang_out"; fi
|
||||||
|
if [ -v debug ]; then compile="$compile_debug"; fi
|
||||||
|
if [ -v release ]; then compile="$compile_release"; fi
|
||||||
|
|
||||||
# --- Prep Directories --------------------------------------------------------
|
# --- Prep Directories --------------------------------------------------------
|
||||||
if [ ! -d build ]; then mkdir build; fi
|
mkdir -p build
|
||||||
if [ ! -d local ]; then mkdir local; fi
|
mkdir -p local
|
||||||
|
|
||||||
# --- Build & Run Metaprogram -------------------------------------------------
|
# --- Build & Run Metaprogram -------------------------------------------------
|
||||||
if [ "$no_meta" = "1" ]; then echo "[skipping metagen]"; fi
|
if [ -v no_meta ]; then echo "[skipping metagen]"; fi
|
||||||
if [ "$no_meta" = "" ]
|
if [ ! -v no_meta ]
|
||||||
then
|
then
|
||||||
cd build
|
cd build
|
||||||
$compile_debug ../src/metagen/metagen_main.c $compile_link $out metagen || exit 1
|
$compile_debug ../src/metagen/metagen_main.c $compile_link $out metagen
|
||||||
./metagen || exit 1
|
./metagen
|
||||||
cd ..
|
cd ..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- Build Everything (@build_targets) ---------------------------------------
|
# --- Build Everything (@build_targets) ---------------------------------------
|
||||||
cd build
|
cd build
|
||||||
if [ "$raddbg" = "1" ]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $compile_link $link_os_gfx $out raddbg || exit 1; fi
|
if [ -v raddbg ]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $compile_link $link_os_gfx $out raddbg; fi
|
||||||
if [ "$rdi_from_pdb" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_pdb/rdi_from_pdb_main.c $compile_link $out rdi_from_pdb || exit 1; fi
|
if [ -v rdi_from_pdb ]; then didbuild=1 && $compile ../src/rdi_from_pdb/rdi_from_pdb_main.c $compile_link $out rdi_from_pdb; fi
|
||||||
if [ "$rdi_from_dwarf" = "1" ]; then didbuild=1 && $compile ../src/rdi_from_dwarf/rdi_from_dwarf.c $compile_link $out rdi_from_dwarf || exit 1; fi
|
if [ -v rdi_from_dwarf ]; then didbuild=1 && $compile ../src/rdi_from_dwarf/rdi_from_dwarf.c $compile_link $out rdi_from_dwarf; fi
|
||||||
if [ "$rdi_dump" = "1" ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump || exit 1; fi
|
if [ -v rdi_dump ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump; fi
|
||||||
if [ "$rdi_breakpad_from_pdb" = "1" ]; then didbuild=1 && $compile ../src/rdi_breakpad_from_pdb/rdi_breakpad_from_pdb_main.c $compile_link $out rdi_breakpad_from_pdb || exit 1; fi
|
if [ -v rdi_breakpad_from_pdb ]; then didbuild=1 && $compile ../src/rdi_breakpad_from_pdb/rdi_breakpad_from_pdb_main.c $compile_link $out rdi_breakpad_from_pdb; fi
|
||||||
if [ "$ryan_scratch" = "1" ]; then didbuild=1 && $compile ../src/scratch/ryan_scratch.c $compile_link $link_os_gfx $out ryan_scratch || exit 1; fi
|
if [ -v ryan_scratch ]; then didbuild=1 && $compile ../src/scratch/ryan_scratch.c $compile_link $link_os_gfx $out ryan_scratch; fi
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# --- Warn On No Builds -------------------------------------------------------
|
# --- Warn On No Builds -------------------------------------------------------
|
||||||
if [ "$didbuild" = "" ]
|
if [ ! -v didbuild ]
|
||||||
then
|
then
|
||||||
echo "[WARNING] no valid build target specified; must use build target names as arguments to this script, like \`./build.sh raddbg\` or \`./build.sh rdi_from_pdb\`."
|
echo "[WARNING] no valid build target specified; must use build target names as arguments to this script, like \`./build.sh raddbg\` or \`./build.sh rdi_from_pdb\`."
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ CheckNil(nil,p) ? \
|
|||||||
# endif
|
# endif
|
||||||
# define NO_ASAN __attribute__((no_sanitize("address")))
|
# define NO_ASAN __attribute__((no_sanitize("address")))
|
||||||
#else
|
#else
|
||||||
# error "NO_ASAN is not defined for this compiler."
|
# define NO_ASAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ASAN_ENABLED
|
#if ASAN_ENABLED
|
||||||
|
|||||||
@@ -1281,7 +1281,7 @@ utf16_decode(U16 *str, U64 max){
|
|||||||
result.codepoint = str[0];
|
result.codepoint = str[0];
|
||||||
result.inc = 1;
|
result.inc = 1;
|
||||||
if (max > 1 && 0xD800 <= str[0] && str[0] < 0xDC00 && 0xDC00 <= str[1] && str[1] < 0xE000){
|
if (max > 1 && 0xD800 <= str[0] && str[0] < 0xDC00 && 0xDC00 <= str[1] && str[1] < 0xE000){
|
||||||
result.codepoint = ((str[0] - 0xD800) << 10) | (str[1] - 0xDC00) + 0x10000;
|
result.codepoint = ((str[0] - 0xD800) << 10) | ((str[1] - 0xDC00) + 0x10000);
|
||||||
result.inc = 2;
|
result.inc = 2;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ CheckNil(nil,p) ? \
|
|||||||
# endif
|
# endif
|
||||||
# define NO_ASAN __attribute__((no_sanitize("address")))
|
# define NO_ASAN __attribute__((no_sanitize("address")))
|
||||||
#else
|
#else
|
||||||
# error "NO_ASAN is not defined for this compiler."
|
# define NO_ASAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ASAN_ENABLED
|
#if ASAN_ENABLED
|
||||||
|
|||||||
@@ -1281,7 +1281,7 @@ utf16_decode(U16 *str, U64 max){
|
|||||||
result.codepoint = str[0];
|
result.codepoint = str[0];
|
||||||
result.inc = 1;
|
result.inc = 1;
|
||||||
if (max > 1 && 0xD800 <= str[0] && str[0] < 0xDC00 && 0xDC00 <= str[1] && str[1] < 0xE000){
|
if (max > 1 && 0xD800 <= str[0] && str[0] < 0xDC00 && 0xDC00 <= str[1] && str[1] < 0xE000){
|
||||||
result.codepoint = ((str[0] - 0xD800) << 10) | (str[1] - 0xDC00) + 0x10000;
|
result.codepoint = ((str[0] - 0xD800) << 10) | ((str[1] - 0xDC00) + 0x10000);
|
||||||
result.inc = 2;
|
result.inc = 2;
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# define FORCE_INLINE __forceinline
|
# define FORCE_INLINE __forceinline
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__) || defined(__GNUC__)
|
||||||
# define FORCE_INLINE __attribute__((always_inline))
|
# define FORCE_INLINE __attribute__((always_inline))
|
||||||
#else
|
#else
|
||||||
# error need force inline for this compiler
|
# error need force inline for this compiler
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ os_get_current_path(Arena *arena)
|
|||||||
{
|
{
|
||||||
char *cwdir = getcwd(0, 0);
|
char *cwdir = getcwd(0, 0);
|
||||||
String8 string = push_str8_copy(arena, str8_cstring(cwdir));
|
String8 string = push_str8_copy(arena, str8_cstring(cwdir));
|
||||||
|
free(cwdir);
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,12 +216,7 @@ os_commit_large(void *ptr, U64 size)
|
|||||||
internal U32
|
internal U32
|
||||||
os_tid(void)
|
os_tid(void)
|
||||||
{
|
{
|
||||||
U32 result = 0;
|
U32 result = gettid();
|
||||||
#if defined(SYS_gettid)
|
|
||||||
result = syscall(SYS_gettid);
|
|
||||||
#else
|
|
||||||
result = gettid();
|
|
||||||
#endif
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +266,11 @@ os_file_open(OS_AccessFlags flags, String8 path)
|
|||||||
{
|
{
|
||||||
lnx_flags |= O_APPEND;
|
lnx_flags |= O_APPEND;
|
||||||
}
|
}
|
||||||
int fd = open((char *)path_copy.str, lnx_flags);
|
if(flags & (OS_AccessFlag_Write|OS_AccessFlag_Append))
|
||||||
|
{
|
||||||
|
lnx_flags |= O_CREAT;
|
||||||
|
}
|
||||||
|
int fd = open((char *)path_copy.str, lnx_flags, 0755);
|
||||||
OS_Handle handle = {0};
|
OS_Handle handle = {0};
|
||||||
if(fd != -1)
|
if(fd != -1)
|
||||||
{
|
{
|
||||||
@@ -293,16 +293,12 @@ os_file_read(OS_Handle file, Rng1U64 rng, void *out_data)
|
|||||||
{
|
{
|
||||||
if(os_handle_match(file, os_handle_zero())) { return 0; }
|
if(os_handle_match(file, os_handle_zero())) { return 0; }
|
||||||
int fd = (int)file.u64[0];
|
int fd = (int)file.u64[0];
|
||||||
if(rng.min != 0)
|
|
||||||
{
|
|
||||||
lseek(fd, rng.min, SEEK_SET);
|
|
||||||
}
|
|
||||||
U64 total_num_bytes_to_read = dim_1u64(rng);
|
U64 total_num_bytes_to_read = dim_1u64(rng);
|
||||||
U64 total_num_bytes_read = 0;
|
U64 total_num_bytes_read = 0;
|
||||||
U64 total_num_bytes_left_to_read = total_num_bytes_to_read;
|
U64 total_num_bytes_left_to_read = total_num_bytes_to_read;
|
||||||
for(;total_num_bytes_left_to_read > 0;)
|
for(;total_num_bytes_left_to_read > 0;)
|
||||||
{
|
{
|
||||||
int read_result = read(fd, (U8 *)out_data + total_num_bytes_read, total_num_bytes_left_to_read);
|
int read_result = pread(fd, (U8 *)out_data + total_num_bytes_read, total_num_bytes_left_to_read, rng.min + total_num_bytes_read);
|
||||||
if(read_result >= 0)
|
if(read_result >= 0)
|
||||||
{
|
{
|
||||||
total_num_bytes_read += read_result;
|
total_num_bytes_read += read_result;
|
||||||
@@ -321,16 +317,12 @@ os_file_write(OS_Handle file, Rng1U64 rng, void *data)
|
|||||||
{
|
{
|
||||||
if(os_handle_match(file, os_handle_zero())) { return 0; }
|
if(os_handle_match(file, os_handle_zero())) { return 0; }
|
||||||
int fd = (int)file.u64[0];
|
int fd = (int)file.u64[0];
|
||||||
if(rng.min != 0)
|
|
||||||
{
|
|
||||||
lseek(fd, rng.min, SEEK_SET);
|
|
||||||
}
|
|
||||||
U64 total_num_bytes_to_write = dim_1u64(rng);
|
U64 total_num_bytes_to_write = dim_1u64(rng);
|
||||||
U64 total_num_bytes_written = 0;
|
U64 total_num_bytes_written = 0;
|
||||||
U64 total_num_bytes_left_to_write = total_num_bytes_to_write;
|
U64 total_num_bytes_left_to_write = total_num_bytes_to_write;
|
||||||
for(;total_num_bytes_left_to_write > 0;)
|
for(;total_num_bytes_left_to_write > 0;)
|
||||||
{
|
{
|
||||||
int write_result = write(fd, (U8 *)data + total_num_bytes_written, total_num_bytes_left_to_write);
|
int write_result = pwrite(fd, (U8 *)data + total_num_bytes_written, total_num_bytes_left_to_write, rng.min + total_num_bytes_written);
|
||||||
if(write_result >= 0)
|
if(write_result >= 0)
|
||||||
{
|
{
|
||||||
total_num_bytes_written += write_result;
|
total_num_bytes_written += write_result;
|
||||||
@@ -410,25 +402,23 @@ os_copy_file_path(String8 dst, String8 src)
|
|||||||
if(!os_handle_match(src_h, os_handle_zero()) &&
|
if(!os_handle_match(src_h, os_handle_zero()) &&
|
||||||
!os_handle_match(dst_h, os_handle_zero()))
|
!os_handle_match(dst_h, os_handle_zero()))
|
||||||
{
|
{
|
||||||
|
int src_fd = (int)src_h.u64[0];
|
||||||
|
int dst_fd = (int)dst_h.u64[0];
|
||||||
FileProperties src_props = os_properties_from_file(src_h);
|
FileProperties src_props = os_properties_from_file(src_h);
|
||||||
U64 size = src_props.size;
|
U64 size = src_props.size;
|
||||||
U64 total_bytes_copied = 0;
|
U64 total_bytes_copied = 0;
|
||||||
U64 bytes_left_to_copy = size;
|
U64 bytes_left_to_copy = size;
|
||||||
for(;bytes_left_to_copy > 0;)
|
for(;bytes_left_to_copy > 0;)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
off_t sendfile_off = total_bytes_copied;
|
||||||
U64 buffer_size = Min(bytes_left_to_copy, MB(8));
|
int send_result = sendfile(dst_fd, src_fd, &sendfile_off, bytes_left_to_copy);
|
||||||
U8 *buffer = push_array_no_zero(scratch.arena, U8, buffer_size);
|
if(send_result <= 0)
|
||||||
U64 bytes_read = os_file_read(src_h, r1u64(total_bytes_copied, total_bytes_copied+buffer_size), buffer);
|
|
||||||
U64 bytes_written = os_file_write(dst_h, r1u64(total_bytes_copied, total_bytes_copied+bytes_read), buffer);
|
|
||||||
U64 bytes_copied = Min(bytes_read, bytes_written);
|
|
||||||
bytes_left_to_copy -= bytes_copied;
|
|
||||||
total_bytes_copied += bytes_copied;
|
|
||||||
scratch_end(scratch);
|
|
||||||
if(bytes_copied == 0)
|
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
U64 bytes_copied = (U64)send_result;
|
||||||
|
bytes_left_to_copy -= bytes_copied;
|
||||||
|
total_bytes_copied += bytes_copied;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
os_file_close(src_h);
|
os_file_close(src_h);
|
||||||
@@ -601,7 +591,7 @@ os_make_directory(String8 path)
|
|||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
B32 result = 0;
|
B32 result = 0;
|
||||||
String8 path_copy = push_str8_copy(scratch.arena, path);
|
String8 path_copy = push_str8_copy(scratch.arena, path);
|
||||||
if(mkdir((char*)path_copy.str, 0777) != -1)
|
if(mkdir((char*)path_copy.str, 0755) != -1)
|
||||||
{
|
{
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
@@ -760,10 +750,7 @@ os_thread_launch(OS_ThreadFunctionType *func, void *ptr, void *params)
|
|||||||
entity->thread.func = func;
|
entity->thread.func = func;
|
||||||
entity->thread.ptr = ptr;
|
entity->thread.ptr = ptr;
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
int pthread_result = pthread_create(&entity->thread.handle, 0, os_lnx_thread_entry_point, entity);
|
||||||
pthread_attr_init(&attr);
|
|
||||||
int pthread_result = pthread_create(&entity->thread.handle, &attr, os_lnx_thread_entry_point, entity);
|
|
||||||
pthread_attr_destroy(&attr);
|
|
||||||
if(pthread_result == -1)
|
if(pthread_result == -1)
|
||||||
{
|
{
|
||||||
os_lnx_entity_release(entity);
|
os_lnx_entity_release(entity);
|
||||||
@@ -1082,7 +1069,7 @@ os_library_open(String8 path)
|
|||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
char *path_cstr = (char *)push_str8_copy(scratch.arena, path).str;
|
char *path_cstr = (char *)push_str8_copy(scratch.arena, path).str;
|
||||||
void *so = dlopen(path_cstr, RTLD_LAZY);
|
void *so = dlopen(path_cstr, RTLD_LAZY|RTLD_LOCAL);
|
||||||
OS_Handle lib = { (U64)so };
|
OS_Handle lib = { (U64)so };
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
return lib;
|
return lib;
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
|
#include <sys/sendfile.h>
|
||||||
|
|
||||||
|
pid_t gettid(void);
|
||||||
int pthread_setname_np(pthread_t thread, const char *name);
|
int pthread_setname_np(pthread_t thread, const char *name);
|
||||||
int pthread_getname_np(pthread_t thread, char *name, size_t size);
|
int pthread_getname_np(pthread_t thread, char *name, size_t size);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -713,7 +713,7 @@ static SINTa rr_lzb_simple_encode_fast_sub(rr_lzb_simple_context * fh,
|
|||||||
|
|
||||||
const U8 * rpEndSafe = rpMatchEnd - LZB_MML;
|
const U8 * rpEndSafe = rpMatchEnd - LZB_MML;
|
||||||
|
|
||||||
if ( rpEndSafe <= raw )
|
if ( rpEndSafe <= (U8 *)raw )
|
||||||
{
|
{
|
||||||
// can't compress
|
// can't compress
|
||||||
return rawLen+1;
|
return rawLen+1;
|
||||||
@@ -1185,7 +1185,7 @@ static SINTa rr_lzb_simple_encode_veryfast_sub(rr_lzb_simple_context * fh,
|
|||||||
|
|
||||||
const U8 * rpEndSafe = rpMatchEnd - LZB_MML;
|
const U8 * rpEndSafe = rpMatchEnd - LZB_MML;
|
||||||
|
|
||||||
if ( rpEndSafe <= raw )
|
if ( rpEndSafe <= (U8 *)raw )
|
||||||
{
|
{
|
||||||
// can't compress
|
// can't compress
|
||||||
return rawLen+1;
|
return rawLen+1;
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ typedef S32 RAD_S32;
|
|||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# define RADFORCEINLINE __forceinline
|
# define RADFORCEINLINE __forceinline
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__) || defined(__GNUC__)
|
||||||
# define RADFORCEINLINE __attribute__((always_inline))
|
# define RADFORCEINLINE __attribute__((always_inline))
|
||||||
#else
|
#else
|
||||||
# error need force inline for this compiler
|
# error need force inline for this compiler
|
||||||
|
|||||||
Reference in New Issue
Block a user