After looking at the script Myles sent, I immediately saw the problem. I forgot that if [ $build_id ] will always be true because it checks to see if it is defined not the value of build_id. My bad, sorry.

I have made the changes and added an == 1 to the if statement. Attached is the new and I hope final patch file for this.


/*********************
Marc Karasek
MTS
Sun Microsystems
mailto:[EMAIL PROTECTED]
ph:770.360.6415
*********************/



Ed Swierk wrote:
On 1/4/08, Marc Karasek <[EMAIL PROTECTED]> wrote:
I made a test script and ran it and it sets build_id = 1 properly.  I
have also included this script.

The problem is that on Planet Bourne, zero means true and nonzero means false.

--Ed
Index: LinuxBIOSv2/src/config/Config.lb
===================================================================
--- LinuxBIOSv2/src/config/Config.lb	(revision 3007)
+++ LinuxBIOSv2/src/config/Config.lb	(working copy)
@@ -8,7 +8,7 @@
 makedefine GCC_INC_DIR := $(shell $(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 linuxbios.a $(OBJECTS)"
 end
 
+
 makerule linuxbios_ram.o
 	depends	"$(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)" 
-	action	"$(CC) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o $(DRIVER) linuxbios.a $(LIBGCC_FILE_NAME)"
 end
 
 makerule linuxbios_ram
 	depends	"linuxbios_ram.o $(TOP)/src/config/linuxbios_ram.ld ldoptions" 
-	action	"$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_ram.ld linuxbios_ram.o"
+	action	"$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_ram.ld linuxbios_ram.o"
 	action 	"$(CROSS_COMPILE)nm -n linuxbios_ram | sort > linuxbios_ram.map"
 end
 
@@ -83,12 +84,12 @@
 
 	makerule linuxbios_apc.o
 		depends "linuxbios_apc.a c_start.o $(LIBGCC_FILE_NAME)"
-        action  "$(CC) -nostdlib -r -o $@ c_start.o linuxbios_apc.a $(LIBGCC_FILE_NAME)"
+        action  "$(CC) $(DISTRO_LFLAGS) -nostdlib -r -o $@ c_start.o linuxbios_apc.a $(LIBGCC_FILE_NAME)"
 	end
 
 	makerule linuxbios_apc
 		depends "linuxbios_apc.o $(TOP)/src/config/linuxbios_apc.ld ldoptions"
-		action  "$(CC) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_apc.ld linuxbios_apc.o"
+		action  "$(CC) $(DISTRO_LFLAGS) -nostdlib -nostartfiles -static -o $@ -T $(TOP)/src/config/linuxbios_apc.ld linuxbios_apc.o"
 		action  "$(CROSS_COMPILE)nm -n linuxbios_apc | sort > linuxbios_apc.map"
 	end
 
@@ -121,7 +122,7 @@
 
 makerule linuxbios   
 	depends	"crt0.o $(INIT-OBJECTS) $(LINUXBIOS_APC) $(LINUXBIOS_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 linuxbios | sort > linuxbios.map"
 end

Index: LinuxBIOSv2/src/arch/i386/lib/id.lds
===================================================================
--- LinuxBIOSv2/src/arch/i386/lib/id.lds	(revision 3007)
+++ LinuxBIOSv2/src/arch/i386/lib/id.lds	(working copy)
@@ -1,5 +1,11 @@
 SECTIONS {
-	. = (_ROMBASE + ROM_IMAGE_SIZE - 0x10) - (__id_end - __id_start);
+
+/*
+ *           . = (_ROMBASE + (ROM_IMAGE_SIZE - 0x10)) - (__id_end - __id_start);
+ *  		This is a temporary fix.  Under Fedora 8 ld does not like it if the .id section is above address 0xFFFF_EF00          
+*/
+        _ROMTEMP = 0xffffef00;
+        . = _ROMTEMP;
 	.id (.): {
 		*(.id)
 	}
Index: LinuxBIOSv2/targets/buildtarget
===================================================================
--- LinuxBIOSv2/targets/buildtarget	(revision 3007)
+++ LinuxBIOSv2/targets/buildtarget	(working copy)
@@ -53,4 +53,32 @@
 export PYTHONPATH=$config_dir
 $PYTHON $config_py $config_lb $lbpath
 
+# now start checking for distro-specific breakage. 
+## This check is for the no stack protector mess.
+EXTRA_CFLAGS=
+
+if [ -z "$CC" ]; then
+       CC=gcc
+fi
+
+$CC -fno-stack-protector -S -xc /dev/null -o .$$.tmp
+
+if [ $? -eq 0 ]; then
+       EXTRA_CFLAGS=-fno-stack-protector
+fi
+
+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 == 1 ] ; then
+	EXTRA_LFLAGS+=" -Wl,--build-id=none"
+fi
+
+for i in $build_dir/Makefile.settings $build_dir/*/Makefile.settings
+do
+	echo DISTRO_CFLAGS+=$EXTRA_CFLAGS >>$i
+	echo DISTRO_LFLAGS+=$EXTRA_LFLAGS >>$i
+done
+
 exit $?
-- 
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to