113 default: sprintf(name,
"PT_0x%08x", shdr->
get_type());
break;
115 sprintf(name+strlen(name),
"#%zu", shdr->
get_index());
162 const std::vector<size_t> &optsizes,
163 size_t *entsize,
size_t *required,
size_t *optional,
size_t *entcount)
const
165 size_t struct_size = 0;
166 size_t extra_size = 0;
167 size_t entry_size = 0;
176 if (0==r32size && 0==r64size) {
181 struct_size = entry_size>0 ? entry_size :
get_size();
183 struct_size = r32size;
185 struct_size = r64size;
192 entry_size =
std::max(entry_size, struct_size);
196 nentries = optsizes.size();
198 for (
size_t i=0; i<nentries; i++) {
199 extra_size =
std::max(extra_size, optsizes[i]);
201 entry_size = std::min(entry_size, struct_size+extra_size);
203 extra_size = entry_size - struct_size;
204 nentries = entry_size>0 ?
get_size() / entry_size : 0;
209 *entsize = entry_size;
211 *required = struct_size;
213 *optional = extra_size;
215 *entcount = nentries;
216 return entry_size * nentries;
230 return calculate_sizes(0, 0, std::vector<size_t>(), entsize, required, optional, entcount);
237 bool reallocated =
false;
272 sprintf(p,
"%sElfSection[%zd].", prefix, idx);
274 sprintf(p,
"%sElfSection.", prefix);
286 fprintf(f,
"%s%-*s = [%d] \"%s\"\n", p, w,
"linked_to",
289 fprintf(f,
"%s%-*s = NULL\n", p, w,
"linked_to");