Add initial support for Mac OS X 10.7 (Lion).  Tracked by bug #275168.

* configure.in support

* new supp file darwin11.supp

* comment out many intercepts in mc_replace_strmem.c and
  vg_replace_malloc.c that are apparently unnecessary for Darwin

* add minimal handling for the following new syscalls and mach traps:
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost

* wqthread_hijack on amd64-darwin: deal with
  tst->os_state.pthread having an apparently different offset,
  which caused an assertion failure

* m_debuginfo: for 32 bit processes on Lion, use the DebugInfoFSM
  cleanup added in r12041/12042 to handle apparently new dyld
  behaviour, which is to map text areas r-- first and only
  vm_protect them later to r-x.



The following cleanups remain to be done

* remove apparently pointless, commented out wrapper macro
  invokations in mc_replace_strmem.c, eg

  //MEMMOVE(VG_Z_DYLD,        memmove)

  (or determine that they are still necessary, and uncomment)


* ditto in vg_replace_malloc.c, plus general VGO_darwin cleanups
  there


* write proper syscall wrappers for
    mach_port_set_context
    task_get_exception_ports
    getaudit_addr
    psynch_mutexwait
    psynch_mutexdrop
    psynch_cvbroad
    psynch_cvsignal
    psynch_cvwait
    psynch_rw_rdlock
    psynch_rw_wrlock
    psynch_rw_unlock
    psynch_cvclrprepost
  These are currently just no-ops and may be causing Memcheck to
  report false undef-value errors


* figure out why it doesn't work properly unless built with gcc-4.2 on
  Lion.

  gcc-4.2 is the "normal" gcc (i686-apple-darwin11-gcc-4.2.1).  Plain
  gcc is the hybrid gcc-front-end clang-back-end thing
  (i686-apple-darwin11-llvm-gcc-4.2).  Whereas on Snow Leopard, plain
  gcc is the normal gcc.

  The symptoms of the failure are that wqthread_hijack in
  syswrap-amd64-linux.c hits this /*NOTREACHED*/ vg_assert(0); right
  at the end (you need a pretty complex threaded app to trigger this),
  which makes me think that either ML_(wqthread_continue_NORETURN) or
  call_on_new_stack_0_1 do return, which they are not expected to.


* figure out if some of the uninitialised value errors reported in
  system libraries on are caused by Memcheck being confused by LLVM
  generated code, as per bug #242137



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12043 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/darwin11.supp b/darwin11.supp
new file mode 100644
index 0000000..8c5caef
--- /dev/null
+++ b/darwin11.supp
@@ -0,0 +1,122 @@
+
+# Suppressions for Darwin 11.x / Mac OS X 10.7 Lion
+
+##----------------------------------------------------------------------##
+# Memcheck
+##----------------------------------------------------------------------##
+
+# Dunno where this is a real bug, or due to borked 10.7-specific syscall
+# wrappers.  64-bit mode; not sure if occurs in 32-bit mode. 
+# Anyway, for the tine being:
+#
+# Conditional jump or move depends on uninitialised value(s)
+#    at 0x1973E6: __mtx_droplock (in /usr/lib/system/libsystem_c.dylib)
+#    by 0x1976AA: pthread_mutex_unlock (in /usr/lib/system/libsystem_c.dylib)
+#    by 0x100B3D: unlock_node (in /usr/lib/system/libkeymgr.dylib)
+{
+   OSX107:__mtx_droplock
+   Memcheck:Cond
+   fun:__mtx_droplock
+   fun:pthread_mutex_unlock
+   fun:unlock_node
+}
+
+# Conditional jump or move depends on uninitialised value(s)
+#    at 0x2EB883: ??? (in /usr/lib/system/libxpc.dylib)
+#    by 0x237C6: ??? (in /usr/lib/libSystem.B.dylib)
+#    by 0x8FE1115A: ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) (in /usr/lib/dyld)
+{
+   <insert_a_suppression_name_here>
+   Memcheck:Cond
+   obj:/usr/lib/system/libxpc.dylib
+   obj:/usr/lib/libSystem.B.dylib
+   fun:_ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE
+}
+
+# ZLib stuff.  How come this wasn't necessary in 10.6 ?
+{
+   OSX107:zlib-C
+   Memcheck:Cond
+   obj:/usr/lib/libz.*dylib
+   obj:/usr/lib/libz.*dylib
+}
+{
+   OSX107:zlib-8
+   Memcheck:Value8
+   obj:/usr/lib/libz.*dylib
+   obj:/usr/lib/libz.*dylib
+}
+
+# Really a bug?  I don't know.
+# Conditional jump or move depends on uninitialised value(s)
+#    at 0x3A322FE: __mtx_droplock (in /usr/lib/system/libsystem_c.dylib)
+#    by 0x3A326AA: pthread_mutex_unlock (in /usr/lib/system/libsystem_c.dylib)
+#    by 0x26382: load_images (in /usr/lib/libobjc.A.dylib)
+{
+   OSX107:blah
+   Memcheck:Cond
+   fun:__mtx_droplock
+   fun:pthread_mutex_unlock
+}
+
+{
+   OSX107:blah
+   Memcheck:Cond
+   fun:pthread_mutex_lock
+}
+
+
+
+##########################################################################
+### The ones below are from darwin10.supp (for Snow Leopard).  I don't
+### know whether they are still necessary.
+
+# afaict this is legit.  Might be caused by setenv("VAR=")
+# where the value string is empty (not sure)
+{
+   macos-Cond-7
+   Memcheck:Cond
+   fun:__setenv
+}
+
+# From Jesse Ruderman.
+#{
+#   Mac OS X 10.6.4. rdar://8145289. "new[]" paired with "delete" in the DesktopServicesPriv framework.
+#   Memcheck:Free
+#   fun:_ZdlPv
+#   fun:_ZN5TChar18RemovePtrReferenceEv
+# }
+
+# From Jesse Ruderman.
+#{
+#   Mac OS X 10.6.4. rdar://8145318. Uninitialized memory from HIMenuBarView::MeasureAppMenus is used in HIMenuBarView::SetAdjustTextTitleBoundsAtIndex.
+#   Memcheck:Cond
+#   fun:_ZN13HIMenuBarView31SetAdjustTextTitleBoundsAtIndexEih
+#   fun:_ZN13HIMenuBarView15MeasureAppMenusEv
+#}
+
+#{
+#   TFontFeatures::TFontFeatures(CGFont*) (in CoreText.framework)
+#   Memcheck:Cond
+#   fun:_ZN13TFontFeaturesC2EP6CGFont
+#   fun:_ZNK9TBaseFont12CopyFeaturesEv
+#}
+
+# See https://bugs.kde.org/show_bug.cgi?id=188572 about this;  it's
+# unavoidable due to BSD setenv() semantics.
+#{
+#   macos-__setenv-leak-see-our-bug-188572
+#   Memcheck:Leak
+#   fun:malloc_zone_malloc
+#   fun:__setenv
+#}
+
+#{
+#   libSystem-keymgr-leak-at-exit
+#   Memcheck:Leak
+#   fun:malloc
+#   fun:get_or_create_key_element
+#   fun:_keymgr_get_and_lock_processwide_ptr_2
+#   fun:__keymgr_initializer
+#   fun:libSystem_initializer
+#}