mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-26 23:44:58 -07:00
Added a very basic Linux standard library shamelessly stolen from the MacOS one.
Made Linux (almost) work. The generated binaries segfault, but it's so close I can almost taste it.
This commit is contained in:
@@ -153,8 +153,6 @@ String odin_root_dir(void) {
|
||||
if(len == 0) {
|
||||
return make_string(NULL, 0);
|
||||
}
|
||||
printf("build.c:155 | Link value: \"%s\"\n", &path_buf.e[0]);
|
||||
exit(1);
|
||||
if (len < path_buf.count) {
|
||||
break;
|
||||
}
|
||||
|
||||
+3
-2
@@ -3627,7 +3627,7 @@ gb_inline void *gb_memcopy(void *dest, void const *source, isize n) {
|
||||
#if defined(_MSC_VER)
|
||||
// TODO(bill): Is this good enough?
|
||||
__movsb(cast(u8 *)dest, cast(u8 *)source, n);
|
||||
#elif defined(GB_SYSTEM_OSX)
|
||||
#elif defined(GB_SYSTEM_OSX) || defined(GB_SYSTEM_UNIX)
|
||||
// NOTE(zangent): I assume there's a reason this isn't being used elsewhere,
|
||||
// but I don't see it and I can't seem to get this working any other way.
|
||||
memcpy(dest, source, n);
|
||||
@@ -4676,7 +4676,8 @@ gb_inline u32 gb_thread_current_id(void) {
|
||||
#else
|
||||
thread_id = GetCurrentThreadId();
|
||||
#endif
|
||||
|
||||
#elif defined(GB_SYSTEM_LINUX)
|
||||
thread_id = pthread_self();
|
||||
#elif defined(GB_SYSTEM_OSX) && defined(GB_ARCH_64_BIT)
|
||||
thread_id = pthread_mach_thread_np(pthread_self());
|
||||
#elif defined(GB_ARCH_32_BIT) && defined(GB_CPU_X86)
|
||||
|
||||
+8
-1
@@ -399,10 +399,14 @@ int main(int argc, char **argv) {
|
||||
link_settings = "";
|
||||
}
|
||||
|
||||
printf("Libs: %s\n", lib_str);
|
||||
|
||||
// TODO(zangent): I'm not sure what to do with lib_str.
|
||||
// I'll have to look at the format that the libraries are listed to determine what to do.
|
||||
lib_str = "";
|
||||
|
||||
|
||||
|
||||
exit_code = system_exec_command_line_app("ld-link", true,
|
||||
"ld \"%.*s\".o -o \"%.*s%s\" %s "
|
||||
"-lc "
|
||||
@@ -411,8 +415,11 @@ int main(int argc, char **argv) {
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
// This sets a requirement of Mountain Lion and up, but the compiler doesn't work without this limit.
|
||||
" -macosx_version_min 10.8.0 "
|
||||
" -e _main "
|
||||
#else
|
||||
" -e main -dynamic-linker /lib64/ld-linux-x86-64.so.2 "
|
||||
#endif
|
||||
" -e _main ",
|
||||
,
|
||||
LIT(output), LIT(output), output_ext,
|
||||
lib_str, LIT(build_context.link_flags),
|
||||
link_settings
|
||||
|
||||
Reference in New Issue
Block a user