[syslinux:elflink] com32: Per-object file LDFLAGS

syslinux-bot for Matt Fleming matt.fleming at intel.com
Tue Jun 26 09:54:08 PDT 2012


Commit-ID:  fb543aa635ff117187c73ce0ae3dccf8ffe32161
Gitweb:     http://www.syslinux.org/commit/fb543aa635ff117187c73ce0ae3dccf8ffe32161
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Wed, 13 Jun 2012 09:23:13 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 20 Jun 2012 16:34:42 +0100

com32: Per-object file LDFLAGS

Some object files need to link against the ELF libraries. Allow them
to be specified with the following syntax in the Makefiles,

     LDFLAGS_$(object_file) = $(LIBS)

By adding libraries in this way DT_NEEDED entries are created in the
ELF modules and the required library dependencies are automatically
loaded before running the module.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/cmenu/Makefile   |   17 +++++++++++++++--
 com32/hdt/Makefile     |    3 +++
 com32/modules/Makefile |   15 +++++++++++++++
 com32/rosh/Makefile    |    2 ++
 com32/samples/Makefile |    3 +++
 mk/elf.mk              |    2 +-
 6 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index 00825b4..40a09d1 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -26,13 +26,26 @@ include $(MAKEDIR)/elf.mk
 
 CFLAGS	  += -I./libmenu
 
+LDFLAGS_complex.o = $(com32)/cmenu/libmenu/libmenu.c32 \
+		    $(com32)/libutil/libutil_com.c32 \
+		    $(com32)/lib/libcom32.c32
+LDFLAGS_display.o = $(com32)/cmenu/libmenu/libmenu.c32 \
+		$(com32)/libutil/libutil_com.c32 \
+		$(com32)/lib/libcom32.c32
+LDFLAGS_simple.o = $(com32)/cmenu/libmenu/libmenu.c32 \
+		   $(com32)/libutil/libutil_com.c32 \
+		   $(com32)/lib/libcom32.c32
+LDFLAGS_test.o = $(com32)/cmenu/libmenu/libmenu.c32
+LDFLAGS_test2.o = $(com32)/cmenu/libmenu/libmenu.c32
+
 LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
-	libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
+	libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o \
+	$(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
 
 CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
 IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
 
-MENUS = $(CMENUS) $(IMENUS) $(LIBS)
+MENUS = $(LIBS) $(CMENUS) $(IMENUS)
 
 .SUFFIXES: .S .c .o .elf .c32 .menu
 
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 36206cd..ff0fa2e 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -20,6 +20,9 @@ MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/elf.mk
 
 LIBS      = ../libupload/libcom32upload.a
+C_LIBS    += $(com32)/cmenu/libmenu/libmenu.c32 \
+	     $(com32)/libutil/libutil_com.c32 \
+	     $(com32)/lib/libcom32.c32 $(com32)/gpllib/libcom32gpl.c32
 CFLAGS    += -I$(com32)/cmenu/libmenu -I$(com32)
 
 MODULES	  = hdt.c32
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 017d6db..8d94cfe 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -28,6 +28,21 @@ MODULES	  = config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \
 
 TESTFILES =
 
+LDFLAGS_cpuidtest.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_disk.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_ethersel.o = $(com32)/lib/libcom32.c32
+LDFLAGS_gpxecmd.o = $(com32)/lib/libcom32.c32
+LDFLAGS_host.o = $(com32)/lib/libcom32.c32
+LDFLAGS_ifcpu.o = $(com32)/libutil/libutil_com.c32 \
+		  $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_kbdmap.o = $(com32)/lib/libcom32.c32
+LDFLAGS_linux.o = $(com32)/lib/libcom32.c32
+LDFLAGS_pxechn.o = $(com32)/lib/libcom32.c32 \
+	$(com32)/libutil/libutil_com.c32
+LDFLAGS_sanboot.o = $(com32)/lib/libcom32.c32
+LDFLAGS_vpdtest.o = $(com32)/gpllib/libcom32gpl.c32
+LDFLAGS_zzjson.o = $(com32)/gpllib/libcom32gpl.c32
+
 all: $(MODULES) $(TESTFILES)
 
 .PRECIOUS: %.o
diff --git a/com32/rosh/Makefile b/com32/rosh/Makefile
index 766f68d..f328395 100644
--- a/com32/rosh/Makefile
+++ b/com32/rosh/Makefile
@@ -34,6 +34,8 @@ endif
 CFLAGS		+= -DDATE='"$(DATE)"'
 LNXCFLAGS	+= -DDATE='"$(DATE)"'
 
+LDFLAGS_rosh.o = $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
+
 rosh.o:	rosh.h
 
 rosh.lo:	rosh.h
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index 167c638..bca197e 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -18,6 +18,9 @@ topdir = ../..
 MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/elf.mk
 
+LDFLAGS_fancyhello.o = $(com32)/libutil/libutil_com.c32
+LDFLAGS_keytest.o = $(com32)/libutil/libutil_com.c32
+
 all:	hello.c32 resolv.c32 serialinfo.c32 \
 	localboot.c32 \
 	fancyhello.c32 fancyhello.lnx \
diff --git a/mk/elf.mk b/mk/elf.mk
index 5242b2d..ea4344d 100644
--- a/mk/elf.mk
+++ b/mk/elf.mk
@@ -82,4 +82,4 @@ C_LNXLIBS  = $(com32)/libutil/libutil_lnx.a \
 	$(CC) $(LNXCFLAGS) -o $@ $^
 
 %.c32: %.o
-	$(LD) $(LDFLAGS) -o $@ $^
+	$(LD) $(LDFLAGS_$^) $(LDFLAGS) -o $@ $^


More information about the Syslinux-commits mailing list