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>


 221          * created the section intended it to be mergeable. The
 222          * FLG_IS_INSTRMRG flag says that we have done validity testing
 223          * and decided that it is safe to act on that hint.
 224          */
 225         isp->is_flags |= FLG_IS_INSTRMRG;
 226 
 227         return (1);
 228 }
 229 
 230 /*
 231  * Determine whether this input COMDAT section already exists for the associated
 232  * output section.  If so, then discard this input section.  Otherwise, this
 233  * must be the first COMDAT section, thus it is kept for future comparisons.
 234  */
 235 static uintptr_t
 236 add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
 237 {
 238         Isd_node        isd, *isdp;
 239         avl_tree_t      *avlt;
 240         avl_index_t     where;











 241 
 242         /*
 243          * Create a COMDAT avl tree for this output section if required.
 244          */
 245         if ((avlt = osp->os_comdats) == NULL) {
 246                 if ((avlt = libld_calloc(sizeof (avl_tree_t), 1)) == NULL)
 247                         return (S_ERROR);
 248                 avl_create(avlt, isdavl_compare, sizeof (Isd_node),
 249                     SGSOFFSETOF(Isd_node, isd_avl));
 250                 osp->os_comdats = avlt;
 251         }
 252 
 253         /*
 254          * A standard COMDAT section uses the section name as search key.
 255          */
 256         isd.isd_name = isp->is_name;
 257         isd.isd_hash = sgs_str_hash(isd.isd_name);
 258 
 259         if ((isdp = avl_find(avlt, &isd, &where)) != NULL) {
 260                 isp->is_osdesc = osp;




 221          * created the section intended it to be mergeable. The
 222          * FLG_IS_INSTRMRG flag says that we have done validity testing
 223          * and decided that it is safe to act on that hint.
 224          */
 225         isp->is_flags |= FLG_IS_INSTRMRG;
 226 
 227         return (1);
 228 }
 229 
 230 /*
 231  * Determine whether this input COMDAT section already exists for the associated
 232  * output section.  If so, then discard this input section.  Otherwise, this
 233  * must be the first COMDAT section, thus it is kept for future comparisons.
 234  */
 235 static uintptr_t
 236 add_comdat(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp)
 237 {
 238         Isd_node        isd, *isdp;
 239         avl_tree_t      *avlt;
 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);
 252 
 253         /*
 254          * Create a COMDAT avl tree for this output section if required.
 255          */
 256         if ((avlt = osp->os_comdats) == NULL) {
 257                 if ((avlt = libld_calloc(sizeof (avl_tree_t), 1)) == NULL)
 258                         return (S_ERROR);
 259                 avl_create(avlt, isdavl_compare, sizeof (Isd_node),
 260                     SGSOFFSETOF(Isd_node, isd_avl));
 261                 osp->os_comdats = avlt;
 262         }
 263 
 264         /*
 265          * A standard COMDAT section uses the section name as search key.
 266          */
 267         isd.isd_name = isp->is_name;
 268         isd.isd_hash = sgs_str_hash(isd.isd_name);
 269 
 270         if ((isdp = avl_find(avlt, &isd, &where)) != NULL) {
 271                 isp->is_osdesc = osp;