unwind.h fix for -fvisibility=hidden users. This fixes firefox build in a system
with libunwind installed.
Patch by Jeffrey Yasskin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153633 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Headers/unwind.h b/lib/Headers/unwind.h
index a99c8a1..a065920 100644
--- a/lib/Headers/unwind.h
+++ b/lib/Headers/unwind.h
@@ -31,7 +31,19 @@
 #  define _SHOULD_UNDEFINE_GNU_SOURCE
 #  define _GNU_SOURCE
 # endif
-# include_next <unwind.h>
+// libunwind's unwind.h reflects the current visibility.  However, Mozilla
+// builds with -fvisibility=hidden and relies on gcc's unwind.h to reset the
+// visibility to default and export its contents.  gcc also allows users to
+// override its override by #defining HIDE_EXPORTS (but note, this only obeys
+// the user's -fvisibility setting; it doesn't hide any exports on its own).  We
+// imitate gcc's header here:
+# ifdef HIDE_EXPORTS
+#  include_next <unwind.h>
+# else
+#  pragma GCC visibility push(default)
+#  include_next <unwind.h>
+#  pragma GCC visibility pop
+# endif
 # ifdef _SHOULD_UNDEFINE_GNU_SOURCE
 #  undef _GNU_SOURCE
 #  undef _SHOULD_UNDEFINE_GNU_SOURCE