3173 if ((ehdr = elf_getehdr(elf)) == NULL) {
3174 int _class = gelf_getclass(elf);
3175
3176 /*
3177 * This can fail for a number of reasons. Typically
3178 * the object class is incorrect (ie. user is building
3179 * 64-bit but managed to point at 32-bit libraries).
3180 * Other ELF errors can include a truncated or corrupt
3181 * file. Try to get the best error message possible.
3182 */
3183 if (ld_targ.t_m.m_class != _class) {
3184 _rej.rej_type = SGS_REJ_CLASS;
3185 _rej.rej_info = (uint_t)_class;
3186 } else {
3187 _rej.rej_type = SGS_REJ_STR;
3188 _rej.rej_str = elf_errmsg(-1);
3189 }
3190 _rej.rej_name = name;
3191 DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej,
3192 ld_targ.t_m.m_mach));
3193 if (rej->rej_type == 0) {
3194 *rej = _rej;
3195 rej->rej_name = strdup(_rej.rej_name);
3196 }
3197 return (0);
3198 }
3199
3200 /*
3201 * Determine if we've already come across this file.
3202 */
3203 if (!(flags & FLG_IF_EXTRACT)) {
3204 APlist *apl;
3205 Aliste idx;
3206
3207 if (ehdr->e_type == ET_REL)
3208 apl = ofl->ofl_objs;
3209 else
3210 apl = ofl->ofl_sos;
3211
3212 /*
|
3173 if ((ehdr = elf_getehdr(elf)) == NULL) {
3174 int _class = gelf_getclass(elf);
3175
3176 /*
3177 * This can fail for a number of reasons. Typically
3178 * the object class is incorrect (ie. user is building
3179 * 64-bit but managed to point at 32-bit libraries).
3180 * Other ELF errors can include a truncated or corrupt
3181 * file. Try to get the best error message possible.
3182 */
3183 if (ld_targ.t_m.m_class != _class) {
3184 _rej.rej_type = SGS_REJ_CLASS;
3185 _rej.rej_info = (uint_t)_class;
3186 } else {
3187 _rej.rej_type = SGS_REJ_STR;
3188 _rej.rej_str = elf_errmsg(-1);
3189 }
3190 _rej.rej_name = name;
3191 DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej,
3192 ld_targ.t_m.m_mach));
3193 if (rej->rej_type == 0) {
3194 *rej = _rej;
3195 rej->rej_name = strdup(_rej.rej_name);
3196 }
3197 return (0);
3198 }
3199
3200 if (_gelf_getdynval(elf, DT_SUNW_KMOD) == 1) {
3201 _rej.rej_name = name;
3202 DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej,
3203 ld_targ.t_m.m_mach));
3204 _rej.rej_type = SGS_REJ_KMOD;
3205 _rej.rej_str = elf_errmsg(-1);
3206
3207 if (rej->rej_type == 0) {
3208 *rej = _rej;
3209 rej->rej_name = strdup(_rej.rej_name);
3210 }
3211 return (0);
3212 }
3213
3214 /*
3215 * Determine if we've already come across this file.
3216 */
3217 if (!(flags & FLG_IF_EXTRACT)) {
3218 APlist *apl;
3219 Aliste idx;
3220
3221 if (ehdr->e_type == ET_REL)
3222 apl = ofl->ofl_objs;
3223 else
3224 apl = ofl->ofl_sos;
3225
3226 /*
|