308 static char *
309 gnu_comdat_sym(Ifl_desc *ifl, Is_desc *gisp)
310 {
311 size_t ndx;
312
313 for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
314 Is_desc *isp;
315 size_t ssize;
316
317 if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||
318 (isp == gisp) || (isp->is_name == NULL))
319 continue;
320
321 /*
322 * It's questionable whether this size should be cached in the
323 * Is_desc. However, this seems an infrequent operation and
324 * adding Is_desc members can escalate memory usage for large
325 * link-edits. For now, size the section name dynamically.
326 */
327 ssize = strlen(isp->is_name);
328 if ((strncmp(isp->is_name, gisp->is_name, ssize) != 0) &&
329 (gisp->is_name[ssize] == '.'))
330 return ((char *)&gisp->is_name[ssize]);
331 }
332 return (NULL);
333 }
334
335 /*
336 * GNU .gnu.linkonce sections follow a naming convention that indicates the
337 * required association with an output section. Determine whether this input
338 * section follows the convention, and if so return the appropriate output
339 * section name.
340 *
341 * .gnu.linkonce.b.* -> .bss
342 * .gnu.linkonce.d.* -> .data
343 * .gnu.linkonce.l.* -> .ldata
344 * .gnu.linkonce.lb.* -> .lbss
345 * .gnu.linkonce.lr.* -> .lrodata
346 * .gnu.linkonce.r.* -> .rodata
347 * .gnu.linkonce.s.* -> .sdata
348 * .gnu.linkonce.s2.* -> .sdata2
|
308 static char *
309 gnu_comdat_sym(Ifl_desc *ifl, Is_desc *gisp)
310 {
311 size_t ndx;
312
313 for (ndx = 1; ndx < ifl->ifl_shnum; ndx++) {
314 Is_desc *isp;
315 size_t ssize;
316
317 if (((isp = ifl->ifl_isdesc[ndx]) == NULL) ||
318 (isp == gisp) || (isp->is_name == NULL))
319 continue;
320
321 /*
322 * It's questionable whether this size should be cached in the
323 * Is_desc. However, this seems an infrequent operation and
324 * adding Is_desc members can escalate memory usage for large
325 * link-edits. For now, size the section name dynamically.
326 */
327 ssize = strlen(isp->is_name);
328 if ((strncmp(isp->is_name, gisp->is_name, ssize) == 0) &&
329 (gisp->is_name[ssize] == '.'))
330 return ((char *)&gisp->is_name[ssize]);
331 }
332 return (NULL);
333 }
334
335 /*
336 * GNU .gnu.linkonce sections follow a naming convention that indicates the
337 * required association with an output section. Determine whether this input
338 * section follows the convention, and if so return the appropriate output
339 * section name.
340 *
341 * .gnu.linkonce.b.* -> .bss
342 * .gnu.linkonce.d.* -> .data
343 * .gnu.linkonce.l.* -> .ldata
344 * .gnu.linkonce.lb.* -> .lbss
345 * .gnu.linkonce.lr.* -> .lrodata
346 * .gnu.linkonce.r.* -> .rodata
347 * .gnu.linkonce.s.* -> .sdata
348 * .gnu.linkonce.s2.* -> .sdata2
|