[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
correct check for -rdynamic
From: |
Dan McMahill |
Subject: |
correct check for -rdynamic |
Date: |
Wed, 18 Oct 2006 01:45:04 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.7.6) Gecko/20050412 |
Anyone have a correct check to see if the compiler needs/accepts
-rdynamic or maybe -Wl,--export-dynamic?
We were using a test like:
AC_MSG_CHECKING([If the compiler accepts -rdynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -rdynamic"
AC_LINK_IFELSE([int main(){}],
[AC_MSG_RESULT([yes])],
[LDFLAGS="$old_LDFLAGS"
AC_MSG_RESULT([no])
])
unfortunately, while this seems to work with gcc, it does not work with
SunPRO. Here are some examples of how this test might play out.
> cc -rdynamic -o foo foo.c
cc: Warning: illegal option -dynamic
> echo $?
0
so configure thinks rdynamic is ok however, foo is not ok:
> file foo
foo: ELF 32-bit MSB relocatable SPARC32PLUS Version 1, V8+
Required
> ls -l foo
-rw-r--r-- 1 yyyyy yyyyy 429116 Oct 16 22:12 foo
note that foo is not an executible, it is a relocatable.
Without -rdynamic, things are ok:
> cc -o foo foo.c
> file foo
foo: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+
Required, dynamically linked, not stripped
> ls -l foo
-rwxr-xr-x 1 yyyyy yyyyy 6984 Oct 16 22:12 foo
> cc -V
cc: Sun C 5.8 2005/10/13
usage: cc [ options] files. Use 'cc -flags' for details
I actually don't think you need any sort of -rdynamic or
-Wl,--export-dynamic with SunPRO, but I really don't know about some of
the other compilers out there (MipsPRO for example).
Suggestions?
Thanks
-Dan
- correct check for -rdynamic,
Dan McMahill <=