Makefile: move all non-main objects into libnasm.a

There is no fundamental reason for all objects that don't contain a
main() function to not be part of libnasm.a; this allows the linker to
do its job optimally, especially in the presence of debugging code
which may not be needed under normal conditions.

If we do end up with function name conflicts the library might have to
be split, but it would be better to simply avoid that case.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
H. Peter Anvin 2017-02-28 18:08:21 -08:00
parent 87646096a9
commit 4d58a8fef5
5 changed files with 110 additions and 100 deletions

View File

@ -85,7 +85,25 @@ endif
$(XMLTO) man --skip-validation $< 2>/dev/null
#-- Begin File Lists --#
NASM = asm/nasm.$(O) \
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O) \
\
asm/float.$(O) \
asm/directiv.$(O) \
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
@ -105,25 +123,9 @@ NASM = asm/nasm.$(O) \
output/outelf.$(O) \
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
output/codeview.$(O)
NDISASM = disasm/ndisasm.$(O) disasm/disasm.$(O) disasm/sync.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O)
output/codeview.$(O) \
\
disasm/disasm.$(O) disasm/sync.$(O)
#-- End File Lists --#
all: nasm$(X) ndisasm$(X) rdf

View File

@ -53,7 +53,25 @@ X = .exe
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm/nasm.$(O) \
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O) \
\
asm/float.$(O) \
asm/directiv.$(O) \
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
@ -73,25 +91,9 @@ NASM = asm/nasm.$(O) \
output/outelf.$(O) \
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
output/codeview.$(O)
NDISASM = disasm/ndisasm.$(O) disasm/disasm.$(O) disasm/sync.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O)
output/codeview.$(O) \
\
disasm/disasm.$(O) disasm/sync.$(O)
#-- End File Lists --#
all: nasm$(X) ndisasm$(X)

View File

@ -30,7 +30,25 @@ O = o
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = nasm.o \
NASM = nasm.o
NDISASM = ndisasm.o
LIBOBJ = snprintf.o vsnprintf.o strlcpy.o \
strnlen.o \
ver.o \
crc64.o malloc.o \
error.o md5c.o string.o \
file.o mmap.o ilog2.o \
realpath.o filename.o srcfile.o \
zerobuf.o readnum.o bsi.o \
rbtree.o hashtbl.o \
raa.o saa.o \
strlist.o \
common.o \
insnsa.o insnsb.o insnsd.o insnsn.o \
regs.o regvals.o regflags.o regdis.o \
disp8.o iflag.o \
\
float.o \
directiv.o \
assemble.o labels.o parser.o \
@ -50,25 +68,9 @@ NASM = nasm.o \
outelf.o \
outobj.o outas86.o outrdf2.o \
outdbg.o outieee.o outmacho.o \
codeview.o
NDISASM = ndisasm.o disasm.o sync.o
LIBOBJ = snprintf.o vsnprintf.o strlcpy.o \
strnlen.o \
ver.o \
crc64.o malloc.o \
error.o md5c.o string.o \
file.o mmap.o ilog2.o \
realpath.o filename.o srcfile.o \
zerobuf.o readnum.o bsi.o \
rbtree.o hashtbl.o \
raa.o saa.o \
strlist.o \
common.o \
insnsa.o insnsb.o insnsd.o insnsn.o \
regs.o regvals.o regflags.o regdis.o \
disp8.o iflag.o
codeview.o \
\
disasm.o sync.o
#-- End File Lists --#
NASM_OBJ = $(addprefix $(OBJDIR)/,$(notdir $(NASM))) $(EOLIST)

View File

@ -46,7 +46,25 @@ X = .exe
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm/nasm.$(O) &
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) &
stdlib/strnlen.$(O) &
nasmlib/ver.$(O) &
nasmlib/crc64.$(O) nasmlib/malloc.$(O) &
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) &
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) &
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) &
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) &
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) &
nasmlib/raa.$(O) nasmlib/saa.$(O) &
nasmlib/strlist.$(O) &
common/common.$(O) &
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) &
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) &
x86/disp8.$(O) x86/iflag.$(O) &
&
asm/float.$(O) &
asm/directiv.$(O) &
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) &
@ -66,25 +84,9 @@ NASM = asm/nasm.$(O) &
output/outelf.$(O) &
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) &
output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) &
output/codeview.$(O)
NDISASM = disasm/ndisasm.$(O) disasm/disasm.$(O) disasm/sync.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) &
stdlib/strnlen.$(O) &
nasmlib/ver.$(O) &
nasmlib/crc64.$(O) nasmlib/malloc.$(O) &
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) &
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) &
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) &
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) &
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) &
nasmlib/raa.$(O) nasmlib/saa.$(O) &
nasmlib/strlist.$(O) &
common/common.$(O) &
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) &
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) &
x86/disp8.$(O) x86/iflag.$(O)
output/codeview.$(O) &
&
disasm/disasm.$(O) disasm/sync.$(O)
#-- End File Lists --#
what: .SYMBOLIC

View File

@ -57,7 +57,25 @@ X = .exe
#-- Begin File Lists --#
# Edit in Makefile.in, not here!
NASM = asm/nasm.$(O) \
NASM = asm/nasm.$(O)
NDISASM = disasm/ndisasm.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O) \
\
asm/float.$(O) \
asm/directiv.$(O) \
asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
@ -77,25 +95,9 @@ NASM = asm/nasm.$(O) \
output/outelf.$(O) \
output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
output/codeview.$(O)
NDISASM = disasm/ndisasm.$(O) disasm/disasm.$(O) disasm/sync.$(O)
LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) \
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/malloc.$(O) \
nasmlib/error.$(O) nasmlib/md5c.$(O) nasmlib/string.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
nasmlib/raa.$(O) nasmlib/saa.$(O) \
nasmlib/strlist.$(O) \
common/common.$(O) \
x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
x86/disp8.$(O) x86/iflag.$(O)
output/codeview.$(O) \
\
disasm/disasm.$(O) disasm/sync.$(O)
#-- End File Lists --#
what: