fix: multiple definition of triple elements

This commit is contained in:
Sven Vogel 2024-09-19 22:54:12 +02:00
parent 6b5f80799e
commit caeda1224c
2 changed files with 63 additions and 27 deletions

View File

@ -15,16 +15,47 @@ static GHashTable* args = NULL;
static Dependency *new_dependency();
const char* ARCH_X86_64 = "x86_64";
const char* ARCH_I386 = "i386";
const char* ARCH_ARM = "arm";
const char* ARCH_THUMB = "thumb";
const char* ARCH_MIPS = "mips";
const char* SUB_V5 = "v5";
const char* SUB_V6M = "v6m";
const char* SUB_V7A = "v7a";
const char* SUB_V7M = "v7m";
const char* VENDOR_PC = "pc";
const char* VENDOR_APPLE = "apple";
const char* VENDOR_NVIDIA = "nvidia";
const char* VENDOR_IBM = "ibm";
const char* SYS_NONE = "none";
const char* SYS_LINUX = "linux";
const char* SYS_WIN32 = "win32";
const char* SYS_DARWIN = "darwin";
const char* SYS_CUDA = "cuda";
const char* ENV_EABI = "eabi";
const char* ENV_GNU = "gnu";
const char* ENV_ANDROID = "android";
const char* ENV_MACHO = "macho";
const char* ENV_ELF = "elf";
const char* find_string(const char* haystack, const char** options, size_t size)
{
const static char* found = NULL;
for (size_t i = 0; i < size/sizeof(const char*); i++)
if (haystack != NULL)
{
if (strstr(haystack, options[i]))
for (size_t i = 0; i < size/sizeof(const char*); i++)
{
found = options[i];
break;
if (strstr(haystack, options[i]))
{
found = options[i];
break;
}
}
}
@ -191,6 +222,7 @@ TargetConfig* default_target_config() {
config->lld_fatal_warnings = FALSE;
config->gsc_fatal_warnings = FALSE;
config->import_paths = mem_new_g_array(MemoryNamespaceOpt, sizeof(char*));
config->triple = NULL;
return config;
}

View File

@ -78,6 +78,10 @@ typedef struct TargetConfig_t {
char *archive_directory;
// binary driver for executable generation
char *driver;
// system to compile code for
// LLVM triple, see: https://clang.llvm.org/docs/CrossCompilation.html#target-triple
// in case this is empty this will be the native platform
char* triple;
// mode of compilation
TargetCompilationMode mode;
// number between 1 and 3
@ -126,33 +130,33 @@ typedef struct Option_t {
bool is_opt;
} Option;
const char* ARCH_X86_64 = "x86_64";
const char* ARCH_I386 = "i386";
const char* ARCH_ARM = "arm";
const char* ARCH_THUMB = "thumb";
const char* ARCH_MIPS = "mips";
extern const char* ARCH_X86_64;
extern const char* ARCH_I386;
extern const char* ARCH_ARM;
extern const char* ARCH_THUMB;
extern const char* ARCH_MIPS;
const char* SUB_V5 = "v5";
const char* SUB_V6M = "v6m";
const char* SUB_V7A = "v7a";
const char* SUB_V7M = "v7m";
extern const char* SUB_V5;
extern const char* SUB_V6M;
extern const char* SUB_V7A;
extern const char* SUB_V7M;
const char* VENDOR_PC = "pc";
const char* VENDOR_APPLE = "apple";
const char* VENDOR_NVIDIA = "nvidia";
const char* VENDOR_IBM = "ibm";
extern const char* VENDOR_PC;
extern const char* VENDOR_APPLE;
extern const char* VENDOR_NVIDIA;
extern const char* VENDOR_IBM;
const char* SYS_NONE = "none";
const char* SYS_LINUX = "linux";
const char* SYS_WIN32 = "win32";
const char* SYS_DARWIN = "darwin";
const char* SYS_CUDA = "cuda";
extern const char* SYS_NONE;
extern const char* SYS_LINUX;
extern const char* SYS_WIN32;
extern const char* SYS_DARWIN;
extern const char* SYS_CUDA;
const char* ENV_EABI = "eabi";
const char* ENV_GNU = "gnu";
const char* ENV_ANDROID = "android";
const char* ENV_MACHO = "macho";
const char* ENV_ELF = "elf";
extern const char* ENV_EABI;
extern const char* ENV_GNU;
extern const char* ENV_ANDROID;
extern const char* ENV_MACHO;
extern const char* ENV_ELF;
const char* extract_arch_from_triple(const char* triple);