From: Masahiro Yamada <masahiroy@kernel.org>
To: barebox@lists.infradead.org
Cc: Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 1/5] kbuild: remove unneeded -nostdlib flag
Date: Wed, 17 Nov 2021 12:49:14 +0900 [thread overview]
Message-ID: <20211117034918.1226358-2-masahiroy@kernel.org> (raw)
In-Reply-To: <20211117034918.1226358-1-masahiroy@kernel.org>
The -nostdlib option requests the compiler to not use the standard
system startup files or libraries when linking.
arch/kvm/Makefile adds it to KBUILD_CFLAGS/AFLAGS, but it does not make
sense because those are unrelated to linking.
arch/{mips,riscv,x86}/Makefile passes it to the linker, but it is not
sensible either. As noted above, adding -nostdlib makes sense only
when $(CC) is used as a linker driver, but $(LD) is directly used for
linking barebox. (ld.bfd/ld.lld recognizes the -nostdlib flag, but its
behavior is obscure, and unneeded here.)
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
arch/kvx/Makefile | 2 +-
arch/mips/Makefile | 2 --
arch/riscv/Makefile | 1 -
arch/x86/Makefile | 2 +-
4 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/kvx/Makefile b/arch/kvx/Makefile
index 13c4e2431..f29eeef92 100644
--- a/arch/kvx/Makefile
+++ b/arch/kvx/Makefile
@@ -8,7 +8,7 @@ ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := kvx-elf-
endif
-DEFAULT_CFLAGS := -nostdlib -fno-builtin -fstrict-align -g
+DEFAULT_CFLAGS := -fno-builtin -fstrict-align -g
DEFAULT_CFLAGS += -DTEXT_BASE=$(CONFIG_TEXT_BASE)
LIBGCC_PATH = $(dir $(shell $(CC) $(KBUILD_CFLAGS) --print-libgcc-file-name))
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 4eb6ba772..786695194 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -72,8 +72,6 @@ KBUILD_BINARY := barebox.bin
KBUILD_TARGET := barebox.bin
endif
-LDFLAGS_barebox += -nostdlib
-
machine-$(CONFIG_MACH_MIPS_MALTA) := malta
machine-$(CONFIG_MACH_MIPS_AR231X) := ar231x
machine-$(CONFIG_MACH_MIPS_ATH79) := ath79
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0b1278936..23ea6178a 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -17,7 +17,6 @@ PBL_CPPFLAGS += $(riscv-cflags-y)
LDFLAGS_pbl += $(riscv-ldflags-y)
cflags-y += $(riscv-cflags-y)
-LDFLAGS_barebox += -nostdlib
LDFLAGS_barebox += $(riscv-ldflags-y)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index fd871ca21..9fc64cc04 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -54,7 +54,7 @@ lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
cmd_barebox__ ?= $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_barebox) -o $@ \
-T $(lds-y) \
- -shared -Bsymbolic -nostdlib -znocombreloc \
+ -shared -Bsymbolic -znocombreloc \
--whole-archive $(BAREBOX_OBJS) \
--no-whole-archive \
$(filter-out $(BAREBOX_LDS) $(BAREBOX_OBJS) FORCE ,$^)
--
2.30.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-11-17 3:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-17 3:49 [PATCH 0/5] x86: misc cleanups Masahiro Yamada
2021-11-17 3:49 ` Masahiro Yamada [this message]
2021-11-17 3:49 ` [PATCH 2/5] x86: remove x86-specific cmd_barebox__ Masahiro Yamada
2021-11-17 3:49 ` [PATCH 3/5] x86: stop copying unneeded sections to barebox.efi Masahiro Yamada
2021-11-17 3:49 ` [PATCH 4/5] x86: reuse cmd_objcopy to generate barebox.efi Masahiro Yamada
2021-11-17 3:49 ` [PATCH 5/5] x86_64: do not pass the EFI image handle or system table to relocation Masahiro Yamada
2021-11-17 7:42 ` [PATCH 0/5] x86: misc cleanups Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211117034918.1226358-2-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox