codegooglecom / libproxy

Automatically exported from code.google.com/p/libproxy
GNU Lesser General Public License v2.1
0 stars 0 forks source link

testsuite fails on symbollnk with -Wl,-as-needed #125

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The way the test suite is built at the moment is incompatible with 
-Wl,-as-needed.

symbollnk is being built linked to libz using -lz, but as no reference to libz 
is done from within the application (and any linked libraries), the reference 
to libz is stripped out.

There are two solutions to the problem:
- Have at least one call to a libz function within symbollnk program, to be 
sure the lib is not stripped
- Enforce that symbollnk is not linked with -Wl,-as-needed

(Thanks to stormer for the entire debug analysis and guidance)

Original issue reported on code.google.com by dominiqu...@gmail.com on 7 Jun 2010 at 9:07

GoogleCodeExporter commented 9 years ago
This patch snipplet would solve the problem.

Index: libmodman/test/CMakeLists.txt
===================================================================
--- libmodman/test/CMakeLists.txt   (revision 12)
+++ libmodman/test/CMakeLists.txt   (working copy)
@@ -28,6 +28,8 @@
     set_property(TARGET ${name} PROPERTY 
                  COMPILE_DEFINITIONS
                  EXTTYPE=${EXTTYPE}_extension;SYMB=1)
+    set_property(TARGET ${name} PROPERTY
+                 LINK_FLAGS -Wl,--no-as-needed)
   endif()
 endfunction(mm_create_program)

Any objections of pushing that to libproxy (and libmodman) source tree?

Original comment by dominiqu...@gmail.com on 23 Jun 2010 at 12:17

GoogleCodeExporter commented 9 years ago
If setting this overrides the -Wl,-as-needed, then I'm all for it (especially 
since it is limited to just the tests.

Original comment by npmccallum@gmail.com on 23 Jun 2010 at 12:22

GoogleCodeExporter commented 9 years ago
Yep, it overrides the as-needed for the testsuite, but only for cases where 
more than 2 args are passed to mm_create_program. So rather specialized when 
it's set.

I'll commit this to libmodman (external) and libmodman in libproxy tree in this 
case.

Original comment by dominiqu...@gmail.com on 23 Jun 2010 at 1:09

GoogleCodeExporter commented 9 years ago
Good for me, it's aligned with the way GCC options works too.

Original comment by nicolas.dufresne@gmail.com on 23 Jun 2010 at 3:01

GoogleCodeExporter commented 9 years ago
The fix has been commited (libproxy r705)

Original comment by dominiqu...@gmail.com on 23 Jun 2010 at 5:00

GoogleCodeExporter commented 9 years ago

Original comment by nicolas.dufresne@gmail.com on 19 Aug 2010 at 4:14