This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][RevisedX2] PR43715 - Fix --enable-plugin on darwin


On 04/11/2010 05:32 PM, Jack Howarth wrote:

> 2010-04-11  Jack Howarth <howarth@bromo.med.uc.edu>
> 
>         PR 43715
> 	* gcc/configure.ac: Use "$gcc_cv_nm -g | grep T" when
> 	$gcc_cv_objdump empty. Use "-undefined dynamic_lookup"
> 	on darwin.
>         * gcc/configure: Regenerate.
> 	* testsuite/lib/plugin-support.exp: Use "-undefined
> 	dynamic_lookup" on darwin.

> Index: gcc/configure.ac
> ===================================================================
> --- gcc/configure.ac	(revision 158204)
> +++ gcc/configure.ac	(working copy)
> @@ -4381,15 +4381,20 @@
>  pluginlibs=
>  if test x"$enable_plugin" = x"yes"; then
>  
> +  if [ test -z "$gcc_cv_objdump" ]; then

drop one of the "test", either if [ -z "$gcc_cv_objdump" ]; then .. or
if test -z "$gcc_cv_objdump"; then...

> +    export_sym_check="$gcc_cv_nm -g | grep T"
> +  else
> +    export_sym_check="$gcc_cv_objdump -T"
> +  fi  
>    AC_MSG_CHECKING([for exported symbols])
>    echo "int main() {return 0;} int foobar() {return 0;}" > conftest.c
>    ${CC} ${CFLAGS} ${LDFLAGS} conftest.c -o conftest > /dev/null 2>&1
> -  if $gcc_cv_objdump -T conftest | grep foobar > /dev/null; then
> +  if $export_sym_check conftest | grep foobar > /dev/null; then

I doubt this is doing what you hoped, if export_sym_check is "nm -g |
grep T" then this will expand to (well, Ralf says it won't because you'd
need an eval because of the pipe, but, for examples sake):

if nm -g | grep T conftest | grep foobar > /dev/null; then

not what you want.

As for Ralf's pipe, eval comment:
$ nm=nm foo="$nm -g | grep T" $foo
nm: can't open file: | (No such file or directory)
nm: can't open file: grep (No such file or directory)
nm: can't open file: T (No such file or directory)

So the shell is calling nm -g on three files '|', 'grep', 'T' ... also
not what you want.

$ nm=nm foo="$nm -g | grep T" eval $foo
nm: can't open file: a.out (No such file or directory)

With the eval, it correctly attempts to nm a.out (which is the default
if nm is not given an explicit filename).

Since you're doing nm -g to only see global symbols anyway, you
shouldn't need to grep for the ' T ' as well, and can avoid the need to
eval.

> +    export_sym_check="$gcc_cv_nm -g"

may be better.

Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]