Print this page
ld: implement -ztype and rework option parsing

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/sections.c
          +++ new/usr/src/cmd/sgs/libld/common/sections.c
↓ open down ↓ 1266 lines elided ↑ open up ↑
1267 1267                  if (ofl->ofl_oscapchain)
1268 1268                          cnt += 3;
1269 1269  
1270 1270                  if (flags & FLG_OF_SYMBOLIC)
1271 1271                          cnt++;                  /* DT_SYMBOLIC */
1272 1272  
1273 1273                  if (ofl->ofl_aslr != 0)         /* DT_SUNW_ASLR */
1274 1274                          cnt++;
1275 1275          }
1276 1276  
     1277 +        if (ofl->ofl_flags & FLG_OF_KMOD)
     1278 +                cnt++;
     1279 +
1277 1280          /*
1278 1281           * Account for Architecture dependent .dynamic entries, and defaults.
1279 1282           */
1280 1283          (*ld_targ.t_mr.mr_mach_make_dynamic)(ofl, &cnt);
1281 1284  
1282 1285          /*
1283 1286           * DT_FLAGS, DT_FLAGS_1, DT_SUNW_STRPAD, and DT_NULL. Also,
1284 1287           * allow room for the unused extra DT_NULLs. These are included
1285 1288           * to allow an ELF editor room to add items later.
1286 1289           */
↓ open down ↓ 1138 lines elided ↑ open up ↑
2425 2428   * for an executable and/or a shared object.
2426 2429   */
2427 2430  static uintptr_t
2428 2431  make_reloc(Ofl_desc *ofl, Os_desc *osp)
2429 2432  {
2430 2433          Shdr            *shdr;
2431 2434          Elf_Data        *data;
2432 2435          Is_desc         *isec;
2433 2436          size_t          size;
2434 2437          Xword           sh_flags;
2435      -        char            *sectname;
     2438 +        char            *sectname;
2436 2439          Os_desc         *rosp;
2437 2440          Word            relsize;
2438 2441          const char      *rel_prefix;
2439 2442  
2440 2443          /* LINTED */
2441 2444          if (ld_targ.t_m.m_rel_sht_type == SHT_REL) {
2442 2445                  /* REL */
2443 2446                  relsize = sizeof (Rel);
2444 2447                  rel_prefix = MSG_ORIG(MSG_SCN_REL);
2445 2448          } else {
↓ open down ↓ 210 lines elided ↑ open up ↑
2656 2659   * Make .sunwmove section
2657 2660   */
2658 2661  uintptr_t
2659 2662  ld_make_sunwmove(Ofl_desc *ofl, int mv_nums)
2660 2663  {
2661 2664          Shdr            *shdr;
2662 2665          Elf_Data        *data;
2663 2666          Is_desc         *isec;
2664 2667          Aliste          idx;
2665 2668          Sym_desc        *sdp;
2666      -        int             cnt = 1;
     2669 +        int             cnt = 1;
2667 2670  
2668 2671  
2669 2672          if (new_section(ofl, SHT_SUNW_move, MSG_ORIG(MSG_SCN_SUNWMOVE),
2670 2673              mv_nums, &isec, &shdr, &data) == S_ERROR)
2671 2674                  return (S_ERROR);
2672 2675  
2673 2676          if ((data->d_buf = libld_calloc(data->d_size, 1)) == NULL)
2674 2677                  return (S_ERROR);
2675 2678  
2676 2679          /*
↓ open down ↓ 852 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX