aboutsummaryrefslogtreecommitdiff
path: root/Makeconfig
diff options
context:
space:
mode:
Diffstat (limited to 'Makeconfig')
-rw-r--r--Makeconfig11
1 files changed, 9 insertions, 2 deletions
diff --git a/Makeconfig b/Makeconfig
index 0ebe043..23db67f 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -267,11 +267,18 @@ endif
# Command for linking programs with the C library.
ifndef +link
-+link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
++link = $(CC) -nostdlib -nostartfiles $(LDFLAGS) -o $@ \
$(addprefix $(csu-objpfx),start.o $(+preinit)) \
- $(^:lib=$(common-objpfx)libc.a) $(gnulib) $(common-objpfx)libc.a \
+ $(^:$(common-objpfx)libc.a=$(link-libc)) \
$(addprefix $(csu-objpfx),$(+postinit))
endif
+ifndef link-libc
+ifeq (yes,$(build-shared))
+link-libc = -L$(common-objdir) -lc $(gnulib)
+else
+link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
+endif
+endif
ifndef gnulib
gnulib := -lgcc
endif