From dfd2987118c67c82574403c5ee409f9c2c184782 Mon Sep 17 00:00:00 2001 From: Michael Lee Date: Tue, 11 Mar 2025 16:58:22 +0800 Subject: [PATCH] Add linking options for tinycc backend (#24750) ### Issue When using `tcc` as backend to compile a trivial program ``` nim c --cc:tcc --skipCfg a.nim ``` , errors reported: ``` tcc: error: undefined symbol 'fabs' ``` ### Solution `fabs` belongs to libm. With these two options added, one can compile with an additional clib option: ``` nim c --cc:tcc --skipCfg --clib:m a.nim ``` --- compiler/extccomp.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 82cf5afb91..6226cea960 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -257,8 +257,8 @@ compiler tcc: linkerExe: "tcc", linkTmpl: "-o $exefile $options $buildgui $builddll $objfiles", includeCmd: " -I", - linkDirCmd: "", # XXX: not supported yet - linkLibCmd: "", # XXX: not supported yet + linkDirCmd: " -L", + linkLibCmd: " -l$1", debug: " -g ", pic: "", asmStmtFrmt: "asm($1);$n",