qemu-kvm tests: fix linker script problem
PATCH v2 1/1 qemu-kvm tests: fix linker script problem
commit 848bd0c89c83814023cf51c72effdbc7de0d18b7 causes the linker script itself (flat.lds) to become part of the linked objects, which messed the output file, specifically, the symbol edata is not the last symbol anymore.
change v1 -> v2
Instead of dropping the dependency, put it on a separate line/rule, so the lds file will not be considered as one of the dependencies in the linking line/rule.
--- kvm/user/config-x86-common.mak | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
kvm/user/config-x86-common.mak +2 -1
@@ -19,7 +19,8 @@ CFLAGS += -m$(bits) libgcc := $(shell $(CC) -m$(bits) --print-libgcc-file-name) FLATLIBS = test/lib/libcflat.a $(libgcc) -%.flat: %.o $(FLATLIBS) flat.lds +%.flat: flat.lds +%.flat: %.o $(FLATLIBS) $(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^ $(FLATLIBS) tests-common = $(TEST_DIR)/vmexit.flat $(TEST_DIR)/tsc.flat \
Signature · 1 line
1.6.3.3
Quoted 12 lines · Naphtali Sprei
commit
848bd0c89c83814023cf51c72effdbc7de0d18b7causes the linker script itself (flat.lds) to become part of the linked objects, which messed the output file, specifically, the symbol edata is not the last symbol anymore.change v1 -> v2
Instead of dropping the dependency, put it on a separate line/rule, so the lds file will not be considered as one of the dependencies in the linking line/rule.
Quoted 6 lines
FLATLIBS = test/lib/libcflat.a $(libgcc)
-%.flat: %.o $(FLATLIBS)flat.lds
+%.flat:flat.lds
+%.flat: %.o $(FLATLIBS)
$(CC) $(CFLAGS) -nostdlib -o $@ -Wl,-T,flat.lds $^ $(FLATLIBS)
I don't think that works - $^ selects all prerequisites, not just the ones in the line for the make rule.
prereq-%:
touch $@
dummy: prereq-1
dummy: prereq-2
echo $^
$ make dummy touch prereq-2 touch prereq-1 echo prereq-2 prereq-1 prereq-2 prereq-1
Signature · 1 line
error compiling committee.c: too many arguments to function