Here is the patch file that should create a Makefile.distro in the
target directory and then include this file as part of the make
process. It checks for the buildid option for ld using awk in
buildtarget script. Then sets the appropriate flag in the file.
I do not check to see if the Makefile.distro is "current". It just
checks to see if one is present or not.
--
/*********************
Marc Karasek
MTS
Sun Microsystems
mailto:[EMAIL PROTECTED]
ph:770.360.6415
*********************/
Index: src/config/Config.lb
===================================================================
--- src/config/Config.lb (revision 3007)
+++ src/config/Config.lb (working copy)
@@ -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) $(BUILDID_OPTION) -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) $(BUILDID_OPTION) -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) $(BUILDID_OPTION) -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) $(BUILDID_OPTION) -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) $(BUILDID_OPTION) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o $(INIT-OBJECTS)"
action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
end
Index: src/config/linuxbios_ram.ld
===================================================================
--- src/config/linuxbios_ram.ld (revision 3007)
+++ src/config/linuxbios_ram.ld (working copy)
@@ -63,6 +63,13 @@
_erodata = .;
}
+
+ /* ld segfaults if we give it --build-id and then discard this section */
+/*
+ .note.gnu.build-id : {
+ *(.note.gnu.build-id)
+ }
+*/
/*
* After the code we place initialized data (typically initialized
* global variables). This gets copied into ram by startup code.
Index: src/arch/i386/Config.lb
===================================================================
--- src/arch/i386/Config.lb (revision 3007)
+++ src/arch/i386/Config.lb (working copy)
@@ -100,7 +100,7 @@
makerule linuxbios
depends "crt0.o init.o $(LINUXBIOS_APC) $(LINUXBIOS_RAM_ROM) ldscript.ld"
- action "$(CC) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
+ action "$(CC) $(BUILDID_OPTION) -nostdlib -nostartfiles -static -o $@ -T ldscript.ld crt0.o init.o"
action "$(CROSS_COMPILE)nm -n linuxbios | sort > linuxbios.map"
end
Index: src/arch/i386/lib/id.lds
===================================================================
--- src/arch/i386/lib/id.lds (revision 3007)
+++ 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: targets/buildtarget
===================================================================
--- targets/buildtarget (revision 3007)
+++ targets/buildtarget (working copy)
@@ -36,9 +36,11 @@
exit 1
fi
+
build_dir=`dirname $config_lb`/`sed -n -e 's/^target \(.*\)$/\1/p' $config_lb`
echo "build_dir=$build_dir"
config_py=$build_dir/config.py
+make_distro=$build_dir/Makefile.distro
if [ ! -d $build_dir ] ; then
mkdir -p $build_dir
@@ -53,4 +55,16 @@
export PYTHONPATH=$config_dir
$PYTHON $config_py $config_lb $lbpath
+if [ ! -f $make_distro ] ; then
+ echo "Makefile.distro not found. Creating.."
+ touch $make_distro
+ ld --help | awk '{for (i=1;i<=NF;i++) if ($i ~ /build-id/){n++} }; END {exit n}'
+ build_id=$?
+ if [ $build_id ] ; then
+ echo "BUILDID_OPTION=-Wl,--build-id=none" >> $make_distro
+ else
+ echo "BUILDID_OPTION=" >> $make_distro
+ fi
+fi
+
exit $?
Index: util/newconfig/config.g
===================================================================
--- util/newconfig/config.g (revision 3007)
+++ util/newconfig/config.g (working copy)
@@ -1997,6 +1997,7 @@
# main rule
file.write("\nall: linuxbios.rom\n\n")
file.write(".PHONY: all\n\n")
+ file.write("include ../Makefile.distro\n")
#file.write("include cpuflags\n")
# Putting "include cpuflags" in the Makefile has the problem that the
# cpuflags file would be generated _after_ we want to include it.
--
linuxbios mailing list
linuxbios@linuxbios.org
http://www.linuxbios.org/mailman/listinfo/linuxbios