Print this page
3999 libld extended section handling is broken


2036         if (local) {
2037                 int             allow_ldynsym = OFL_ALLOW_LDYNSYM(ofl);
2038                 Sym_desc        *last_file_sdp = NULL;
2039                 int             last_file_ndx = 0;
2040 
2041                 for (sym++, ndx = 1; ndx < local; sym++, ndx++) {
2042                         sd_flag_t       sdflags = FLG_SY_CLEAN;
2043                         Word            shndx;
2044                         const char      *name;
2045                         Sym_desc        *rsdp;
2046                         int             shndx_bad = 0;
2047                         int             symtab_enter = 1;
2048 
2049                         /*
2050                          * Determine and validate the associated section index.
2051                          */
2052                         if (symshndx && (sym->st_shndx == SHN_XINDEX)) {
2053                                 shndx = symshndx[ndx];
2054                         } else if ((shndx = sym->st_shndx) >= SHN_LORESERVE) {
2055                                 sdflags |= FLG_SY_SPECSEC;
2056                         } else if (shndx > ifl->ifl_ehdr->e_shnum) {
2057                                 /* We need the name before we can issue error */
2058                                 shndx_bad = 1;
2059                         }
2060 
2061                         /*
2062                          * Check if st_name has a valid value or not.
2063                          */
2064                         if ((name = string(ofl, ifl, sym, strs, strsize, ndx,
2065                             shndx, symsecndx, symsecname, strsecname,
2066                             &sdflags)) == NULL)
2067                                 continue;
2068 
2069                         /*
2070                          * Now that we have the name, if the section index
2071                          * was bad, report it.
2072                          */
2073                         if (shndx_bad) {
2074                                 ld_eprintf(ofl, ERR_WARNING,
2075                                     MSG_INTL(MSG_SYM_INVSHNDX),
2076                                     demangle_symname(name, symsecname, ndx),


2351         sym = (Sym *)isc->is_indata->d_buf;
2352         sym += local;
2353         weak = 0;
2354         /* LINTED */
2355         for (ndx = (int)local; ndx < total; sym++, ndx++) {
2356                 const char      *name;
2357                 sd_flag_t       sdflags = 0;
2358                 Word            shndx;
2359                 int             shndx_bad = 0;
2360                 Sym             *nsym = sym;
2361                 Cap_pair        *cpp = NULL;
2362                 uchar_t         ntype;
2363 
2364                 /*
2365                  * Determine and validate the associated section index.
2366                  */
2367                 if (symshndx && (nsym->st_shndx == SHN_XINDEX)) {
2368                         shndx = symshndx[ndx];
2369                 } else if ((shndx = nsym->st_shndx) >= SHN_LORESERVE) {
2370                         sdflags |= FLG_SY_SPECSEC;
2371                 } else if (shndx > ifl->ifl_ehdr->e_shnum) {
2372                         /* We need the name before we can issue error */
2373                         shndx_bad = 1;
2374                 }
2375 
2376                 /*
2377                  * Check if st_name has a valid value or not.
2378                  */
2379                 if ((name = string(ofl, ifl, nsym, strs, strsize, ndx, shndx,
2380                     symsecndx, symsecname, strsecname, &sdflags)) == NULL)
2381                         continue;
2382 
2383                 /*
2384                  * Now that we have the name, report an erroneous section index.
2385                  */
2386                 if (shndx_bad) {
2387                         ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX),
2388                             demangle_symname(name, symsecname, ndx),
2389                             ifl->ifl_name,
2390                             conv_sym_shndx(osabi, mach, nsym->st_shndx,
2391                             CONV_FMT_DECIMAL, &inv_buf));




2036         if (local) {
2037                 int             allow_ldynsym = OFL_ALLOW_LDYNSYM(ofl);
2038                 Sym_desc        *last_file_sdp = NULL;
2039                 int             last_file_ndx = 0;
2040 
2041                 for (sym++, ndx = 1; ndx < local; sym++, ndx++) {
2042                         sd_flag_t       sdflags = FLG_SY_CLEAN;
2043                         Word            shndx;
2044                         const char      *name;
2045                         Sym_desc        *rsdp;
2046                         int             shndx_bad = 0;
2047                         int             symtab_enter = 1;
2048 
2049                         /*
2050                          * Determine and validate the associated section index.
2051                          */
2052                         if (symshndx && (sym->st_shndx == SHN_XINDEX)) {
2053                                 shndx = symshndx[ndx];
2054                         } else if ((shndx = sym->st_shndx) >= SHN_LORESERVE) {
2055                                 sdflags |= FLG_SY_SPECSEC;
2056                         } else if (shndx > ifl->ifl_shnum) {
2057                                 /* We need the name before we can issue error */
2058                                 shndx_bad = 1;
2059                         }
2060 
2061                         /*
2062                          * Check if st_name has a valid value or not.
2063                          */
2064                         if ((name = string(ofl, ifl, sym, strs, strsize, ndx,
2065                             shndx, symsecndx, symsecname, strsecname,
2066                             &sdflags)) == NULL)
2067                                 continue;
2068 
2069                         /*
2070                          * Now that we have the name, if the section index
2071                          * was bad, report it.
2072                          */
2073                         if (shndx_bad) {
2074                                 ld_eprintf(ofl, ERR_WARNING,
2075                                     MSG_INTL(MSG_SYM_INVSHNDX),
2076                                     demangle_symname(name, symsecname, ndx),


2351         sym = (Sym *)isc->is_indata->d_buf;
2352         sym += local;
2353         weak = 0;
2354         /* LINTED */
2355         for (ndx = (int)local; ndx < total; sym++, ndx++) {
2356                 const char      *name;
2357                 sd_flag_t       sdflags = 0;
2358                 Word            shndx;
2359                 int             shndx_bad = 0;
2360                 Sym             *nsym = sym;
2361                 Cap_pair        *cpp = NULL;
2362                 uchar_t         ntype;
2363 
2364                 /*
2365                  * Determine and validate the associated section index.
2366                  */
2367                 if (symshndx && (nsym->st_shndx == SHN_XINDEX)) {
2368                         shndx = symshndx[ndx];
2369                 } else if ((shndx = nsym->st_shndx) >= SHN_LORESERVE) {
2370                         sdflags |= FLG_SY_SPECSEC;
2371                 } else if (shndx > ifl->ifl_shnum) {
2372                         /* We need the name before we can issue error */
2373                         shndx_bad = 1;
2374                 }
2375 
2376                 /*
2377                  * Check if st_name has a valid value or not.
2378                  */
2379                 if ((name = string(ofl, ifl, nsym, strs, strsize, ndx, shndx,
2380                     symsecndx, symsecname, strsecname, &sdflags)) == NULL)
2381                         continue;
2382 
2383                 /*
2384                  * Now that we have the name, report an erroneous section index.
2385                  */
2386                 if (shndx_bad) {
2387                         ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX),
2388                             demangle_symname(name, symsecname, ndx),
2389                             ifl->ifl_name,
2390                             conv_sym_shndx(osabi, mach, nsym->st_shndx,
2391                             CONV_FMT_DECIMAL, &inv_buf));