[coreboot-gerrit] New patch to review for coreboot: arch/x86: Allow using NASM as an optional assembler

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Mon Oct 5 02:10:21 CET 2015


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11793

-gerrit

commit b262953b325f40ec41a7ffbfe0e2e1210d40772a
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Fri Oct 2 21:32:42 2015 -0700

    arch/x86: Allow using NASM as an optional assembler
    
    Some people, such as Aaron and myself find GNU as and its ATT syntax
    to be hard to use and error-prone. Aaron knows of a few companies who
    produce coreboot code (or blobs), which are also migrating to NASM. It
    makes sense, from this point, to standardize on an assembler.
    
    This patch does create the somewhat sub-optimal situation where both
    NASM and GNU as can be used to create objects linked in a binary. The
    long term plan is to standardize on NASM, and replace the ROMCC parts
    of the bootblock with NASM assembly.
    
    Also, NASM does not use the C preprocessor. While it is possible to
    run NASM files through the C preprocessor, and allow tricks such as
    
    Change-Id: I6ec7db2d5893bb0b9943940c4f767a45ec32dc09
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/arch/x86/Makefile.inc | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index e17fe11..f41255e 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -113,13 +113,27 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOU
 	$(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@
 
 # $(obj)/arch/x86/bootblock.bootblock.ld is part of $(bootblock-objs)
-$(objcbfs)/bootblock.debug: $$(bootblock-objs)
+$(objcbfs)/bootblock.debug: $$(filter %.o,$$(bootblock-objs)) $$(filter %.ld,$$(bootblock-objs)) $$(nasm-objs)
 	@printf "    LINK       $(subst $(obj)/,,$(@))\n"
 	$(LD_bootblock) $(LDFLAGS_common) $(LDFLAGS_x86) -static \
 		-o $@ -L$(obj) \
-		$(filter %.o,$(bootblock-objs)) \
+		$(filter %.o,$(bootblock-objs)) $(nasm-objs) \
 		-T $(obj)/arch/x86/bootblock.bootblock.ld \
 
+#
+# Rules for turning NASM %. asm files into linkable %.o files
+#
+# Note that assembly files with the %.asm extension, are not automatically
+# converted to a %.o in $(bootblock-objs). If we tried to do that, the generic
+# rules would try to call the GNU compiler driver on the %.asm files. We do not
+# want that, as GCC does not know how to handle them. Instead, we do this here,
+# which allows us to maintain the logical separation.
+#
+nasm-objs = $(patsubst %.asm,%.o,$(filter %.asm,$(bootblock-objs)))
+
+$(obj)/%.bootblock.o: $(src)/%.asm $(obj)/config.h
+	@printf "    NASM       $(subst $(obj)/,,$(@))\n"
+	nasm -felf -o $@ $<
 
 endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
 



More information about the coreboot-gerrit mailing list