aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin (Intel) <hpa@zytor.com>2019-03-25 15:13:10 -0700
committerH. Peter Anvin (Intel) <hpa@zytor.com>2019-03-25 15:13:10 -0700
commit4594aa8c83ac85c37ca82d6212250b3381db580c (patch)
tree63fb3b3663162aaf17981714c23629cce7b959f5
parent61da75a21b8086d90424fc5497aac8dc32df3ff5 (diff)
downloadsyslinux-wip.makefixes.tar.gz
syslinux-wip.makefixes.tar.xz
syslinux-wip.makefixes.zip
Further separating out per-architecture files; remove arch/ directorieswip.makefixes
More things we only want to build for certain architectures. Instead of the clumsy arch/ directories, add a list of architecture names so we can filter out non-applicable architectures. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
-rw-r--r--com32/lib/Makefile16
-rw-r--r--com32/lib/bios/i386/memcpy.c19
-rw-r--r--com32/lib/bios/i386/memset.c18
-rw-r--r--com32/lib/memcpy.c29
-rw-r--r--com32/lib/memset.c30
-rw-r--r--core/Makefile3
-rw-r--r--core/Makefile.efi2
-rw-r--r--core/efi/i386/linux.S (renamed from core/efi/arch/i386/linux.S)0
-rw-r--r--core/efi/i386/syslinux.ld (renamed from core/efi/arch/i386/syslinux.ld)0
-rw-r--r--core/efi/x86_64/linux.S (renamed from core/efi/arch/x86_64/linux.S)0
-rw-r--r--core/efi/x86_64/syslinux.ld (renamed from core/efi/arch/x86_64/syslinux.ld)0
-rw-r--r--mk/syslinux.mk6
12 files changed, 50 insertions, 73 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 5091e3fa..cef1636c 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -105,7 +105,7 @@ LIBCONSOLE_OBJS = \
LIBLOAD_OBJS = \
syslinux/addlist.o syslinux/freelist.o syslinux/memmap.o \
syslinux/movebits.o syslinux/shuffle.o syslinux/shuffle_pm.o \
- syslinux/shuffle_rm.o syslinux/biosboot.o syslinux/zonelist.o \
+ syslinux/shuffle_rm.o syslinux/zonelist.o \
syslinux/dump_mmap.o syslinux/dump_movelist.o \
\
syslinux/run_default.o syslinux/run_command.o \
@@ -113,7 +113,7 @@ LIBLOAD_OBJS = \
\
syslinux/loadfile.o syslinux/floadfile.o syslinux/zloadfile.o \
\
- syslinux/load_linux.o syslinux/initramfs.o \
+ syslinux/initramfs.o \
syslinux/initramfs_file.o syslinux/initramfs_loadfile.o \
syslinux/initramfs_archive.o
@@ -146,20 +146,14 @@ CORELIBOBJS = \
# Firmware-specific modules
FWSRCS := $(sort $(shell find '$(SRC)/$(fwclass)' \
- -name $(ARCH) -type d -true -o \
- -regex '.*/arch/[^/]+' -type d -prune -o \
- -type -f -print))
+ $(patsubst %,-name % -type d -prune -o,$(OTHERARCHES)) \
+ -type f -print))
FWCSRCS := $(filter %.c, $(FWSRCS))
FWSSRCS := $(filter %.S, $(FWSRCS))
-FWOBJS := $(FWCSRCS:%(SRC)/%.c=%.o) $(FWSSRCS:%(SRC)/%.S=%.o)
+FWOBJS := $(FWCSRCS:$(SRC)/%.c=%.o) $(FWSSRCS:$(SRC)/%.S=%.o)
CORELIBOBJS += $(FWOBJS)
-ifneq ($(FWCLASS),EFI)
-# For EFI, these are part of gnu-efi
-CORELIBOBJS += $(ARCH)/setjmp.o memcpy.o memset.o
-endif
-
## OPTIONAL OBJECTS, AVAILABLE AS DYNAMIC LINKED MODULES
# PNG library object files
LIBPNG_OBJS = \
diff --git a/com32/lib/bios/i386/memcpy.c b/com32/lib/bios/i386/memcpy.c
new file mode 100644
index 00000000..ee31b788
--- /dev/null
+++ b/com32/lib/bios/i386/memcpy.c
@@ -0,0 +1,19 @@
+/*
+ * memcpy.c
+ */
+
+#include <string.h>
+#include <stdint.h>
+
+void *memcpy(void *dst, const void *src, size_t n)
+{
+ const char *p = src;
+ char *q = dst;
+ size_t nl = n >> 2;
+
+ asm volatile ("rep movsl ; movl %3,%0 ; rep movsb"
+ : "+c" (nl), "+S" (p), "+D" (q)
+ : "r" (n & 3));
+
+ return dst;
+}
diff --git a/com32/lib/bios/i386/memset.c b/com32/lib/bios/i386/memset.c
new file mode 100644
index 00000000..4fb0735b
--- /dev/null
+++ b/com32/lib/bios/i386/memset.c
@@ -0,0 +1,18 @@
+/*
+ * memset.c
+ */
+
+#include <string.h>
+#include <stdint.h>
+
+void *memset(void *dst, int c, size_t n)
+{
+ char *q = dst;
+ size_t nl = n >> 2;
+
+ asm volatile ("rep stosl ; movl %3,%0 ; rep stosb"
+ : "+c" (nl), "+D" (q)
+ : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3));
+
+ return dst;
+}
diff --git a/com32/lib/memcpy.c b/com32/lib/memcpy.c
deleted file mode 100644
index 5ce206d0..00000000
--- a/com32/lib/memcpy.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * memcpy.c
- */
-
-#include <string.h>
-#include <stdint.h>
-
-void *memcpy(void *dst, const void *src, size_t n)
-{
- const char *p = src;
- char *q = dst;
-#if defined(__i386__)
- size_t nl = n >> 2;
- asm volatile ("cld ; rep ; movsl ; movl %3,%0 ; rep ; movsb":"+c" (nl),
- "+S"(p), "+D"(q)
- :"r"(n & 3));
-#elif defined(__x86_64__)
- size_t nq = n >> 3;
- asm volatile ("cld ; rep ; movsq ; movl %3,%%ecx ; rep ; movsb":"+c"
- (nq), "+S"(p), "+D"(q)
- :"r"((uint32_t) (n & 7)));
-#else
- while (n--) {
- *q++ = *p++;
- }
-#endif
-
- return dst;
-}
diff --git a/com32/lib/memset.c b/com32/lib/memset.c
deleted file mode 100644
index aa00b5b1..00000000
--- a/com32/lib/memset.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * memset.c
- */
-
-#include <string.h>
-#include <stdint.h>
-
-void *memset(void *dst, int c, size_t n)
-{
- char *q = dst;
-
-#if defined(__i386__)
- size_t nl = n >> 2;
- asm volatile ("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb"
- : "+c" (nl), "+D" (q)
- : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3));
-#elif defined(__x86_64__)
- size_t nq = n >> 3;
- asm volatile ("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb"
- :"+c" (nq), "+D" (q)
- : "a" ((unsigned char)c * 0x0101010101010101U),
- "r" ((uint32_t) n & 7));
-#else
- while (n--) {
- *q++ = c;
- }
-#endif
-
- return dst;
-}
diff --git a/core/Makefile b/core/Makefile
index 2f5cac5f..705be47a 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -40,8 +40,7 @@ PREPCORE = $(objdir)/prepcore/$(fwclass)/prepcore
# All primary source files for the main syslinux files
SRCFILES := $(sort $(shell find $(SRCDIRS:%=$(SRC)/%) \
-name tests -type d -prune -o \
- -name $(ARCH) -type d -true -o \
- -regex '.*/arch/[^/]+' -type d -prune -o \
+ $(patsubst %,-name % -type d -prune -o, $(OTHERARCHES)) \
-type f -print))
NASMSRC := $(filter %.asm,$(SRCFILES))
NASMHDR := $(filter %.inc,$(SRCFILES))
diff --git a/core/Makefile.efi b/core/Makefile.efi
index 7b1db7a4..f6f34376 100644
--- a/core/Makefile.efi
+++ b/core/Makefile.efi
@@ -34,7 +34,7 @@ CFLAGS += $(DATE_DEFS)
syslinux.efi: efi/syslinux.elf $(PREPCORE)
$(PREPCORE) $< $@
-CORELDSCRIPT = $(SRC)/efi/arch/$(ARCH)/syslinux.ld
+CORELDSCRIPT = $(SRC)/efi/$(ARCH)/syslinux.ld
$(ETARGET): $(CORE_LIB) $(CORE_LIBS) $(CORELDSCRIPT)
$(LD) $(CORELDFLAGS) --strip-debug -o $@ \
diff --git a/core/efi/arch/i386/linux.S b/core/efi/i386/linux.S
index 4049ad4d..4049ad4d 100644
--- a/core/efi/arch/i386/linux.S
+++ b/core/efi/i386/linux.S
diff --git a/core/efi/arch/i386/syslinux.ld b/core/efi/i386/syslinux.ld
index bab3fc74..bab3fc74 100644
--- a/core/efi/arch/i386/syslinux.ld
+++ b/core/efi/i386/syslinux.ld
diff --git a/core/efi/arch/x86_64/linux.S b/core/efi/x86_64/linux.S
index 29dde94a..29dde94a 100644
--- a/core/efi/arch/x86_64/linux.S
+++ b/core/efi/x86_64/linux.S
diff --git a/core/efi/arch/x86_64/syslinux.ld b/core/efi/x86_64/syslinux.ld
index 450641c6..450641c6 100644
--- a/core/efi/arch/x86_64/syslinux.ld
+++ b/core/efi/x86_64/syslinux.ld
diff --git a/mk/syslinux.mk b/mk/syslinux.mk
index bf0c4310..92c5ebc4 100644
--- a/mk/syslinux.mk
+++ b/mk/syslinux.mk
@@ -77,6 +77,12 @@ WGET = wget
CC_FOR_BUILD ?= $(CC)
+# All supported CPU architectures
+ARCHLIST := i386 x86_64
+
+# The architectures we are not currently building for
+OTHERARCHES := $(filter-out $(ARCH),$(ARCHLIST))
+
com32 = $(topdir)/com32
# Architecture definition