summaryrefslogtreecommitdiff
path: root/src/task_ld.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2025-02-04 19:04:18 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2025-02-04 19:04:18 +0100
commit794335cf16b3c522b09b10dc5fb02c9554084f8a (patch)
treee1947e5dcd4f3b4dbdab1beacf7a66a577b06690 /src/task_ld.cc
parentf4b6372c1fe8d48aceb853272e0b822b967a56d7 (diff)
Add support for custom flags through env: CFLAGS, CXXFLAGS and LDFLAGS
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r--src/task_ld.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc
index 69c3a8a..03745be 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -128,8 +128,13 @@ int TaskLD::runInner()
}
auto tool = compiler();
- const auto& c = ctor::get_configuration();
- auto res = execute(settings, tool, args, c.env, is_self);
+ const auto& cfg = ctor::get_configuration();
+ auto ldflags = cfg.getenv("LDFLAGS");
+ if(!ldflags.empty())
+ {
+ append(args, ld_option(toolchain, ctor::ld_opt::custom, ldflags));
+ }
+ auto res = execute(settings, tool, args, cfg.env, is_self);
if(res != 0)
{
std::filesystem::remove(targetFile());