Print this page
10366 ld(1) should support GNU-style linker sets
10581 ld(1) should know kernel modules are a thing


1751                                             ofl_osplt->os_shdr->sh_addr;
1752                                         /* LINTED */
1753                                         sectndx = elf_ndxscn(
1754                                             ofl->ofl_osplt->os_scn);
1755                                         sdp->sd_flags &= ~FLG_SY_SPECSEC;
1756                                 }
1757                                 break;
1758                         case SDAUX_ID_GOT:
1759                                 /*
1760                                  * Symbol bias for negative growing tables is
1761                                  * stored in symbol's value during
1762                                  * allocate_got().
1763                                  */
1764                                 sym->st_value += ofl->
1765                                     ofl_osgot->os_shdr->sh_addr;
1766                                 /* LINTED */
1767                                 sectndx = elf_ndxscn(ofl->
1768                                     ofl_osgot->os_scn);
1769                                 sdp->sd_flags &= ~FLG_SY_SPECSEC;
1770                                 break;













1771                         default:
1772                                 /* NOTHING */
1773                                 ;
1774                         }
1775                 }
1776 
1777                 /*
1778                  * If a plt index has been assigned to an undefined function,
1779                  * update the symbols value to the appropriate .plt address.
1780                  */
1781                 if ((flags & FLG_OF_DYNAMIC) && (flags & FLG_OF_EXEC) &&
1782                     (sdp->sd_file) &&
1783                     (sdp->sd_file->ifl_ehdr->e_type == ET_DYN) &&
1784                     (ELF_ST_TYPE(sym->st_info) == STT_FUNC) &&
1785                     !(flags & FLG_OF_BFLAG)) {
1786                         if (sap->sa_PLTndx)
1787                                 sym->st_value =
1788                                     (*ld_targ.t_mr.mr_calc_plt_addr)(sdp, ofl);
1789                 }
1790 


2562          * bindings are established to the no-direct symbols that exist
2563          * within these dependencies.
2564          */
2565         if (ofl->ofl_flags1 & FLG_OF1_NGLBDIR)
2566                 ofl->ofl_dtflags_1 &= ~DF_1_DIRECT;
2567         if (ofl->ofl_flags1 & FLG_OF1_NDIRECT)
2568                 ofl->ofl_dtflags_1 |= DF_1_NODIRECT;
2569 
2570         dyn->d_tag = DT_FLAGS_1;
2571         dyn->d_un.d_val = ofl->ofl_dtflags_1;
2572         dyn++;
2573 
2574         dyn->d_tag = DT_SUNW_STRPAD;
2575         dyn->d_un.d_val = DYNSTR_EXTRA_PAD;
2576         dyn++;
2577 
2578         dyn->d_tag = DT_SUNW_LDMACH;
2579         dyn->d_un.d_val = ld_sunw_ldmach();
2580         dyn++;
2581 






