aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-02-27 18:52:11 +0000
committerMichael Brown <mcb30@ipxe.org>2021-02-27 19:25:02 +0000
commit040cdd0c658a49694b17a1c0b5439d0bd7805242 (patch)
treeffbc77fab80b81a804d28fd7a36fe114c06746f0
parent16d95227a4b92bba068b43070545b96ce0a90e14 (diff)
downloadipxe-040cdd0c658a49694b17a1c0b5439d0bd7805242.zip
ipxe-040cdd0c658a49694b17a1c0b5439d0bd7805242.tar.gz
ipxe-040cdd0c658a49694b17a1c0b5439d0bd7805242.tar.bz2
[linux] Add a prefix to all symbols to avoid future name collisions
Allow for the possibility of linking to platform libraries for the Linux userspace build by adding an iPXE-specific symbol prefix. Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/Makefile1
-rw-r--r--src/Makefile.housekeeping7
-rw-r--r--src/arch/x86/Makefile.linux2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index 60be873..69139dc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -10,6 +10,7 @@ LDFLAGS :=
HOST_CFLAGS :=
MAKEDEPS := Makefile
CROSS_COMPILE ?= $(CROSS)
+SYMBOL_PREFIX :=
###############################################################################
#
diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index 2c2c8a1..e017c65 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -1102,9 +1102,10 @@ TGT_LD_ENTRY = _$(TGT_PREFIX)_start
#
TGT_LD_FLAGS = $(foreach SYM,$(TGT_LD_ENTRY) $(TGT_LD_DRIVERS) \
$(TGT_LD_DEVLIST) obj_config obj_config_$(PLATFORM),\
- -u $(SYM) --defsym check_$(SYM)=$(SYM) ) \
+ -u $(SYMBOL_PREFIX)$(SYM) \
+ --defsym check_$(SYM)=$(SYMBOL_PREFIX)$(SYM) ) \
$(patsubst %,--defsym %,$(TGT_LD_IDS)) \
- -e $(TGT_LD_ENTRY)
+ -e $(SYMBOL_PREFIX)$(TGT_LD_ENTRY)
# Calculate list of debugging versions of objects to be included in
# the target.
@@ -1166,6 +1167,7 @@ $(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS)
$(Q)$(RM) $(BLIB)
$(QM)$(ECHO) " [AR] $@"
$(Q)$(AR) rD $@ $(sort $(BLIB_OBJS))
+ $(Q)$(OBJCOPY) --prefix-symbols=$(SYMBOL_PREFIX) $@
$(Q)$(RANLIB) -D $@
blib : $(BLIB)
@@ -1207,6 +1209,7 @@ $(BIN)/version.%.o : core/version.c $(MAKEDEPS) $(GIT_INDEX)
-DVERSION_PATCH=$(VERSION_PATCH) \
-DVERSION="\"$(VERSION)\"" \
-c $< -o $@
+ $(Q)$(OBJCOPY) --prefix-symbols=$(SYMBOL_PREFIX) $@
# Build an intermediate object file from the objects required for the
# specified target.
diff --git a/src/arch/x86/Makefile.linux b/src/arch/x86/Makefile.linux
index 1faf847..3740cc8 100644
--- a/src/arch/x86/Makefile.linux
+++ b/src/arch/x86/Makefile.linux
@@ -3,6 +3,8 @@ MEDIA = linux
# enable valgrind
CFLAGS += -UNVALGRIND
+SYMBOL_PREFIX = _ipxe__
+
INCDIRS += arch/x86/include/linux
SRCDIRS += interface/linux
SRCDIRS += drivers/linux