[syslinux:elflink] com32: Use --as-needed for LDFLAGS

syslinux-bot for Matt Fleming matt.fleming at intel.com
Tue Aug 14 09:21:07 PDT 2012


Commit-ID:  5c88d800a5d612ceb2339476c544f09410b5a454
Gitweb:     http://www.syslinux.org/commit/5c88d800a5d612ceb2339476c544f09410b5a454
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Thu, 12 Jul 2012 20:35:14 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Fri, 20 Jul 2012 17:55:14 +0100

com32: Use --as-needed for LDFLAGS

This extends commit 4678fd92a21e ("elflink: fix dependency problem in
cmenu/Makefile") and basically reverts commit fb543aa635ff ("com32:
Per-object file LDFLAGS"). By using the --as-needed ld argument we can
specify all the required shared libraries for a directory, even if not
all of the libraries are needed by every .c32 file. --as-needed takes
care of only creating DT_NEEDED entries for the shared libraries that
are actually required to resolve undefined symbols in a given module.

Furthermore, by using $(LIBS) we create a dependency between .c32
files and their shared libraries, which allows multiple make jobs to
run in parallel.

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

---
 com32/cmenu/Makefile   |    8 ++++----
 com32/modules/Makefile |   18 +++---------------
 com32/rosh/Makefile    |    4 ++--
 com32/samples/Makefile |    5 ++---
 mk/elf.mk              |    2 +-
 5 files changed, 12 insertions(+), 25 deletions(-)

diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index c6e0cae..beb8dd2 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -17,16 +17,16 @@
 
 NOGPL := 1
 
+LIBS  = libmenu/libmenu.c32 \
+        $(com32)/libutil/libutil_com.c32 \
+        $(com32)/lib/libcom32.c32
+
 topdir = ../..
 MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/elf.mk
 
 CFLAGS	  += -I./libmenu
 
-LIBS  = libmenu/libmenu.c32 \
-        $(com32)/libutil/libutil_com.c32 \
-        $(com32)/lib/libcom32.c32
-
 LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
 	libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o \
 	$(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 8d94cfe..8f5b769 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -15,6 +15,9 @@
 ## COM32 standard modules
 ##
 
+LIBS = $(com32)/gpllib/libcom32gpl.c32 $(com32)/lib/libcom32.c32 \
+	$(com32)/libutil/libutil_com.c32
+
 topdir = ../..
 MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/elf.mk
@@ -28,21 +31,6 @@ 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 f328395..a894c84 100644
--- a/com32/rosh/Makefile
+++ b/com32/rosh/Makefile
@@ -16,6 +16,8 @@
 ## ROSH Read Only Shell
 ##
 
+LIBS = $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
+
 topdir = ../..
 MAKEDIR = $(topdir)/mk
 include $(MAKEDIR)/rosh.mk
@@ -34,8 +36,6 @@ 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 bca197e..c7abadd 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -14,13 +14,12 @@
 ## samples for syslinux users
 ##
 
+LIBS = $(com32)/libutil/libutil_com.c32
+
 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 bc2948a..4e76c71 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 $(LIBS)
-	$(LD) $(LDFLAGS_$^) $(LDFLAGS) -o $@ $^
+	$(LD) $(LDFLAGS) -o $@ $^


More information about the Syslinux-commits mailing list