Fix linker errors

This commit is contained in:
Krzosa Karol
2024-01-28 08:14:24 +01:00
parent bb8d96e010
commit f56bee1cfb
4 changed files with 15 additions and 6 deletions

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
g++ -o bld build_tool/main.cpp -g g++ -o bld build_tool/main.cpp -g
./bld ./bld

View File

@@ -53,12 +53,14 @@ int main(int argc, char **argv) {
} }
#endif #endif
{ {
S8_String cc = is_cpp ? "clang++" : "clang"; S8_String cc = "clang";
Array<S8_String> flags = {scratch}; Array<S8_String> flags = {scratch};
flags += "-g -Wno-write-strings"; flags += "-g -Wno-write-strings";
flags += "-fdiagnostics-absolute-paths"; flags += "-fdiagnostics-absolute-paths";
flags += "-fsanitize=address"; flags += "-fno-exceptions";
if (is_cpp) flags += "-fno-rtti";
if (is_cpp) flags += "-fsanitize=address";
if (is_cpp) flags += "-std=c++11"; if (is_cpp) flags += "-std=c++11";
flags += Fmt("-o %.*s", S8_Expand(exe)); flags += Fmt("-o %.*s", S8_Expand(exe));
@@ -69,10 +71,12 @@ int main(int argc, char **argv) {
} }
#if OS_LINUX #if OS_LINUX
{ {
S8_String cc = is_cpp ? "g++" : "gcc"; S8_String cc = "gcc";
Array<S8_String> flags = {scratch}; Array<S8_String> flags = {scratch};
flags += "-g -Wno-write-strings"; flags += "-g -Wno-write-strings";
flags += "-fsanitize=address"; flags += "-fsanitize=address";
if (is_cpp) flags += "-fno-exceptions";
if (is_cpp) flags += "-fno-rtti";
if (is_cpp) flags += "-std=c++11"; if (is_cpp) flags += "-std=c++11";
flags += Fmt("-o %.*s", S8_Expand(exe)); flags += Fmt("-o %.*s", S8_Expand(exe));

View File

@@ -56,6 +56,8 @@ int main(int argument_count, char **arguments) {
flags += "-std=c++11 -g"; flags += "-std=c++11 -g";
flags += "-fdiagnostics-absolute-paths"; flags += "-fdiagnostics-absolute-paths";
flags += "-Wno-writable-strings"; flags += "-Wno-writable-strings";
flags += "-fno-exceptions";
flags += "-fno-rtti";
flags += Fmt("-o %.*s", S8_Expand(exe_name)); flags += Fmt("-o %.*s", S8_Expand(exe_name));
result = Run(cc + build_file + flags); result = Run(cc + build_file + flags);
} }
@@ -65,6 +67,8 @@ int main(int argument_count, char **arguments) {
Array<S8_String> flags = {Perm}; Array<S8_String> flags = {Perm};
flags += "-std=c++11 -g"; flags += "-std=c++11 -g";
flags += "-Wno-write-strings"; flags += "-Wno-write-strings";
flags += "-fno-exceptions";
flags += "-fno-rtti";
flags += Fmt("-o %.*s", S8_Expand(exe_name)); flags += Fmt("-o %.*s", S8_Expand(exe_name));
result = Run(cc + build_file + flags); result = Run(cc + build_file + flags);
} }
@@ -80,6 +84,7 @@ int main(int argument_count, char **arguments) {
// Run the build file // Run the build file
double time = OS_GetTime(); double time = OS_GetTime();
if (build_file.str) { if (build_file.str) {
exe_name = OS_GetAbsolutePath(Perm, exe_name);
int result = Run(exe_name + cmd); int result = Run(exe_name + cmd);
if (result != 0) { if (result != 0) {
IO_Printf("FAILED execution of the build file!\n"); IO_Printf("FAILED execution of the build file!\n");

View File

@@ -15,10 +15,10 @@ typedef enum IO_ErrorResult {
IO_ErrorResult_Exit, IO_ErrorResult_Exit,
} IO_ErrorResult; } IO_ErrorResult;
#ifdef _WIN32 #if defined(_MSC_VER)
#define IO_DebugBreak() (__debugbreak(), 0) #define IO_DebugBreak() (__debugbreak(), 0)
#else #else
#define IO_DebugBreak() (IO_Exit(1), 0) #define IO_DebugBreak() (__builtin_trap(), 0)
#endif #endif
#if defined(__has_attribute) #if defined(__has_attribute)