Make the stage2.lds building platform-independent by not trying to match

an exact address (idea from Paul Mackerras' PPC port).  Thus it could be
moved into coregrind/Makefile.am.

Let me know if this breaks anything on other platforms.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3939
This commit is contained in:
Nicholas Nethercote 2005-06-18 16:41:30 +00:00
parent 6404b199cb
commit a0a6af2854
5 changed files with 17 additions and 31 deletions

View File

@ -83,6 +83,9 @@ EXTRA_DIST = \
valgrind.vs \
README_MODULES.txt
BUILT_SOURCES = stage2.lds
CLEANFILES = stage2.lds
valgrind_SOURCES = \
ume.c \
\
@ -159,11 +162,11 @@ stage2_LDFLAGS = \
-Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
-pie
else
stage2_DEPENDENCIES = $(st2_DEPS_common) ${VG_ARCH}/stage2.lds
stage2_DEPENDENCIES = $(st2_DEPS_common) stage2.lds
stage2_LDFLAGS = \
$(st2_LDFLAGS_common) \
-Wl,--whole-archive $(stage2_extra2) -Wl,--no-whole-archive \
-Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,${VG_ARCH}/stage2.lds
-Wl,-defsym,kickstart_base=@KICKSTART_BASE@ -Wl,-T,stage2.lds
endif
stage2_LDADD= $(stage2_extra) \
@ -177,6 +180,16 @@ vg_preload_core_so_LDFLAGS = \
-Wl,--soname,vg_preload_core.so \
-Wl,-z,initfirst
# Extract ld's default linker script and hack it to our needs.
# This relies on finding "executable_start" and replacing the address on
# that line with kickstart_base.
stage2.lds: Makefile
$(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/d' \
-e '/executable_start/s/0x[0-9A-Fa-f]\+/kickstart_base/g' > $@ \
|| rm -f $@
MANUAL_DEPS = $(noinst_HEADERS) $(include_HEADERS)
all-local:

View File

@ -3,15 +3,6 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
noinst_LIBRARIES = libarch.a
BUILT_SOURCES = stage2.lds
CLEANFILES = stage2.lds
libarch_a_SOURCES = \
cpuid.S
# Extract ld's default linker script and hack it to our needs
stage2.lds: Makefile
$(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/d' \
-e 's/0x400000/kickstart_base/g' > $@ || rm -f $@

View File

@ -3,14 +3,5 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
noinst_LIBRARIES = libarch.a
BUILT_SOURCES = stage2.lds
CLEANFILES = stage2.lds
libarch_a_SOURCES =
# Extract ld's default linker script and hack it to our needs
stage2.lds: Makefile
$(CC) -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/d' \
-e 's/0x00008000/kickstart_base/g' > $@ || rm -f $@

View File

@ -3,15 +3,6 @@ include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
noinst_LIBRARIES = libarch.a
BUILT_SOURCES = stage2.lds
CLEANFILES = stage2.lds
libarch_a_SOURCES = \
cpuid.S
# Extract ld's default linker script and hack it to our needs
stage2.lds: Makefile
$(CC) $(AM_CFLAGS) -Wl,--verbose -nostdlib 2>&1 | sed \
-e '1,/^=====\+$$/d' \
-e '/^=====\+$$/d' \
-e 's/0x08048000/kickstart_base/g' > $@ || rm -f $@

View File

@ -196,8 +196,8 @@ hello_CFLAGS = $(AM_CFLAGS) -fpie
hello_LDFLAGS = -pie
else
hello_LDFLAGS = -Wl,-defsym,kickstart_base=0x50000000 \
-Wl,-T,../../coregrind/${VG_ARCH}/stage2.lds
hello_DEPENDENCIES = ../../coregrind/${VG_ARCH}/stage2.lds
-Wl,-T,../../coregrind/stage2.lds
hello_DEPENDENCIES = ../../coregrind/stage2.lds
endif
vgtest_ume_CFLAGS = -DVGA_$(VG_ARCH)