Print this page
3638 ld confuses files with group sections and files that should lazy load


2326         return (1);
2327 }
2328 
2329 /*
2330  * Process a group section.
2331  */
2332 static uintptr_t
2333 process_group(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
2334     Word ndx, int ident, Ofl_desc *ofl)
2335 {
2336         uintptr_t       error;
2337 
2338         error = process_section(name, ifl, shdr, scn, ndx, ident, ofl);
2339         if ((error == 0) || (error == S_ERROR))
2340                 return (error);
2341 
2342         /*
2343          * Indicate that this input file has groups to process.  Groups are
2344          * processed after all input sections have been processed.
2345          */
2346         ifl->ifl_flags |= FLG_IS_GROUPS;
2347 
2348         return (1);
2349 }
2350 
2351 /*
2352  * Process a relocation entry. At this point all input sections from this
2353  * input file have been assigned an input section descriptor which is saved
2354  * in the `ifl_isdesc' array.
2355  */
2356 static uintptr_t
2357 rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
2358 {
2359         Word    rndx;
2360         Is_desc *risc;
2361         Os_desc *osp;
2362         Shdr    *shdr = isc->is_shdr;
2363         Conv_inv_buf_t inv_buf;
2364 
2365         /*
2366          * Make sure this is a valid relocation we can handle.


2790 #endif
2791                         default:
2792                         do_default:
2793                                 if (process_section(name, ifl, shdr, scn, ndx,
2794                                     ((ident == ld_targ.t_id.id_null) ?
2795                                     ident : ld_targ.t_id.id_user), ofl) ==
2796                                     S_ERROR)
2797                                         return (S_ERROR);
2798                                 break;
2799                         }
2800                 }
2801         }
2802 
2803         /*
2804          * Now that all input sections have been analyzed, and prior to placing
2805          * any input sections to their output sections, process any groups.
2806          * Groups can contribute COMDAT items, which may get discarded as part
2807          * of placement.  In addition, COMDAT names may require transformation
2808          * to indicate different output section placement.
2809          */
2810         if (ifl->ifl_flags & FLG_IS_GROUPS) {
2811                 for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
2812                         Is_desc *isp;
2813 
2814                         if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||
2815                             (isp->is_shdr->sh_type != SHT_GROUP))
2816                                 continue;
2817 
2818                         if (ld_group_process(isp, ofl) == S_ERROR)
2819                                 return (S_ERROR);
2820                 }
2821         }
2822 
2823         /*
2824          * Now that all of the input sections have been processed, place
2825          * them in the appropriate output sections.
2826          */
2827         for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
2828                 Is_desc *isp;
2829 
2830                 if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||




2326         return (1);
2327 }
2328 
2329 /*
2330  * Process a group section.
2331  */
2332 static uintptr_t
2333 process_group(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn,
2334     Word ndx, int ident, Ofl_desc *ofl)
2335 {
2336         uintptr_t       error;
2337 
2338         error = process_section(name, ifl, shdr, scn, ndx, ident, ofl);
2339         if ((error == 0) || (error == S_ERROR))
2340                 return (error);
2341 
2342         /*
2343          * Indicate that this input file has groups to process.  Groups are
2344          * processed after all input sections have been processed.
2345          */
2346         ifl->ifl_flags |= FLG_IF_GROUPS;
2347 
2348         return (1);
2349 }
2350 
2351 /*
2352  * Process a relocation entry. At this point all input sections from this
2353  * input file have been assigned an input section descriptor which is saved
2354  * in the `ifl_isdesc' array.
2355  */
2356 static uintptr_t
2357 rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
2358 {
2359         Word    rndx;
2360         Is_desc *risc;
2361         Os_desc *osp;
2362         Shdr    *shdr = isc->is_shdr;
2363         Conv_inv_buf_t inv_buf;
2364 
2365         /*
2366          * Make sure this is a valid relocation we can handle.


2790 #endif
2791                         default:
2792                         do_default:
2793                                 if (process_section(name, ifl, shdr, scn, ndx,
2794                                     ((ident == ld_targ.t_id.id_null) ?
2795                                     ident : ld_targ.t_id.id_user), ofl) ==
2796                                     S_ERROR)
2797                                         return (S_ERROR);
2798                                 break;
2799                         }
2800                 }
2801         }
2802 
2803         /*
2804          * Now that all input sections have been analyzed, and prior to placing
2805          * any input sections to their output sections, process any groups.
2806          * Groups can contribute COMDAT items, which may get discarded as part
2807          * of placement.  In addition, COMDAT names may require transformation
2808          * to indicate different output section placement.
2809          */
2810         if (ifl->ifl_flags & FLG_IF_GROUPS) {
2811                 for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
2812                         Is_desc *isp;
2813 
2814                         if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||
2815                             (isp->is_shdr->sh_type != SHT_GROUP))
2816                                 continue;
2817 
2818                         if (ld_group_process(isp, ofl) == S_ERROR)
2819                                 return (S_ERROR);
2820                 }
2821         }
2822 
2823         /*
2824          * Now that all of the input sections have been processed, place
2825          * them in the appropriate output sections.
2826          */
2827         for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
2828                 Is_desc *isp;
2829 
2830                 if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||