2582         (*ld_targ.t_mr.mr_mach_update_odynamic)(ofl, &dyn);
2583 
2584         for (cnt = 1 + DYNAMIC_EXTRA_ELTS; cnt--; dyn++) {
2585                 dyn->d_tag = DT_NULL;
2586                 dyn->d_un.d_val = 0;
2587         }
2588 
2589         /*
2590          * Ensure that we wrote the right number of entries. If not, we either
2591          * miscounted in make_dynamic(), or we did something wrong in this
2592          * function.
2593          */
2594         assert((ofl->ofl_osdynamic->os_shdr->sh_size /
2595             ofl->ofl_osdynamic->os_shdr->sh_entsize) ==
2596             ((uintptr_t)dyn - (uintptr_t)_dyn) / sizeof (*dyn));
2597 
2598         return (1);
2599 }
2600 
2601 /*




1751                                             ofl_osplt->os_shdr->sh_addr;
1752                                         /* LINTED */
1753                                         sectndx = elf_ndxscn(
1754                                             ofl->ofl_osplt->os_scn);
1755                                         sdp->sd_flags &= ~FLG_SY_SPECSEC;
1756                                 }
1757                                 break;
1758                         case SDAUX_ID_GOT:
1759                                 /*
1760                                  * Symbol bias for negative growing tables is
1761                                  * stored in symbol's value during
1762                                  * allocate_got().
1763                                  */
1764                                 sym->st_value += ofl->
1765                                     ofl_osgot->os_shdr->sh_addr;
1766                                 /* LINTED */
1767                                 sectndx = elf_ndxscn(ofl->
1768                                     ofl_osgot->os_scn);
1769                                 sdp->sd_flags &= ~FLG_SY_SPECSEC;
1770                                 break;
1771                         case SDAUX_ID_SECBOUND_START:
1772                                 sym->st_value = sap->sa_boundsec->
1773                                     os_shdr->sh_addr;
1774                                 sectndx = elf_ndxscn(sap->sa_boundsec->os_scn);
1775                                 sdp->sd_flags &= ~FLG_SY_SPECSEC;
1776                                 break;
1777                         case SDAUX_ID_SECBOUND_STOP:
1778                                 sym->st_value = sap->sa_boundsec->
1779                                     os_shdr->sh_addr +
1780                                     sap->sa_boundsec->os_shdr->sh_size;
1781                                 sectndx = elf_ndxscn(sap->sa_boundsec->os_scn);
1782                                 sdp->sd_flags &= ~FLG_SY_SPECSEC;
1783                                 break;
1784                         default:
1785                                 /* NOTHING */
1786                                 ;
1787                         }
1788                 }
1789 
1790                 /*
1791                  * If a plt index has been assigned to an undefined function,
1792                  * update the symbols value to the appropriate .plt address.
1793                  */
1794                 if ((flags & FLG_OF_DYNAMIC) && (flags & FLG_OF_EXEC) &&
1795                     (sdp->sd_file) &&
1796                     (sdp->sd_file->ifl_ehdr->e_type == ET_DYN) &&
1797                     (ELF_ST_TYPE(sym->st_info) == STT_FUNC) &&
1798                     !(flags & FLG_OF_BFLAG)) {
1799                         if (sap->sa_PLTndx)
1800                                 sym->st_value =
1801                                     (*ld_targ.t_mr.mr_calc_plt_addr)(sdp, ofl);
1802                 }
1803 


2575          * bindings are established to the no-direct symbols that exist
2576          * within these dependencies.
2577          */
2578         if (ofl->ofl_flags1 & FLG_OF1_NGLBDIR)
2579                 ofl->ofl_dtflags_1 &= ~DF_1_DIRECT;
2580         if (ofl->ofl_flags1 & FLG_OF1_NDIRECT)
2581                 ofl->ofl_dtflags_1 |= DF_1_NODIRECT;
2582 
2583         dyn->d_tag = DT_FLAGS_1;
2584         dyn->d_un.d_val = ofl->ofl_dtflags_1;
2585         dyn++;
2586 
2587         dyn->d_tag = DT_SUNW_STRPAD;
2588         dyn->d_un.d_val = DYNSTR_EXTRA_PAD;
2589         dyn++;
2590 
2591         dyn->d_tag = DT_SUNW_LDMACH;
2592         dyn->d_un.d_val = ld_sunw_ldmach();
2593         dyn++;
2594 
2595         if (ofl->ofl_flags & FLG_OF_KMOD) {
2596                 dyn->d_tag = DT_SUNW_KMOD;
2597                 dyn->d_un.d_val = 1;
2598                 dyn++;
2599         }
2600 
2601         (*ld_targ.t_mr.mr_mach_update_odynamic)(ofl, &dyn);
2602 
2603         for (cnt = 1 + DYNAMIC_EXTRA_ELTS; cnt--; dyn++) {
2604                 dyn->d_tag = DT_NULL;
2605                 dyn->d_un.d_val = 0;
2606         }
2607 
2608         /*
2609          * Ensure that we wrote the right number of entries. If not, we either
2610          * miscounted in make_dynamic(), or we did something wrong in this
2611          * function.
2612          */
2613         assert((ofl->ofl_osdynamic->os_shdr->sh_size /
2614             ofl->ofl_osdynamic->os_shdr->sh_entsize) ==
2615             ((uintptr_t)dyn - (uintptr_t)_dyn) / sizeof (*dyn));
2616 
2617         return (1);
2618 }
2619 
2620 /*