mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-12 23:31:38 -07: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
|
||||
set -eu
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# --- Unpack Arguments --------------------------------------------------------
|
||||
for arg in "$@"; do declare $arg='1'; done
|
||||
if [ ! "$gcc" = "1" ]; then clang=1; fi
|
||||
if [ ! "$release" = "1" ]; then debug=1; fi
|
||||
if [ "$debug" = "1" ]; then release=0 && echo "[debug mode]"; fi
|
||||
if [ "$release" = "1" ]; then debug=0 && echo "[release mode]"; fi
|
||||
if [ "$clang" = "1" ]; then gcc=0 && echo "[clang compile]"; fi
|
||||
if [ "$gcc" = "1" ]; then clang=0 && echo "[gcc compile]"; fi
|
||||
if [ ! -v gcc ]; then clang=1; fi
|
||||
if [ ! -v release ]; then debug=1; fi
|
||||
if [ -v debug ]; then echo "[debug mode]"; fi
|
||||
if [ -v release ]; then echo "[release mode]"; fi
|
||||
if [ -v clang ]; then compiler="${CC:-clang}"; echo "[clang compile]"; fi
|
||||
if [ -v gcc ]; then compiler="${CC:-gcc}"; echo "[gcc compile]"; fi
|
||||
|
||||
# --- Unpack Command Line Build Arguments -------------------------------------
|
||||
auto_compile_flags=''
|
||||
|
||||
# --- 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_debug="clang -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}"
|
||||
clang_release="clang -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}"
|
||||
clang_link="-lpthread"
|
||||
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="$compiler -g -O0 -DBUILD_DEBUG=1 ${clang_common} ${auto_compile_flags}"
|
||||
clang_release="$compiler -g -O2 -DBUILD_DEBUG=0 ${clang_common} ${auto_compile_flags}"
|
||||
clang_link="-lpthread -lm -lrt -ldl"
|
||||
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 ------------------------------------------------------
|
||||
link_dll="-fPIC"
|
||||
link_os_gfx="-lX11 -lXext"
|
||||
|
||||
# --- Choose Compile/Link Lines -----------------------------------------------
|
||||
if [ "$clang" = "1" ]; then compile_debug="$clang_debug"; fi
|
||||
if [ "$clang" = "1" ]; then compile_release="$clang_release"; fi
|
||||
if [ "$clang" = "1" ]; then compile_link="$clang_link"; fi
|
||||
if [ "$clang" = "1" ]; then out="$clang_out"; fi
|
||||
if [ "$debug" = "1" ]; then compile="$compile_debug"; fi
|
||||
if [ "$release" = "1" ]; then compile="$compile_release"; fi
|
||||
if [ -v gcc ]; then compile_debug="$gcc_debug"; fi
|
||||
if [ -v gcc ]; then compile_release="$gcc_release"; fi
|
||||
if [ -v gcc ]; then compile_link="$gcc_link"; fi
|
||||
if [ -v gcc ]; then out="$gcc_out"; fi
|
||||
if [ -v clang ]; then compile_debug="$clang_debug"; 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 --------------------------------------------------------
|
||||
if [ ! -d build ]; then mkdir build; fi
|
||||
if [ ! -d local ]; then mkdir local; fi
|
||||
mkdir -p build
|
||||
mkdir -p local
|
||||
|
||||
# --- Build & Run Metaprogram -------------------------------------------------
|
||||
if [ "$no_meta" = "1" ]; then echo "[skipping metagen]"; fi
|
||||
if [ "$no_meta" = "" ]
|
||||
if [ -v no_meta ]; then echo "[skipping metagen]"; fi
|
||||
if [ ! -v no_meta ]
|
||||
then
|
||||
cd build
|
||||
$compile_debug ../src/metagen/metagen_main.c $compile_link $out metagen || exit 1
|
||||
./metagen || exit 1
|
||||
$compile_debug ../src/metagen/metagen_main.c $compile_link $out metagen
|
||||
./metagen
|
||||
cd ..
|
||||
fi
|
||||
|
||||
# --- Build Everything (@build_targets) ---------------------------------------
|
||||
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 [ "$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 [ "$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 [ "$rdi_dump" = "1" ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump || exit 1; 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 [ "$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 raddbg ]; then didbuild=1 && $compile ../src/raddbg/raddbg_main.c $compile_link $link_os_gfx $out raddbg; 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 [ -v rdi_from_dwarf ]; then didbuild=1 && $compile ../src/rdi_from_dwarf/rdi_from_dwarf.c $compile_link $out rdi_from_dwarf; fi
|
||||
if [ -v rdi_dump ]; then didbuild=1 && $compile ../src/rdi_dump/rdi_dump_main.c $compile_link $out rdi_dump; 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 [ -v ryan_scratch ]; then didbuild=1 && $compile ../src/scratch/ryan_scratch.c $compile_link $link_os_gfx $out ryan_scratch; fi
|
||||
cd ..
|
||||
|
||||
# --- Warn On No Builds -------------------------------------------------------
|
||||
if [ "$didbuild" = "" ]
|
||||
if [ ! -v didbuild ]
|
||||
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\`."
|
||||
exit 1
|
||||
|
||||
@@ -287,7 +287,7 @@ CheckNil(nil,p) ? \
|
||||
# endif
|
||||
# define NO_ASAN __attribute__((no_sanitize("address")))
|
||||
#else
|
||||
# error "NO_ASAN is not defined for this compiler."
|
||||
# define NO_ASAN
|
||||
#endif
|
||||
|
||||
#if ASAN_ENABLED
|
||||
|
||||
@@ -1281,7 +1281,7 @@ utf16_decode(U16 *str, U64 max){
|
||||
result.codepoint = str[0];
|
||||
result.inc = 1;
|
||||
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;
|
||||
}
|
||||
return(result);
|
||||
|
||||
@@ -278,7 +278,7 @@ CheckNil(nil,p) ? \
|
||||
# endif
|
||||
# define NO_ASAN __attribute__((no_sanitize("address")))
|
||||
#else
|
||||
# error "NO_ASAN is not defined for this compiler."
|
||||
# define NO_ASAN
|
||||
#endif
|
||||
|
||||
#if ASAN_ENABLED
|
||||
|
||||
@@ -1281,7 +1281,7 @@ utf16_decode(U16 *str, U64 max){
|
||||
result.codepoint = str[0];
|
||||
result.inc = 1;
|
||||
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;
|
||||
}
|
||||
return(result);
|
||||
|
||||
+64
-64
@@ -1,64 +1,64 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
/*
|
||||
** Make sure we have an inlined function
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define FORCE_INLINE __forceinline
|
||||
#elif defined(__clang__)
|
||||
# define FORCE_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
# error need force inline for this compiler
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Inline Stepping
|
||||
|
||||
unsigned int fixed_frac_bits = 5;
|
||||
static unsigned int bias = 7;
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
fixed_mul(unsigned int a, unsigned int b){
|
||||
unsigned int c = (((a - bias)*(b - bias)) >> fixed_frac_bits) + bias;
|
||||
return(c);
|
||||
}
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
multi_file_inlinesite(unsigned int x){
|
||||
// force compiler to generate annotations for code that's inside another file
|
||||
#include "inline_body.cpp"
|
||||
return x >> fixed_frac_bits;
|
||||
}
|
||||
|
||||
static unsigned int test_value = 0;
|
||||
|
||||
unsigned int
|
||||
inline_stepping_tests(void){
|
||||
bias = 15;
|
||||
|
||||
// NOTE(nick): Interesting that CL does not generate inline site symbols in order of apperance here unlike clang.
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeLengthAndCodeOffset d 0
|
||||
// BinaryAnnotation Length: 4 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: LineOffset 1 CodeLength d
|
||||
// BinaryAnnotation Length: 4 bytes (0 bytes padding)
|
||||
unsigned int x = fixed_mul(5001, 7121);
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeOffsetAndLineOffset d File 0 CodeOffsetAndLineOffset 22 LineOffset 1e
|
||||
// CodeLengthAndCodeOffset 2 3
|
||||
// BinaryAnnotation Length: 12 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: File 18 LineOffset ffffffe6 CodeOffset d CodeOffsetAndLineOffset 22
|
||||
// File 0 LineOffset 1e CodeOffset 3 CodeLength 2
|
||||
// BinaryAnnotation Length: 16 bytes (0 bytes padding)
|
||||
unsigned int z = multi_file_inlinesite(x);
|
||||
return(z);
|
||||
}
|
||||
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
/*
|
||||
** Make sure we have an inlined function
|
||||
*/
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define FORCE_INLINE __forceinline
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
# define FORCE_INLINE __attribute__((always_inline))
|
||||
#else
|
||||
# error need force inline for this compiler
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
// NOTE(allen): Inline Stepping
|
||||
|
||||
unsigned int fixed_frac_bits = 5;
|
||||
static unsigned int bias = 7;
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
fixed_mul(unsigned int a, unsigned int b){
|
||||
unsigned int c = (((a - bias)*(b - bias)) >> fixed_frac_bits) + bias;
|
||||
return(c);
|
||||
}
|
||||
|
||||
static FORCE_INLINE unsigned int
|
||||
multi_file_inlinesite(unsigned int x){
|
||||
// force compiler to generate annotations for code that's inside another file
|
||||
#include "inline_body.cpp"
|
||||
return x >> fixed_frac_bits;
|
||||
}
|
||||
|
||||
static unsigned int test_value = 0;
|
||||
|
||||
unsigned int
|
||||
inline_stepping_tests(void){
|
||||
bias = 15;
|
||||
|
||||
// NOTE(nick): Interesting that CL does not generate inline site symbols in order of apperance here unlike clang.
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeLengthAndCodeOffset d 0
|
||||
// BinaryAnnotation Length: 4 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: LineOffset 1 CodeLength d
|
||||
// BinaryAnnotation Length: 4 bytes (0 bytes padding)
|
||||
unsigned int x = fixed_mul(5001, 7121);
|
||||
|
||||
// CL:
|
||||
// BinaryAnnotations: CodeOffsetAndLineOffset d File 0 CodeOffsetAndLineOffset 22 LineOffset 1e
|
||||
// CodeLengthAndCodeOffset 2 3
|
||||
// BinaryAnnotation Length: 12 bytes (1 bytes padding)
|
||||
//
|
||||
// Clang:
|
||||
// BinaryAnnotations: File 18 LineOffset ffffffe6 CodeOffset d CodeOffsetAndLineOffset 22
|
||||
// File 0 LineOffset 1e CodeOffset 3 CodeLength 2
|
||||
// BinaryAnnotation Length: 16 bytes (0 bytes padding)
|
||||
unsigned int z = multi_file_inlinesite(x);
|
||||
return(z);
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,7 @@ os_get_current_path(Arena *arena)
|
||||
{
|
||||
char *cwdir = getcwd(0, 0);
|
||||
String8 string = push_str8_copy(arena, str8_cstring(cwdir));
|
||||
free(cwdir);
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -215,12 +216,7 @@ os_commit_large(void *ptr, U64 size)
|
||||
internal U32
|
||||
os_tid(void)
|
||||
{
|
||||
U32 result = 0;
|
||||
#if defined(SYS_gettid)
|
||||
result = syscall(SYS_gettid);
|
||||
#else
|
||||
result = gettid();
|
||||
#endif
|
||||
U32 result = gettid();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -270,7 +266,11 @@ os_file_open(OS_AccessFlags flags, String8 path)
|
||||
{
|
||||
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};
|
||||
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; }
|
||||
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_read = 0;
|
||||
U64 total_num_bytes_left_to_read = total_num_bytes_to_read;
|
||||
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)
|
||||
{
|
||||
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; }
|
||||
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_written = 0;
|
||||
U64 total_num_bytes_left_to_write = total_num_bytes_to_write;
|
||||
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)
|
||||
{
|
||||
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()) &&
|
||||
!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);
|
||||
U64 size = src_props.size;
|
||||
U64 total_bytes_copied = 0;
|
||||
U64 bytes_left_to_copy = size;
|
||||
for(;bytes_left_to_copy > 0;)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
U64 buffer_size = Min(bytes_left_to_copy, MB(8));
|
||||
U8 *buffer = push_array_no_zero(scratch.arena, U8, buffer_size);
|
||||
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)
|
||||
off_t sendfile_off = total_bytes_copied;
|
||||
int send_result = sendfile(dst_fd, src_fd, &sendfile_off, bytes_left_to_copy);
|
||||
if(send_result <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
U64 bytes_copied = (U64)send_result;
|
||||
bytes_left_to_copy -= bytes_copied;
|
||||
total_bytes_copied += bytes_copied;
|
||||
}
|
||||
}
|
||||
os_file_close(src_h);
|
||||
@@ -601,7 +591,7 @@ os_make_directory(String8 path)
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
B32 result = 0;
|
||||
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;
|
||||
}
|
||||
@@ -760,10 +750,7 @@ os_thread_launch(OS_ThreadFunctionType *func, void *ptr, void *params)
|
||||
entity->thread.func = func;
|
||||
entity->thread.ptr = ptr;
|
||||
{
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
int pthread_result = pthread_create(&entity->thread.handle, &attr, os_lnx_thread_entry_point, entity);
|
||||
pthread_attr_destroy(&attr);
|
||||
int pthread_result = pthread_create(&entity->thread.handle, 0, os_lnx_thread_entry_point, entity);
|
||||
if(pthread_result == -1)
|
||||
{
|
||||
os_lnx_entity_release(entity);
|
||||
@@ -1082,7 +1069,7 @@ os_library_open(String8 path)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
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 };
|
||||
scratch_end(scratch);
|
||||
return lib;
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
#include <dlfcn.h>
|
||||
#include <sys/sysinfo.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_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;
|
||||
|
||||
if ( rpEndSafe <= raw )
|
||||
if ( rpEndSafe <= (U8 *)raw )
|
||||
{
|
||||
// can't compress
|
||||
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;
|
||||
|
||||
if ( rpEndSafe <= raw )
|
||||
if ( rpEndSafe <= (U8 *)raw )
|
||||
{
|
||||
// can't compress
|
||||
return rawLen+1;
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ typedef S32 RAD_S32;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define RADFORCEINLINE __forceinline
|
||||
#elif defined(__clang__)
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
# define RADFORCEINLINE __attribute__((always_inline))
|
||||
#else
|
||||
# error need force inline for this compiler
|
||||
|
||||
Reference in New Issue
Block a user