components/gcc49/Solaris/map.gnu-sections
changeset 5205 eaff9ab86216
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gcc49/Solaris/map.gnu-sections	Wed Dec 16 20:20:50 2015 -0800
@@ -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