added gcc driver
This commit is contained in:
parent
7cfbeb085d
commit
9786abc212
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// Created by servostar on 18.07.24.
|
||||
//
|
||||
|
||||
#include <link/clang/driver.h>
|
||||
#include <io/files.h>
|
||||
#include <mem/cache.h>
|
||||
|
||||
bool gcc_link(TargetLinkConfig* config) {
|
||||
|
||||
GString* commandString = g_string_new("");
|
||||
|
||||
g_string_append(commandString, "gcc");
|
||||
|
||||
for (guint i = 0; i < config->object_file_names->len; i++) {
|
||||
g_string_append(commandString, " ");
|
||||
g_string_append(commandString, g_array_index(config->object_file_names, char*, i));
|
||||
}
|
||||
|
||||
g_string_append(commandString, " -o ");
|
||||
g_string_append(commandString, config->output_file);
|
||||
|
||||
print_message(Info, "invoking binary link with: %s", commandString->str);
|
||||
|
||||
if (system(commandString->str)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
g_string_free(commandString, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BinaryDriver* gcc_get_driver() {
|
||||
|
||||
BinaryDriver* driver = mem_alloc(MemoryNamespaceLld, sizeof (BinaryDriver));
|
||||
|
||||
driver->name = "gcc";
|
||||
driver->link_func = &gcc_link;
|
||||
|
||||
return driver;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
//
|
||||
// Created by servostar on 18.07.24.
|
||||
//
|
||||
|
||||
#ifndef GEMSTONE_GCC_DRIVER_H
|
||||
#define GEMSTONE_GCC_DRIVER_H
|
||||
|
||||
#include <link/driver.h>
|
||||
|
||||
bool gcc_link(TargetLinkConfig* config);
|
||||
|
||||
BinaryDriver* gcc_get_driver();
|
||||
|
||||
#endif // GEMSTONE_GCC_DRIVER_H
|
|
@ -7,8 +7,12 @@
|
|||
#include <sys/log.h>
|
||||
#include <io/files.h>
|
||||
|
||||
#include <link/clang/driver.h>
|
||||
#include <link/gcc/driver.h>
|
||||
|
||||
static driver_init AVAILABLE_DRIVER[] = {
|
||||
clang_get_driver
|
||||
clang_get_driver,
|
||||
gcc_get_driver
|
||||
};
|
||||
|
||||
static GHashTable* binary_driver = NULL;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef GEMSTONE_LIB_H
|
||||
#define GEMSTONE_LIB_H
|
||||
|
||||
#include <link/clang/driver.h>
|
||||
#include <link/driver.h>
|
||||
|
||||
typedef BinaryDriver* (*driver_init)();
|
||||
|
||||
|
|
Loading…
Reference in New Issue