From 4ae5b30e5eb0be98521235060001c2d6d9828345 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 21 Aug 2008 04:49:45 +0000 Subject: [PATCH] Use --build-id=none to avoid build-id sections on FC8. These build-id sections cause the Pintos ELF loader to reject binaries. The preferred way to eliminate them would be to add /DISCARD/ : { *(.note.gnu.build-id) } to the linker script, but (as reported by Godmar Back) this causes a segmentation fault in ld, as reported in a bug filed at: http://sourceware.org/bugzilla/show_bug.cgi?id=5025 --- src/Make.config | 5 +++++ src/Makefile.userprog | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Make.config b/src/Make.config index 841e910..3279301 100644 --- a/src/Make.config +++ b/src/Make.config @@ -44,6 +44,11 @@ ifeq ($(strip $(shell echo | $(CC) -fno-stack-protector -E - > /dev/null 2>&1; e CFLAGS += -fno-stack-protector endif +# Turn off --build-id in the linker, which confuses the Pintos loader. +ifeq ($(strip $(shell $(LD) --build-id=none -e 0 /dev/null -o /dev/null 2>&1; echo $$?)),0) +LDFLAGS += -Wl,--build-id=none +endif + %.o: %.c $(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS) $(WARNINGS) $(DEFINES) $(DEPS) diff --git a/src/Makefile.userprog b/src/Makefile.userprog index 3631cf1..f90b08c 100644 --- a/src/Makefile.userprog +++ b/src/Makefile.userprog @@ -3,7 +3,7 @@ $(PROGS): CPPFLAGS += -I$(SRCDIR)/lib/user -I. # Linker flags. -$(PROGS): LDFLAGS = -nostdlib -static -Wl,-T,$(LDSCRIPT) +$(PROGS): LDFLAGS += -nostdlib -static -Wl,-T,$(LDSCRIPT) $(PROGS): LDSCRIPT = $(SRCDIR)/lib/user/user.lds # Library code shared between kernel and user programs. -- 2.30.2