commit 05eaf7efa381c1f78ba45605fe6a5731d756fe5b
parent 5688a976a82b233ad9ae752869d4772f36f23809
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Tue, 9 Jun 2026 15:25:27 -0700
driver: reject -shared in cc and ld (not yet supported)
cc -shared and ld -shared now error immediately with "creating
dynamic/shared libraries is not yet supported". build-lib -dynamic
and build-exe -shared were already rejected; this closes the remaining
two entrypoints that silently fell through to an incomplete linker stub.
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/driver/cmd/cc.c b/driver/cmd/cc.c
@@ -1515,6 +1515,11 @@ static int cc_parse(int argc, char** argv, CcOptions* o) {
"(shared-library LTO output is not exercised)");
return 1;
}
+ if (o->shared) {
+ driver_errf(CC_TOOL,
+ "creating dynamic/shared libraries is not yet supported");
+ return 1;
+ }
if (o->emit_ir && o->opt_level < 1) {
driver_errf(CC_TOOL,
"--emit=ir requires -O1 or higher "
diff --git a/driver/cmd/ld.c b/driver/cmd/ld.c
@@ -1252,6 +1252,11 @@ static int ld_parse(int argc, char** argv, LdOptions* o) {
"--no-default-libs");
return 1;
}
+ if (o->shared) {
+ driver_errf(LD_TOOL,
+ "creating dynamic/shared libraries is not yet supported");
+ return 1;
+ }
if (o->relocatable) {
if (o->shared) {
driver_errf(LD_TOOL, "-r and -shared are incompatible");