Browse Source

llvm-18: cleanup

Laytan Laats 1 year ago
parent
commit
ecddf3b7f1
3 changed files with 12 additions and 17 deletions
  1. 1 1
      build_odin.sh
  2. 7 7
      src/build_settings.cpp
  3. 4 9
      src/llvm_backend.hpp

+ 1 - 1
build_odin.sh

@@ -65,7 +65,7 @@ Darwin)
 	fi
 	fi
 
 
 	CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)"
 	CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)"
-	LDFLAGS="$LDFLAGS -isysroot $(xcrun --show-sdk-path -sdk macosx) -liconv -ldl -framework System -lLLVM -Wl,-rpath $($LLVM_CONFIG --libdir)"
+	LDFLAGS="$LDFLAGS -liconv -ldl -framework System -lLLVM"
 	;;
 	;;
 FreeBSD)
 FreeBSD)
 	CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)"
 	CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)"

+ 7 - 7
src/build_settings.cpp

@@ -922,17 +922,17 @@ gb_internal isize MAX_ERROR_COLLECTOR_COUNT(void) {
 	return build_context.max_error_count;
 	return build_context.max_error_count;
 }
 }
 
 
-// NOTE: AMD64 targets had their alignment on 128 bit ints bumped from 8 to 16 (undocumented of course).
 #if defined(GB_SYSTEM_WINDOWS)
 #if defined(GB_SYSTEM_WINDOWS)
-	#define AMD64_MAX_ALIGNMENT (8) // TODO: up to 16 when Windows is updated to LLVM 18.
+	#include <llvm-c/Config/llvm-config.h>
 #else
 #else
 	#include <llvm/Config/llvm-config.h>
 	#include <llvm/Config/llvm-config.h>
+#endif
 
 
-	#if LLVM_VERSION_MAJOR >= 18
-		#define AMD64_MAX_ALIGNMENT (16)
-	#else
-		#define AMD64_MAX_ALIGNMENT (8)
-	#endif
+// NOTE: AMD64 targets had their alignment on 128 bit ints bumped from 8 to 16 (undocumented of course).
+#if LLVM_VERSION_MAJOR >= 18
+	#define AMD64_MAX_ALIGNMENT 16
+#else
+	#define AMD64_MAX_ALIGNMENT 8
 #endif
 #endif
 
 
 gb_global TargetMetrics target_windows_i386 = {
 gb_global TargetMetrics target_windows_i386 = {

+ 4 - 9
src/llvm_backend.hpp

@@ -1,13 +1,9 @@
 #if defined(GB_SYSTEM_WINDOWS)
 #if defined(GB_SYSTEM_WINDOWS)
-#include "llvm-c/Core.h"
-#include "llvm-c/ExecutionEngine.h"
-#include "llvm-c/Target.h"
-#include "llvm-c/Analysis.h"
-#include "llvm-c/Object.h"
-#include "llvm-c/BitWriter.h"
-#include "llvm-c/DebugInfo.h"
-#include "llvm-c/Transforms/PassBuilder.h"
+#include <llvm-c/Config/llvm-config.h>
 #else
 #else
+#include <llvm/Config/llvm-config.h>
+#endif
+
 #include <llvm-c/Core.h>
 #include <llvm-c/Core.h>
 #include <llvm-c/ExecutionEngine.h>
 #include <llvm-c/ExecutionEngine.h>
 #include <llvm-c/Target.h>
 #include <llvm-c/Target.h>
@@ -26,7 +22,6 @@
 #include <llvm-c/Transforms/Utils.h>
 #include <llvm-c/Transforms/Utils.h>
 #include <llvm-c/Transforms/Vectorize.h>
 #include <llvm-c/Transforms/Vectorize.h>
 #endif
 #endif
-#endif
 
 
 #if LLVM_VERSION_MAJOR < 11
 #if LLVM_VERSION_MAJOR < 11
 #error "LLVM Version 11 is the minimum required"
 #error "LLVM Version 11 is the minimum required"