On Thu, Oct 14, 2010 at 23:53, Jeff Squyres <jsquyres_at_[hidden]> wrote:
> The configure test essentially looks like this -- could you try this
> manually and see what happens?
>
> cat > conftest_weak.h <<EOF
> int real(int i);
> int fake(int i);
> EOF
>
> cat > conftest_weak.c <<EOF
> #include "conftest_weak.h"
> #pragma weak fake = real
> int real(int i) { return i; }
> EOF
>
> cat > conftest.c <<EOF
> #include "conftest_weak.h"
> int main() { return fake(3); }
> EOF
>
> # Try the compile
> clang $CFLAGS -c conftest_weak.c
> clang $CFLAGS conftest.c conftest_weak.o -o conftest $LDFLAGS $LIBS
>
> The configure test rules that weak symbol support is there if both compiler
> invocations return an exit status of 0.
>
They exit 0 and
$ nm conftest |g 'real|fake'
00000000004004a0 W fake
00000000004004a0 T real
so it looks like that is working fine. It also works fine when I stuff it
into a shared library:
$ clang -c -fPIC conftest_weak.c
$ clang -shared -fPIC conftest.c conftest_weak.o -o conftest.so
$ nm conftest.so |g 'real|fake'
00000000000005a0 W fake
00000000000005a0 T real
Jed
|