[syslinux] [PATCH 08/20] com32: Put deleted object files back into the Makefile

Matt Fleming matt at console-pimps.org
Sat Apr 16 07:17:36 PDT 2011


From: Matt Fleming <matt.fleming at linux.intel.com>

For some reason that I can't understand, some object files were
removed from this Makefile in the following commit,

    |commit 0cb6490fa96f752c01bbb9add2c9ca6dbf99ece2
    |Author: Feng Tang <feng.tang at intel.com>
    |Date:   Thu Jun 3 10:48:22 2010 +0800
    |
    |   elflink: start merge with pathbased branch
    |
    |   modify these files to make compile pass
    |
    |       modified:   com32/MCONFIG
    |       modified:   com32/Makefile
    |       modified:   com32/include/klibc/compiler.h
    |       modified:   com32/include/sys/elfcommon.h
    |       modified:   com32/lib/Makefile
    |       modified:   com32/lib/free.c
    |       modified:   com32/lib/malloc.c

However, with this patch things continue to compile correctly so I'm
unsure why they were ever removed. Furthermore, pieces of code in
com32/ refer to symbols defined in these these object files and so
they are required in order to load modules.

These missing object files were discovered when loading libcom32.c32,
which wouldn't load because it was complaining about unresolved
symbols.

The removal of core/strncasecmp.c needs some explanation. There are
currently two identical copies of strncasecmp.c, one in com32/lib and
one in core/, and while the core copy is part of core/libcom32.a, the
copy in com32/lib isn't compiled. Now, because there are no references
to strncasecmp within core/ the symbol isn't pulled in from libcom32.a
and exported as a global symbol by the core. So, if ELF modules have
references to strncasecmp they cannot be resolved at runtime.

To fix this I've included strncasecmp.o in libcom32min.a which
isolinux.elf, ldlinux.elf and pxelinux.elf link against with
--whole-archive, which means that even if there are no references to
strncasecmp within the core, that symbol is still exported.

Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
 com32/lib/Makefile |   15 ++++++++++++---
 core/strncasecmp.c |   24 ------------------------
 2 files changed, 12 insertions(+), 27 deletions(-)
 delete mode 100644 core/strncasecmp.c

diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 7a0474b..f5c7f5b 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -33,7 +33,11 @@ LIBJPG_OBJS = \
 LIBVESA_OBJS = \
 	sys/vesacon_write.o sys/vesaserial_write.o			\
 	sys/vesa/initvesa.o sys/vesa/drawtxt.o	sys/vesa/background.o	\
-	sys/vesa/alphatbl.o sys/vesa/screencpy.o sys/vesa/fmtpixel.o
+	sys/vesa/alphatbl.o sys/vesa/screencpy.o sys/vesa/fmtpixel.o	\
+	sys/vesa/i915resolution.o
+
+LIBMISC_OBJS = \
+	sys/libansi.o sys/gpxe.o
 
 LIBPCI_OBJS = \
 	pci/cfgtype.o pci/scan.o pci/bios.o				\
@@ -45,8 +49,11 @@ LIBSYSLINUX_OBJS = \
 	syslinux/features.o syslinux/config.o	\
 	syslinux/ipappend.o syslinux/dsinfo.o syslinux/version.o	\
 	syslinux/pxe_get_cached.o syslinux/pxe_get_nic.o		\
+	syslinux/pxe_dns.o						\
 	syslinux/adv.o syslinux/advwrite.o syslinux/getadv.o		\
-	syslinux/setadv.o
+	syslinux/setadv.o						\
+	syslinux/video/fontquery.o syslinux/video/forcetext.o		\
+	syslinux/video/reportmode.o
 
 LIBLOAD_OBJS = \
 	syslinux/addlist.o syslinux/freelist.o syslinux/memmap.o	\
@@ -69,7 +76,7 @@ DYNENTRY_OBJS = \
 ## CORE OBJECTS, INCLUDED IN THE ROOT COM32 MODULE
 LIBENTRY_OBJS = \
 	sys/intcall.o sys/farcall.o sys/cfarcall.o sys/zeroregs.o	\
-	sys/argv.o							\
+	sys/argv.o sys/sleep.o						\
 	sys/fileinfo.o sys/opendev.o sys/read.o sys/write.o sys/ftell.o \
 	sys/close.o sys/open.o sys/fileread.o sys/fileclose.o		\
 	sys/openmem.o					\
@@ -120,6 +127,7 @@ LIBOTHER_OBJS = \
 	strchr.o strcmp.o strcpy.o strdup.o strerror.o strlen.o		\
 	strnlen.o							\
 	strncat.o strncmp.o strncpy.o strndup.o		\
+	strncasecmp.o							\
 	stpcpy.o stpncpy.o						\
 	strntoimax.o strntoumax.o strrchr.o strsep.o strspn.o strstr.o	\
 	strtoimax.o strtok.o strtol.o strtoll.o strtoul.o strtoull.o	\
@@ -181,6 +189,7 @@ DYNLIBOBJS = \
 	$(LIBVESA_OBJS) \
 	$(LIBSYSLINUX_OBJS) \
 	$(LIBLOAD_OBJS) \
+	$(LIBMISC_OBJS) \
 	$(DYNENTRY_OBJS)
 
 
diff --git a/core/strncasecmp.c b/core/strncasecmp.c
deleted file mode 100644
index 2caac0a..0000000
--- a/core/strncasecmp.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * strncasecmp.c
- */
-
-#include <string.h>
-#include <ctype.h>
-
-int strncasecmp(const char *s1, const char *s2, size_t n)
-{
-    const unsigned char *c1 = (const unsigned char *)s1;
-    const unsigned char *c2 = (const unsigned char *)s2;
-    unsigned char ch;
-    int d = 0;
-
-    while (n--) {
-	/* toupper() expects an unsigned char (implicitly cast to int)
-	   as input, and returns an int, which is exactly what we want. */
-	d = toupper(ch = *c1++) - toupper(*c2++);
-	if (d || !ch)
-	    break;
-    }
-
-    return d;
-}
-- 
1.7.4.2




More information about the Syslinux mailing list