Hello, I recently built FLAC 0.10 in NetBSD 1.5 i386 and had to make minor changes to the build configuration. Thanks for the awesome software! libtool would not link the "plain" nasm-generated object files for the i386 assembly optimizations. I've patched src/libFLAC/i386/Makefile.am to operate similarly to the automake file used for the SDL assembly routines. I saw a post to the FLAC mailing list saying that automake expects the suffix to be .s, so .nasm files were renamed to .s files. automake can be told to accept other suffixes using the SUFFIXES variable. libtool recognizes files with .asm suffixes, so I renamed .s files to .asm files. The first two patches cause libtool to generate the object files for the i386 assembly optimizations. The third patch fixes a linking bug for the xmms plugin. (does the xmms plugin link out-of-the-box on other platforms?) --- src/libFLAC/i386/Makefile.am.orig Thu May 24 12:28:48 2001 +++ src/libFLAC/i386/Makefile.am @@ -1,9 +1,15 @@ # nasm build rule: -%.lo: %.s - $(NASM) -f elf -d ELF $< -o $@ + +STRIP_FPIC = sh $(top_srcdir)/strip_fPIC.sh + +SUFFIXES = .asm + +.asm.lo: + $(LIBTOOL) --tag=CC --mode=compile \ + $(STRIP_FPIC) $(NASM) -f elf -d ELF $< noinst_LTLIBRARIES = libFLAC-asm.la libFLAC_asm_la_SOURCES = \ - cpu_asm.s \ - fixed_asm.s \ - lpc_asm.s + cpu_asm.asm \ + fixed_asm.asm \ + lpc_asm.asm --- strip_fPIC.sh.orig Sun Jul 8 22:06:23 2001 +++ strip_fPIC.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# +# libtool assumes that the compiler can handle the -fPIC flag +# This isn't always true (for example, nasm can't handle it) +command="" +while [ $1 ]; do + if [ "$1" != "-fPIC" ]; then + if [ "$1" != "-DPIC" ]; then + command="$command $1" + fi + fi + shift +done +echo $command +exec $command --- src/plugin_xmms/Makefile.am.orig Fri Jan 19 12:48:18 2001 +++ src/plugin_xmms/Makefile.am @@ -9,5 +9,5 @@ xmmsinputplugin_LTLIBRARIES = libxmms-flac.la libxmms_flac_la_SOURCES = plugin.c -libxmms_flac_la_LIBADD = -L$(top_builddir)/src/libFLAC/.libs -lFLAC @XMMS_LIBS@ +libxmms_flac_la_LIBADD = -L$(top_builddir)/src/libFLAC -lFLAC @XMMS_LIBS@ libxmms_flac_la_LDFLAGS = -module -avoid-version
> libtool would not link the "plain" nasm-generated object files for > the i386 > assembly optimizations. I've patched src/libFLAC/i386/Makefile.am to > operate similarly to the automake file used for the SDL assembly > routines. > > ... > > The first two patches cause libtool to generate the object files for > the > i386 assembly optimizations. The third patch fixes a linking bug for > the > xmms plugin. (does the xmms plugin link out-of-the-box on other > platforms?)OK, I applied the first two patches. Like Matt said, the third was already fixed in CVS. Thanks. Josh __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/
On Mon, Jul 09, 2001 at 11:26:56AM -0700, collver@linuxfreemail.com wrote:> libtool would not link the "plain" nasm-generated object files for the i386 > assembly optimizations. I've patched src/libFLAC/i386/Makefile.am to operate > similarly to the automake file used for the SDL assembly routines. > > I saw a post to the FLAC mailing list saying that automake expects the suffix > to be .s, so .nasm files were renamed to .s files. automake can be told to > accept other suffixes using the SUFFIXES variable. libtool recognizes files > with .asm suffixes, so I renamed .s files to .asm files.Unfortunately, there is a bigger problem that affects both SDL and FLAC, which is that the assembly routines are not PIC. This is already causing problems for SDL on ia64 for Debian, where gcc refuses to link non-PIC code into a shared library. Either the assembly code must be made position-independent, or it must be excluded from the shared library somehow.> The first two patches cause libtool to generate the object files for the > i386 assembly optimizations. The third patch fixes a linking bug for the > xmms plugin. (does the xmms plugin link out-of-the-box on other platforms?)That is a bug; in fact, the correct thing is to specify the path to the .la file, and not use -l at all. This is fixed in current CVS. -- - mdz
> > libtool would not link the "plain" nasm-generated object files for > > the i386 > > assembly optimizations. I've patched src/libFLAC/i386/Makefile.am > > to operate > > similarly to the automake file used for the SDL assembly routines. > > > > I saw a post to the FLAC mailing list saying that automake expects > > the suffix > > to be .s, so .nasm files were renamed to .s files. automake can be > > told to > > accept other suffixes using the SUFFIXES variable. libtool > > recognizes files > > with .asm suffixes, so I renamed .s files to .asm files. > > Unfortunately, there is a bigger problem that affects both SDL and > FLAC, which > is that the assembly routines are not PIC.It's not? I think all the IA32 code only references data on the stack, and it doesn't call outside the library or export any functions outside the library. The only absolute addresses should be the routine entry points private to the library which I thought were always relocatable. Josh __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/