While addressing the problem in my last message I took a closer look
at the cc.darwin scripts in src/cmd/INIT. Here's some suggestions for
improvements:

  * With ast-open-2014-09-29 you upped MACOSX_DEPLOYMENT_TARGET from
    10.3 to 10.7 in cc.darwin and cc.darwin.i386. For cc.darwin in
    particular this doesn't make sense since the last version of Mac OS
    X that ran on Power PC was 10.5. For cc.darwin I changed this back
    to 10.3. This seems most appropriate since, if I'm reading the case
    statement properly, the first case appears to be for Mac OS 10.2 and
    before. Since the first Intel version of Mac OS X was 10.4 I changed
    MACOSX_DEPLOYMENT_TARGET to 10.4 in cc.darwin.i386. In
    cc.darwin.i386-64 10.7 is a reasonable value for
    MACOSX_DEPLOYMENT_TARGET.
  * Again, if I'm reading the case statement properly, the first case
    appears to be for Mac OS 10.2 and before. So this first case simply
    doesn't apply to cc.darwin.i386*. Therefore, I reduced the entire
    case statement to just the second case in cc.darwin.i386 and
    cc.darwin.i386-64.
  * And now for perhaps the most contentious change, I removed the
    -Wl,-flat_namespace option in all the cc.darwin scripts. Those who
    are used to flat namespaces from other dialects of Unix think that
    that's the way to go on Darwin. But, Apple's philosophy is that
    two-level namespaces are better. As a result, they've geared the
    dynamic loader to work better with two-level namespaces (at least
    with Mac OS 10.3 and above as I seem to recall). That's why
    two-level namespaces are the default when building dynamic libraries
    on Darwin. In support of the change I have to make the following report:

        After I tested all my fixes to ast-open-2014-09-29 I rebuilt it
        with debugging turned off. This, of course, reapplied dynamic
        libraries to the build. Then I tried "package test" again. In
        http://lists.research.att.com/pipermail/ast-users/2014q4/004686.html
        I reported a problem with the dynamic loader not being able to
        find the symbol, _nv_lastdict, while attempting to run "regress
        .../kshlib/dss/dss.tst". But, in this latest test run that error
        went away. I don't have time to prove it, but I firmly believe
        that the removal of the -Wl,-flat_namespace option in cc.darwin
        inadvertently fixed this problem. None of the other changes I
        made were to address this problem.

I've attached cc.darwin.diff, cc.darwin.i386 and cc.darwin.i386-64.diff
so that the changes can be applied. Note that the changes to
cc.darwin.i386 and cc.darwin.i386-64 have not been tested since I don't
have an Intel Mac.

                    Terrence Doyle
--- src/cmd/INIT/cc.darwin.orig 2013-11-07 11:04:31.000000000 -0600
+++ src/cmd/INIT/cc.darwin      2014-12-22 19:41:18.000000000 -0600
@@ -50,13 +50,13 @@
 dll)   # what a compatibility mess -- surely they can get the apis to play nice
        tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
        trap "rm -f $tmp" EXIT
-       case `MACOSX_DEPLOYMENT_TARGET=10.7 ld -undefined dynamic_lookup 2>&1` 
in
+       case `MACOSX_DEPLOYMENT_TARGET=10.3 ld -undefined dynamic_lookup 2>&1` 
in
        *undefined*dynamic_lookup*)
                ld -m -flat_namespace -undefined suppress -dylib -dynamic \
                        -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 
2>&1
                status=$?
                ;;
-       *)      MACOSX_DEPLOYMENT_TARGET=10.7 $CC -Wl,-flat_namespace 
-dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
+       *)      MACOSX_DEPLOYMENT_TARGET=10.3 $CC -dynamiclib -undefined 
dynamic_lookup "$@" >$tmp 2>&1
                status=$?
                ;;
        esac
--- src/cmd/INIT/cc.darwin.i386.orig    2013-11-07 11:04:46.000000000 -0600
+++ src/cmd/INIT/cc.darwin.i386 2014-12-22 19:31:05.000000000 -0600
@@ -50,16 +50,8 @@
 dll)   # what a compatibility mess -- surely they can get the apis to play nice
        tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
        trap "rm -f $tmp" EXIT
-       case `MACOSX_DEPLOYMENT_TARGET=10.7 ld -undefined dynamic_lookup 2>&1` 
in
-       *undefined*dynamic_lookup*)
-               ld -m -flat_namespace -undefined suppress -dylib -dynamic \
-                       -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 
2>&1
-               status=$?
-               ;;
-       *)      MACOSX_DEPLOYMENT_TARGET=10.7 $CC -Wl,-flat_namespace 
-dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
-               status=$?
-               ;;
-       esac
+       MACOSX_DEPLOYMENT_TARGET=10.4 $CC -dynamiclib -undefined dynamic_lookup 
"$@" >$tmp 2>&1
+       status=$?
        egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
        exit $status
        ;;
--- src/cmd/INIT/cc.darwin.i386-64.orig 2013-11-07 11:11:02.000000000 -0600
+++ src/cmd/INIT/cc.darwin.i386-64      2014-12-22 19:38:04.000000000 -0600
@@ -50,16 +50,8 @@
 dll)   # what a compatibility mess -- surely they can get the apis to play nice
        tmp=/tmp/cc.${USER:-$LOGNAME}.$$.err
        trap "rm -f $tmp" EXIT
-       case `MACOSX_DEPLOYMENT_TARGET=10.7 ld -undefined dynamic_lookup 2>&1` 
in
-       *undefined*dynamic_lookup*)
-               ld -m -flat_namespace -undefined suppress -dylib -dynamic \
-                       -ldylib1.o "$@" -lcc_dynamic -framework System >$tmp 
2>&1
-               status=$?
-               ;;
-       *)      MACOSX_DEPLOYMENT_TARGET=10.7 $CC -Wl,-flat_namespace 
-dynamiclib -undefined dynamic_lookup "$@" >$tmp 2>&1
-               status=$?
-               ;;
-       esac
+       MACOSX_DEPLOYMENT_TARGET=10.7 $CC -dynamiclib -undefined dynamic_lookup 
"$@" >$tmp 2>&1
+       status=$?
        egrep -v ' (warning .*multiple definitions|definition) of ' $tmp >&2
        exit $status
        ;;
_______________________________________________
ast-users mailing list
ast-users@lists.research.att.com
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to