2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-22 09:31:51 +00:00

[build] Fix erroneous object name in version object

Commit 8290a95 ("[build] Expose build timestamp, build name, and
product names") introduced a regression in the build process which
resulted in broken final binaries which had names based on object
files (e.g. "undionly.kpxe" or "intel.rom") rather than on device IDs
(e.g. "8086100e.mrom").

The underlying problem is the -DOBJECT=<name> macro which is used to
generate the obj_<name> symbols used to select objects required for
the final binary.  The macro definition is derived from the initial
portion (up to the first dot) of the object being built.  In the case
of e.g. undionly.kpxe.version.o, this gives -DOBJECT=undionly.  This
results in undionly.kpxe.version.o claiming to be the "undionly"
object; the real "undionly" object will therefore never get dragged in
to the build.

Fix by renaming $(BIN)/%.version.o to $(BIN)/version.%.o, so that the
object is always built with -DOBJECT=version (as might be expected,
since it is built from core/version.c).

Final binaries which have names based on device IDs (such as
"8086100e.mrom") are not affected by this problem, since the object
name "8086100e" will not conflict with that of the underlying "intel"
object.

This problem was not detected by the per-commit smoke testing
procedure, which happens to use the binary bin/8086100e.mrom.

Reported-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2014-06-26 16:25:18 +01:00
parent 0e3ab6064e
commit c2f0769338

View File

@ -998,7 +998,7 @@ BUILD_TIMESTAMP := $(shell date +%s)
# Build version
#
GIT_INDEX := $(if $(GITVERSION),$(if $(wildcard ../.git/index),../.git/index))
$(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
$(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
$(QM)$(ECHO) " [VERSION] $@"
$(Q)$(COMPILE_c) -DBUILD_NAME="\"$*\"" \
-DVERSION_MAJOR=$(VERSION_MAJOR) \
@ -1010,7 +1010,7 @@ $(BIN)/%.version.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
# Build an intermediate object file from the objects required for the
# specified target.
#
$(BIN)/%.tmp : $(BIN)/%.version.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
$(BIN)/%.tmp : $(BIN)/version.%.o $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
$(QM)$(ECHO) " [LD] $@"
$(Q)$(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $< $(BLIB) -o $@ \
--defsym _build_id=`$(BUILD_ID_CMD)` \