Bug#627395: lua5.1-policy: wrong link order breaks 'ld --as-needed'

2011-05-23 Thread Enrico Tassi
On Fri, May 20, 2011 at 11:13:22AM +0100, Colin Watson wrote:
 https://bugs.launchpad.net/ubuntu/+source/lua-sec/+bug/770817 seems to
 me to be a lua5.1-policy bug.  As
 http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries
 says, a linker that uses --as-needed by default requires object files
 to appear before the libraries they use on the linker command line.
 
 The following patch moves libraries after objects (which is
 historically the right thing to do with Unix linkers anyway).  Could
 you please have a look and see if this is reasonable to merge?

I'm testing it right now, and I'll upload it ASAP.

Thanks for the patch, cheers
-- 
Enrico Tassi



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#627395: lua5.1-policy: wrong link order breaks 'ld --as-needed'

2011-05-20 Thread Colin Watson
Package: lua5.1-policy
Version: 30
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

https://bugs.launchpad.net/ubuntu/+source/lua-sec/+bug/770817 seems to
me to be a lua5.1-policy bug.  As
http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries
says, a linker that uses --as-needed by default requires object files to
appear before the libraries they use on the linker command line.

The following patch moves libraries after objects (which is historically
the right thing to do with Unix linkers anyway).  Could you please have
a look and see if this is reasonable to merge?

=== modified file 'templates/Makefile.Debian.single'
--- templates/Makefile.Debian.single2011-05-20 10:03:36 +
+++ templates/Makefile.Debian.single2011-05-20 10:11:54 +
@@ -230,22 +230,24 @@ $(LIBNAME).la $(LUA_MODNAME_PATH).so: $(
-rpath $(LUA_LPATH) -o $(LIBNAME).la \
-version-info $(VERSION_INFO) \
-Wl,--no-add-needed \
-   $(CLIB_LDFLAGS) $(CLIB_OBJS)
+   $(CLIB_OBJS) $(CLIB_LDFLAGS)
mkdir -p $(dir $(LUA_MODNAME_PATH))
ln -sf $(LUA_MODNAME_DOTS)./.libs/$(REALSO) $(LUA_MODNAME_PATH).so
 
 app static-stamp.$(PKG_NAME): $(C_TEST_FILE_STAMP) $(LIBNAME).la 
pre-static-link-hook 
rm -f dynamic-stamp.$(PKG_NAME)
$(LBTL) --mode=link $(CC) -Wall -O2 $(GCC_FLAGS) -Wl,--no-add-needed \
-   $(CLIB_LDFLAGS_STATIC) $(LUA_LBTL_S) -static -o app -I . \
-   $(C_TEST_FILE) $(LIBNAME).la
+   -static -o app -I . \
+   $(C_TEST_FILE) $(LIBNAME).la \
+   $(CLIB_LDFLAGS_STATIC) $(LUA_LBTL_S)
touch static-stamp.$(PKG_NAME)
 
 ./.libs/app dynamic-stamp.$(PKG_NAME): $(C_TEST_FILE_STAMP) $(LIBNAME).la 
pre-dynamic-link-hook 
rm -f static-stamp.$(PKG_NAME)
$(LBTL) --mode=link $(CC) -Wall -O2 $(GCC_FLAGS) -Wl,--no-add-needed \
-   $(CLIB_LDFLAGS) $(LUA_LBTL_D) -o app -I . \
-   $(C_TEST_FILE) $(LIBNAME).la
+   -o app -I . \
+   $(C_TEST_FILE) $(LIBNAME).la \
+   $(CLIB_LDFLAGS) $(LUA_LBTL_D)
touch dynamic-stamp.$(PKG_NAME)
 
 # }}}

Thanks,

-- 
Colin Watson   [cjwat...@ubuntu.com]



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org