From 044a11f28ca5920dc7a6ec9f8d2e2ec00b2f4ba8 Mon Sep 17 00:00:00 2001 From: servostar Date: Thu, 10 Oct 2024 20:50:21 +0200 Subject: [PATCH] feat: added support for color-always option for ld.lld --- src/cfg/opt.h | 2 ++ src/link/lldc/lldc.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cfg/opt.h b/src/cfg/opt.h index 4776840..7502d3b 100644 --- a/src/cfg/opt.h +++ b/src/cfg/opt.h @@ -41,6 +41,8 @@ typedef struct TargetLinkConfig_t { bool colorize; char *output_file; char *driver; + // entry point symbol name + char* entry; } TargetLinkConfig; typedef enum TargetCompilationMode_t { diff --git a/src/link/lldc/lldc.c b/src/link/lldc/lldc.c index 39a93ad..aad0e56 100644 --- a/src/link/lldc/lldc.c +++ b/src/link/lldc/lldc.c @@ -30,10 +30,14 @@ bool lldc_link(TargetConfig* target_config, TargetLinkConfig* link_config) { char* linker = "ld.lld"; g_array_append_val(arguments, linker); + if (is_option_set("color-always")) { + char* colored_diagnostics = "--color-diagnostics=always"; + g_array_append_val(arguments, colored_diagnostics); + } + const char* optimization_level = get_optimization_level_string(target_config); g_array_append_val(arguments, optimization_level); - // enable dynamic linker on linux if (extract_sys_from_triple(target_config->triple) == SYS_LINUX) { if (target_has_shared_dependency(link_config))