Mac OS: Fixed shared library symbol issues
authorSimon Wilkinson <sxw@your-file-system.com>
Wed, 18 Apr 2012 11:35:10 +0000 (12:35 +0100)
committerDerrick Brashear <shadow@dementix.org>
Thu, 19 Apr 2012 03:26:36 +0000 (20:26 -0700)
Some of our shared libraries (in particular, roken) build with different
symbols in them depending on the exact configuration options for a
particular platform. This means that not all of the symbols in the map
file may be present within the library. On Mac OS X we have been working
around this by using the "-flat_namespace,-undefined,suppress" linker
options.

However, with Lion this no longer works, as the linker still expects to
find the symbol in the library whose mapfile indicated that it was
present. So, for example, we end up with errors like:

dyld: Symbol not found: _errx
  Referenced from: openafs.git/tests/rx/../../src/tools/rxperf/rxperf
  Expected in: openafs.git/lib/librokenafs.dylib.1.1

... despite errx actually being provided by the system libraries.

The fix to this is to use the default two level namespace, and change
our behaviour for undefined symbols to 'dynamic_lookup', rather than
'suppress'

Change-Id: Ide37856198a8db3d42ee0a5261d097176bcc9301
Reviewed-on: http://gerrit.openafs.org/7242
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/config/shlib-build.in

index bb4bc99..c19e7d0 100644 (file)
@@ -152,7 +152,7 @@ hp_ux*)
        > $library.exp
        export="-Wl,-exported_symbols_list,$library.exp"
        if [ ! -z "$ignore" ] ; then
-           export="$export,-flat_namespace,-undefined,suppress"
+           export="$export,-undefined,dynamic_lookup"
        fi
     fi
     echo "$linker $export -o $filename $*"