diff options
| author | 2026-03-21 08:58:49 +0100 | |
|---|---|---|
| committer | 2026-03-21 08:58:49 +0100 | |
| commit | 3748a221ee50b99b1f1727497b86bbd3c123e5d1 (patch) | |
| tree | 43805bd1fc024b72f08dd63f95ae386bada13aca | |
| parent | 8611099d1ef5a6230f6c33d95f1ac3a6cdb83a3c (diff) | |
Tweak configure & driver, fallback to cc
| -rwxr-xr-x | configure | 24 | ||||
| -rw-r--r-- | src/a_main.c | 20 |
2 files changed, 29 insertions, 15 deletions
@@ -55,8 +55,8 @@ fi : ${linker:=ld} test -n "$host" || die "cannot determine host" -host_arch= -host_os= +host_arch=unk +host_os=unk host_abi=none host_predefs= @@ -78,6 +78,8 @@ findgcclibdir () { fi } +link_with_cc=0 + case "$host" in *-linux-*gnu*) host_os=linux @@ -131,7 +133,8 @@ case "$host" in ' ;; *) - die "unknown/unsupported target '$host'" + link_with_cc=1 + echo "warning: unknown/unsupported target '$host'" >&2 esac echo dynamic linker: $DYNAMIC_LINKER @@ -180,6 +183,10 @@ echo using os: "$host_os" echo using abi: "$host_abi" echo host include paths: "$host_include_dirs" +if ! test -n "$DYNAMIC_LINKER"; then + linkflags="\"--dynamic-linker=$DYNAMIC_LINKER\", $linkflags" +fi + echo "/** GENERATED WITH $0 $* **/ #define HOST_TRIPLE \"$host\" #define HOST_ARCH IS$host_arch @@ -190,11 +197,12 @@ echo "/** GENERATED WITH $0 $* **/ #define HOST_CC \"$CC\" static const char *const host_predefs[] = {$host_predefs 0 }; -static const char *const host_linkcmd[] = {\"--dynamic-linker=$DYNAMIC_LINKER\", $linkflags}; -static const char *const host_ldstartfiles[] = {$ldstartfiles}; -static const char *const host_ldendfiles[] = {$ldendfiles}; -static const char *const host_ldstartfiles_pie[] = {$ldstartfiles_pie}; -static const char *const host_ldendfiles_pie[] = {$ldendfiles_pie}; +#define HOST_LINK_WITH_CC $link_with_cc +static const char *const host_linkcmd[] = {${linkflags:=0}}; +static const char *const host_ldstartfiles[] = {${ldstartfiles:=0}}; +static const char *const host_ldendfiles[] = {${ldendfiles:=0}}; +static const char *const host_ldstartfiles_pie[] = {${ldstartfiles_pie:=0}}; +static const char *const host_ldendfiles_pie[] = {${ldendfiles_pie:=0}}; " > src/hostconfig.h echo "# GENERATED WITH $0 $* diff --git a/src/a_main.c b/src/a_main.c index b947d41..8004dd3 100644 --- a/src/a_main.c +++ b/src/a_main.c @@ -474,11 +474,13 @@ findlinkcmd(CmdArgs *cmd) vpush(cmd, HOST_CC); } else { vpush(cmd, HOST_LD); - vpushn(cmd, host_linkcmd, countof(host_linkcmd)); + if (*host_linkcmd) vpushn(cmd, host_linkcmd, countof(host_linkcmd)); if (ccopt.pie) { - vpushn(cmd, host_ldstartfiles_pie, countof(host_ldstartfiles_pie)); + if (*host_ldstartfiles_pie) + vpushn(cmd, host_ldstartfiles_pie, countof(host_ldstartfiles_pie)); } else { - vpushn(cmd, host_ldstartfiles, countof(host_ldstartfiles)); + if (*host_ldstartfiles) + vpushn(cmd, host_ldstartfiles, countof(host_ldstartfiles)); } } } @@ -518,10 +520,13 @@ dolink(void) vpush(&cmd, a); } if (!task.link_with_cc) { - if (ccopt.pie) - vpushn(&cmd, host_ldendfiles_pie, countof(host_ldendfiles_pie)); - else - vpushn(&cmd, host_ldendfiles, countof(host_ldendfiles)); + if (ccopt.pie) { + if (*host_ldstartfiles_pie) + vpushn(&cmd, host_ldendfiles_pie, countof(host_ldendfiles_pie)); + } else { + if (*host_ldendfiles) + vpushn(&cmd, host_ldendfiles, countof(host_ldendfiles)); + } } if (task.verbose) { for (int i = 0; i < cmd.n; ++i) @@ -734,6 +739,7 @@ main(int argc, char **argv) if (getenv("ANTCC_VERBOSE")) { task.verbose = 1; } + task.link_with_cc = HOST_LINK_WITH_CC; /* parse cli ags */ if (argc == 1) { |