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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/place.c
          +++ new/usr/src/cmd/sgs/libld/common/place.c
↓ open down ↓ 230 lines elided ↑ open up ↑
 231  231   * Determine whether this input COMDAT section already exists for the associated
 232  232   * output section.  If so, then discard this input section.  Otherwise, this
 233  233   * must be the first COMDAT section, thus it is kept for future comparisons.
 234  234   */
 235  235  static uintptr_t
 236  236  add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
 237  237  {
 238  238          Isd_node        isd, *isdp;
 239  239          avl_tree_t      *avlt;
 240  240          avl_index_t     where;
      241 +        Group_desc      *gr;
      242 +
      243 +        /*
      244 +         * Sections to which COMDAT groups apply are FLG_IS_COMDAT but are
      245 +         * discarded separately by the group logic so should never be
      246 +         * discarded here.
      247 +         */
      248 +        if ((isp->is_shdr->sh_flags & SHF_GROUP) &&
      249 +            ((gr = ld_get_group(ofl, isp)) != NULL) &&
      250 +            (gr->gd_data[0] & GRP_COMDAT))
      251 +                return (1);
 241  252  
 242  253          /*
 243  254           * Create a COMDAT avl tree for this output section if required.
 244  255           */
 245  256          if ((avlt = osp->os_comdats) == NULL) {
 246  257                  if ((avlt = libld_calloc(sizeof (avl_tree_t), 1)) == NULL)
 247  258                          return (S_ERROR);
 248  259                  avl_create(avlt, isdavl_compare, sizeof (Isd_node),
 249  260                      SGSOFFSETOF(Isd_node, isd_avl));
 250  261                  osp->os_comdats = avlt;
↓ open down ↓ 1016 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX