Print this page
10366 ld(1) should support GNU-style linker sets
10367 ld(1) tests should be a real test suite
10368 want an ld(1) regression test for i386 LD tls transition (10267)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/update.c
          +++ new/usr/src/cmd/sgs/libld/common/update.c
↓ open down ↓ 176 lines elided ↑ open up ↑
 177  177          Ifl_desc        *ifl;
 178  178          Word            bssndx, etext_ndx, edata_ndx = 0, end_ndx, start_ndx;
 179  179          Word            end_abs = 0, etext_abs = 0, edata_abs;
 180  180          Word            tlsbssndx = 0, parexpnndx;
 181  181  #if     defined(_ELF64)
 182  182          Word            lbssndx = 0;
 183  183          Addr            lbssaddr = 0;
 184  184  #endif
 185  185          Addr            bssaddr, etext = 0, edata = 0, end = 0, start = 0;
 186  186          Addr            tlsbssaddr = 0;
 187      -        Addr            parexpnbase, parexpnaddr;
      187 +        Addr            parexpnbase, parexpnaddr;
 188  188          int             start_set = 0;
 189  189          Sym             _sym = {0}, *sym, *symtab = NULL;
 190  190          Sym             *dynsym = NULL, *ldynsym = NULL;
 191  191          Word            symtab_ndx = 0;         /* index into .symtab */
 192  192          Word            symtab_gbl_bndx;        /* .symtab ndx 1st global */
 193  193          Word            ldynsym_ndx = 0;        /* index into .SUNW_ldynsym */
 194  194          Word            dynsym_ndx = 0;         /* index into .dynsym */
 195  195          Word            scopesym_ndx = 0;       /* index into scoped symbols */
 196  196          Word            scopesym_bndx = 0;      /* .symtab ndx 1st scoped sym */
 197  197          Word            ldynscopesym_ndx = 0;   /* index to ldynsym scoped */
↓ open down ↓ 1128 lines elided ↑ open up ↑
1326 1326                                          syminfo[ndx].si_flags |=
1327 1327                                              SYMINFO_FLG_DEFERRED;
1328 1328  
1329 1329                                  /*
1330 1330                                   * Enable direct symbol bindings if:
1331 1331                                   *
1332 1332                                   *  -   Symbol was identified with the DIRECT
1333 1333                                   *      keyword in a mapfile.
1334 1334                                   *
1335 1335                                   *  -   Symbol reference has been bound to a
1336      -                                 *      dependency which was specified as
     1336 +                                 *      dependency which was specified as
1337 1337                                   *      requiring direct bindings with -zdirect.
1338 1338                                   *
1339 1339                                   *  -   All symbol references are required to
1340 1340                                   *      use direct bindings via -Bdirect.
1341 1341                                   */
1342 1342                                  if (sdp->sd_flags & FLG_SY_DIR)
1343 1343                                          syminfo[ndx].si_flags |=
1344 1344                                              SYMINFO_FLG_DIRECTBIND;
1345 1345  
1346 1346                          } else if ((sdp->sd_flags & FLG_SY_EXTERN) &&
↓ open down ↓ 414 lines elided ↑ open up ↑
1761 1761                                   * stored in symbol's value during
1762 1762                                   * allocate_got().
1763 1763                                   */
1764 1764                                  sym->st_value += ofl->
1765 1765                                      ofl_osgot->os_shdr->sh_addr;
1766 1766                                  /* LINTED */
1767 1767                                  sectndx = elf_ndxscn(ofl->
1768 1768                                      ofl_osgot->os_scn);
1769 1769                                  sdp->sd_flags &= ~FLG_SY_SPECSEC;
1770 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;
1771 1784                          default:
1772 1785                                  /* NOTHING */
1773 1786                                  ;
1774 1787                          }
1775 1788                  }
1776 1789  
1777 1790                  /*
1778 1791                   * If a plt index has been assigned to an undefined function,
1779 1792                   * update the symbols value to the appropriate .plt address.
1780 1793                   */
↓ open down ↓ 1369 lines elided ↑ open up ↑
3150 3163                                                      osp->os_shdr->sh_addr +
3151 3164                                                      imvp->m_poffset;
3152 3165                                          }
3153 3166                                  } else {
3154 3167                                          omvp->m_info =
3155 3168                                              /* LINTED */
3156 3169                                              ELF_M_INFO(sdp->sd_symndx,
3157 3170                                              imvp->m_info);
3158 3171                                  }
3159 3172                          } else {
3160      -                                Boolean         isredloc = FALSE;
     3173 +                                Boolean         isredloc = FALSE;
3161 3174  
3162 3175                                  if ((ELF_ST_BIND(sym->st_info) == STB_LOCAL) &&
3163 3176                                      (ofl->ofl_flags & FLG_OF_REDLSYM))
3164 3177                                          isredloc = TRUE;
3165 3178  
3166 3179                                  if (isredloc && !(sdp->sd_move)) {
3167 3180                                          Os_desc *osp = sdp->sd_isc->is_osdesc;
3168 3181                                          Word    ndx = osp->os_identndx;
3169 3182  
3170 3183                                          omvp->m_info =
↓ open down ↓ 474 lines elided ↑ open up ↑
3645 3658                          vaddr = ld_targ.t_m.m_segm_origin;
3646 3659          } else
3647 3660                  vaddr = 0;
3648 3661  
3649 3662          /*
3650 3663           * Loop through the segment descriptors and pick out what we need.
3651 3664           */
3652 3665          DBG_CALL(Dbg_seg_title(ofl->ofl_lml));
3653 3666          for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
3654 3667                  Phdr            *phdr = &(sgp->sg_phdr);
3655      -                Xword           p_align;
     3668 +                Xword           p_align;
3656 3669                  Aliste          idx2;
3657 3670                  Sym_desc        *sdp;
3658 3671  
3659 3672                  segndx++;
3660 3673  
3661 3674                  /*
3662 3675                   * If an interpreter is required generate a PT_INTERP and
3663 3676                   * PT_PHDR program header entry.  The PT_PHDR entry describes
3664 3677                   * the program header table itself.  This information will be
3665 3678                   * passed via the aux vector to the interpreter (ld.so.1).
↓ open down ↓ 199 lines elided ↑ open up ↑
3865 3878  
3866 3879                          if (phdr->p_type != PT_LOAD)
3867 3880                                  continue;
3868 3881  
3869 3882                          v_e = vaddr + phdr->p_memsz;
3870 3883  
3871 3884                          /*
3872 3885                           * Check overlaps
3873 3886                           */
3874 3887                          for (i = 0; i < phdrndx - 1; i++) {
3875      -                                Addr    p_s = (ofl->ofl_phdr[i]).p_vaddr;
3876      -                                Addr    p_e;
     3888 +                                Addr    p_s = (ofl->ofl_phdr[i]).p_vaddr;
     3889 +                                Addr    p_e;
3877 3890  
3878 3891                                  if ((ofl->ofl_phdr[i]).p_type != PT_LOAD)
3879 3892                                          continue;
3880 3893  
3881 3894                                  p_e = p_s + (ofl->ofl_phdr[i]).p_memsz;
3882 3895                                  if (((p_s <= vaddr) && (p_e > vaddr)) ||
3883 3896                                      ((vaddr <= p_s) && (v_e > p_s)))
3884 3897                                          ld_eprintf(ofl, ERR_WARNING,
3885 3898                                              MSG_INTL(MSG_UPD_SEGOVERLAP),
3886 3899                                              ofl->ofl_name, EC_ADDR(p_e),
↓ open down ↓ 430 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX