--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/components/llvm/patches/010-linker-mapfiles.patch Wed Feb 10 11:54:12 2016 -0800
@@ -0,0 +1,130 @@
+# 1. Enable the linker map files provided by clang/llvm for symbol
+# scope and visibility in shared libraries.
+# 2. We must use our own linker map file for compatibility with
+# the GNU linkers and GNU Binutils (libbfd).
+# Solaris autoconf-based build.
+# https://llvm.org/bugs/show_bug.cgi?id=24641
+--- Makefile.rules 2015-07-17 19:12:32.515872699 -0700
++++ Makefile.rules 2015-07-17 19:17:40.294355307 -0700
+@@ -643,6 +643,7 @@
+ endif
+ ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
+ LD.Flags += -Wl,-z -Wl,discard-unused=sections
++ LD.Flags += -Wl,-M -Wl,$(PROJ_SRC_ROOT)/mapfiles/map.gnu-sections
+ endif
+ endif
+ endif
+@@ -655,6 +656,10 @@
+ ifneq ($(HOST_OS), Darwin)
+ ifdef TOOLNAME
+ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib'
++ ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++ LD.Flags += -Wl,-z -Wl,discard-unused=sections
++ LD.Flags += -Wl,-M -Wl,$(PROJ_SRC_ROOT)/mapfiles/map.gnu-sections
++ endif
+ endif
+ else
+ ifneq ($(DARWIN_MAJVERS),4)
+@@ -1122,11 +1127,26 @@
+ clean-local::
+ -$(Verb) $(RM) -f $(NativeExportsFile)
+ else
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++# Solaris ld requires a version script rather than a plain list.
++NativeExportsFile := $(ObjDir)/$(notdir $(EXPORTED_SYMBOL_FILE)).map
++$(NativeExportsFile): $(EXPORTED_SYMBOL_FILE) $(ObjDir)/.dir
++ $(Verb) echo "{" > $@
++ $(Verb) grep -q '[[:alnum:]_]' $< && echo " global:" >> $@ || :
++ $(Verb) sed -e 's/$$/;/' -e 's/^/ /' < $< >> $@
++ifneq ($(HOST_OS),OpenBSD)
++ $(Verb) echo " local: *;" >> $@
++endif
++ $(Verb) echo "};" >> $@
++clean-local::
++ -$(Verb) $(RM) -f $(NativeExportsFile)
++else
+ # Default behavior: just use the exports file verbatim.
+ NativeExportsFile := $(EXPORTED_SYMBOL_FILE)
+ endif
+ endif
+ endif
++endif
+
+ # Now add the linker command-line options to use the native export file.
+
+@@ -1146,6 +1166,11 @@
+ SharedLinkOptions += $(NativeExportsFile)
+ endif
+
++# Solaris
++ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS))
++LLVMLibsOptions += -Wl,-M -Wl,$(NativeExportsFile)
++endif
++
+ endif
+
+ ###############################################################################
+--- /dev/null 2015-07-08 19:15:05.000000000 -0700
++++ mapfiles/map.gnu-sections 2015-07-08 19:13:41.905920797 -0700
+@@ -0,0 +1,61 @@
++$mapfile_version 2
++
++# Emulate the rules used by the GNU ld and gold linkers for merging input
++# sections into output sections in executables and shared objects. From
++# Ian Lance Taylor and Cary Coutant.
++
++# gcc 4.3 generates the following sorts of section names when it
++# needs a section name specific to a function:
++# .text.FN
++# .rodata.FN
++# .sdata2.FN
++# .data.FN
++# .data.rel.FN
++# .data.rel.local.FN
++# .data.rel.ro.FN
++# .data.rel.ro.local.FN
++# .sdata.FN
++# .bss.FN
++# .sbss.FN
++# .tdata.FN
++# .tbss.FN
++#
++# The GNU linker maps all of those to the part before the .FN,
++# except that .data.rel.local.FN is mapped to .data, and
++# .data.rel.ro.local.FN is mapped to .data.rel.ro. The sections
++# beginning with .data.rel.ro.local are grouped together.
++#
++# For an anonymous namespace, the string FN can contain a '.'.
++#
++# Also of interest: .rodata.strN.N, .rodata.cstN, both of which the
++# GNU linker maps to .rodata.
++
++$if _ET_DYN || _ET_EXEC
++
++LOAD_SEGMENT text {
++ ASSIGN_SECTION {
++ IS_NAME = MATCH(g/.data.rel.local.*/);
++ FLAGS = ALLOC !WRITE;
++ OUTPUT_SECTION { NAME = .data };
++ };
++ ASSIGN_SECTION {
++ IS_NAME = MATCH(r/^\.(text|rodata|sdata2|data\.rel\.ro|data\.rel|data|sdata|bss|sbss|tdata|tbss)\./);
++ FLAGS = ALLOC !WRITE;
++ OUTPUT_SECTION { NAME = MATCHREF(/.${n1}/) };
++ };
++};
++
++LOAD_SEGMENT data {
++ ASSIGN_SECTION {
++ IS_NAME = MATCH(g/.data.rel.local.*/);
++ FLAGS = ALLOC WRITE;
++ OUTPUT_SECTION { NAME = .data };
++ };
++ ASSIGN_SECTION {
++ IS_NAME = MATCH(r/^\.(text|rodata|sdata2|data\.rel\.ro|data\.rel|data|sdata|bss|sbss|tdata|tbss)\./);
++ FLAGS = ALLOC WRITE;
++ OUTPUT_SECTION { NAME = MATCHREF(/.${n1}/) };
++ };
++};
++
++$endif