[coreboot] [LinuxBIOS] Patch file for ld/fedora 8 issue as promised...

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Sat Jan 19 02:13:39 CET 2008


Hi!

To bring this issue to an end, I resolved all conflicts the patch had
against the current tree and regenerated it without the controversial
id.lds section.

On 09.01.2008 16:13, Marc Karasek wrote:
> Attached is the latest.
>
> It uses -ge instead of == or >.  This will take care of any time that
> there are more than 1 build-id in the ld -help output.
>
> Myles Watson wrote:
>> I like the idea of using grep.  It seems much cleaner, and avoids
>> that issue.
>>
>>> Myles Watson wrote:
>>>    
>>>> On Jan 7, 2008 8:15 AM, Marc Karasek <Marc.Karasek at sun.com> wrote:
>>>> Sorry to be picky, but it seems like this breaks if they mention
>>>> build-id more than once in the help in the future.  I think >0 would
>>>> be better than ==1.
>>>>
>>>> With that fixed, or if no one thinks that will ever happen:
>>>> Acked-by: Myles Watson <myles at pel.cs.byu.edu>

If we used grep, the buildtarget snippet could probably be made a bit
smaller:
ld --help | grep -q build-id && EXTRA_LFLAGS+=" -Wl,--build-id=none"


Next try (does not (yet?) use grep):

Marc, I could not find your Signed-off-by: in the thread. If that patch
is OK for you, please sign off on it.


Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Index: LinuxBIOSv2-ldissue/src/config/Config.lb
===================================================================
--- LinuxBIOSv2-ldissue/src/config/Config.lb	(Revision 3062)
+++ LinuxBIOSv2-ldissue/src/config/Config.lb	(Arbeitskopie)
@@ -8,7 +8,7 @@
 makedefine GCC_INC_DIR := $(shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
 
 makedefine CPPFLAGS := -I$(TOP)/src/include -I$(TOP)/src/arch/$(ARCH)/include -I$(GCC_INC_DIR) $(CPUFLAGS)
-makedefine CFLAGS := $(CPU_OPT) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin  -Wall
+makedefine CFLAGS := $(CPU_OPT) $(DISTRO_CFLAGS) $(CPPFLAGS) -Os -nostdinc -nostdlib -fno-builtin  -Wall
 
 makedefine HOSTCFLAGS:= -Os -Wall
 
@@ -38,14 +38,15 @@
         action  "ar cr coreboot.a $(OBJECTS)"
 end
 
+
 makerule coreboot_ram.o
 	depends	"$(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)" 
-	action	"$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o $(DRIVER) coreboot.a $(LIBGCC_FILE_NAME)"
 end
 
 makerule coreboot_ram
 	depends	"coreboot_ram.o $(TOP)/src/config/coreboot_ram.ld ldoptions" 
-	action	"$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_ram.ld coreboot_ram.o"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_ram.ld coreboot_ram.o"
 	action 	"$(CROSS_COMPILE)nm -n coreboot_ram | sort > coreboot_ram.map"
 end
 
@@ -83,12 +84,12 @@
 
 	makerule coreboot_apc.o
 		depends "coreboot_apc.a c_start.o $(LIBGCC_FILE_NAME)"
-        action  "$(CC) -nostdlib -r -o $@ c_start.o coreboot_apc.a $(LIBGCC_FILE_NAME)"
+        action  "$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o coreboot_apc.a $(LIBGCC_FILE_NAME)"
 	end
 
 	makerule coreboot_apc
 		depends "coreboot_apc.o $(TOP)/src/config/coreboot_apc.ld ldoptions"
-		action  "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_apc.ld coreboot_apc.o"
+		action  "$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/coreboot_apc.ld coreboot_apc.o"
 		action  "$(CROSS_COMPILE)nm -n coreboot_apc | sort > coreboot_apc.map"
 	end
 
@@ -121,7 +122,7 @@
 
 makerule coreboot   
 	depends	"crt0.o $(INIT-OBJECTS) $(COREBOOT_APC) $(COREBOOT_RAM_ROM) ldscript.ld"
-	action	"$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
 	action	"$(CROSS_COMPILE)nm -n coreboot | sort > coreboot.map"
 end
 
Index: LinuxBIOSv2-ldissue/targets/buildtarget
===================================================================
--- LinuxBIOSv2-ldissue/targets/buildtarget	(Revision 3062)
+++ LinuxBIOSv2-ldissue/targets/buildtarget	(Arbeitskopie)
@@ -69,9 +69,16 @@
 
 rm -rf .$$.tmp
 
+ld --help | awk '{for (i=1;i<=NF;i++) if ($i ~ /build-id/){n++} }; END {exit n}' 
+build_id=$?
+if [ $build_id -ge 1 ] ; then
+	EXTRA_LFLAGS+=" -Wl,--build-id=none"
+fi
+
 for i in $build_dir/Makefile.settings $build_dir/*/Makefile.settings
 do
-	echo CFLAGS+=$EXTRA_CFLAGS >>$i
+	echo DISTRO_CFLAGS+=$EXTRA_CFLAGS >>$i
+	echo DISTRO_LFLAGS+=$EXTRA_LFLAGS >>$i
 done
 
 exit $?






More information about the coreboot mailing list