Print this page
3616 SHF_GROUP sections should not be discarded via other COMDAT mechanisms
3709 need sloppy relocation for GNU .debug_macro
Reviewed by: Joshua M. Clulow <josh@sysmgr.org>
Reviewed by: Robert Mustacchi <rm@joyent.com>

@@ -236,10 +236,21 @@
 add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
 {
         Isd_node        isd, *isdp;
         avl_tree_t      *avlt;
         avl_index_t     where;
+        Group_desc      *gr;
+
+        /*
+         * Sections to which COMDAT groups apply are FLG_IS_COMDAT but are
+         * discarded separately by the group logic so should never be
+         * discarded here.
+         */
+        if ((isp->is_shdr->sh_flags & SHF_GROUP) &&
+            ((gr = ld_get_group(ofl, isp)) != NULL) &&
+            (gr->gd_data[0] & GRP_COMDAT))
+                return (1);
 
         /*
          * Create a COMDAT avl tree for this output section if required.
          */
         if ((avlt = osp->os_comdats) == NULL) {