]> Devi Nivas Git - cs3210-lab1.git/commitdiff
Fixed broken build on newer gold linker with NaCl support
authorIcenowy Zheng <icenowy@outlook.com>
Sat, 9 Apr 2016 01:38:40 +0000 (09:38 +0800)
committerFrans Kaashoek <kaashoek@mit.edu>
Mon, 26 Sep 2016 12:25:17 +0000 (08:25 -0400)
On platforms with NaCl support, ld.gold -V will return a "elf_i386_nacl" in
addition to "elf_i386", which will make the build fail.

Makefile

index 84faa486e809c41ff16403ee2125c41ae46f26c6..93d525afc6d433f46c23bd86daa82198d61f2f3c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ CFLAGS = -fno-pic -static -fno-builtin -fno-strict-aliasing -O2 -Wall -MD -ggdb
 CFLAGS += $(shell $(CC) -fno-stack-protector -E -x c /dev/null >/dev/null 2>&1 && echo -fno-stack-protector)
 ASFLAGS = -m32 -gdwarf-2 -Wa,-divide
 # FreeBSD ld wants ``elf_i386_fbsd''
-LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null)
+LDFLAGS += -m $(shell $(LD) -V | grep elf_i386 2>/dev/null | head -n 1)
 
 xv6.img: bootblock kernel fs.img
        dd if=/dev/zero of=xv6.img count=10000