1 2019-01-20 Mark Wielaard <mark@klomp.org>
3 * readelf.c (print_debug_line_section): Check terminating NUL byte
4 for dir and file tables.
6 2019-01-16 Mark Wielaard <mark@klomp.org>
8 * readelf (handle_core_note): Pass desc to ebl_core_note.
10 2018-11-10 Mark Wielaard <mark@klomp.org>
12 * elflint.c (check_program_header): Allow PT_GNU_EH_FRAME segment
13 to be matched against SHT_X86_64_UNWIND section.
15 2018-11-09 Mark Wielaard <mark@klomp.org>
17 * strip.c (remove_debug_relocations): Check if section is gnu
18 compressed and decompress and recompress it.
20 2018-11-12 Mark Wielaard <mark@klomp.org>
22 * elflint.c (check_note_data): Recognize NT_GNU_BUILD_ATTRIBUTE_OPEN
23 and NT_GNU_BUILD_ATTRIBUTE_OPEN.
24 * readelf.c (handle_notes_data): Handle
25 ELF_NOTE_GNU_BUILD_ATTRIBUTE_PREFIX. Pass nhdr.n_namesz to
28 2018-11-11 Mark Wielaard <mark@klomp.org>
30 * readelf.c (handle_notes_data): Pass n_descsz to
31 ebl_object_note_type_name.
32 * elflint.c (check_note_data): Recognize NT_VERSION, add owner
33 name to unknown note error.
35 2018-10-20 Mark Wielaard <mark@klomp.org>
37 * readelf.c (process_elf_file): Use dwelf_elf_begin to open pure_elf.
39 2018-10-26 Mark Wielaard <mark@klomp.org>
41 * strip.c (OPT_RELOC_DEBUG_ONLY): New define.
42 (options): Add reloc-debug-sections-only.
43 (reloc_debug_only): New static bool.
44 (main): Check reloc_debug_only is the only strip option used.
45 (parse_opt): Handle OPT_RELOC_DEBUG_ONLY.
46 (handle_debug_relocs): New function.
47 (handle_elf): Add local variables lastsec_offset and lastsec_size.
48 Handle reloc_debug_only.
50 2018-10-24 Mark Wielaard <mark@klomp.org>
52 * strip.c (handle_elf): Extract code to update shdrstrndx into...
53 (update_shdrstrndx): ... this new function.
55 2018-10-24 Mark Wielaard <mark@klomp.org>
57 * strip.c (handle_elf): Extract code into separate functions...
58 (secndx_name): ... new function.
59 (get_xndxdata): Likewise.
60 (remove_debug_relocations): Likewise.
62 2018-10-24 Mark Wielaard <mark@klomp.org>
64 * strip.c (handle_elf): Always copy over phdrs if there are any
65 and check phnum instead of e_type to determine whether to move
68 2018-11-02 Mark Wielaard <mark@klomp.org>
70 * unstrip.c (copy_elf): Add ELF_CHECK to make sure gelf_getehdr ()
73 2018-10-18 Mark Wielaard <mark@klomp.org>
75 * elflint.c (check_note_data): Recognize NT_GNU_PROPERTY_TYPE_0.
76 (check_note): Use p_align to pass either ELF_T_NHDR or ELF_T_NHDR8 to
78 * readelf (handle_notes): Likewise.
80 2018-10-24 Mark Wielaard <mark@klomp.org>
82 * addr2line.c (print_addrsym): Use elf_getshdrstrndx instead of
85 2018-10-24 Mark Wielaard <mark@klomp.org>
87 * readelf.c (section_name): Remove ehdr argument, lookup shstrndx.
88 (print_debug_abbrev_section): Don't pass ehdr.
89 (print_debug_addr_section): Likewise.
90 (print_decoded_aranges_section): Likewise.
91 (print_debug_aranges_section): Likewise.
92 (print_debug_rnglists_section): Likewise.
93 (print_debug_ranges_section): Likewise.
94 (print_debug_units): Likewise.
95 (print_decoded_line_section): Likewise.
96 (print_debug_line_section): Likewise.
97 (print_debug_loclists_section): Likewise.
98 (print_debug_loc_section): Likewise.
99 (print_debug_macinfo_section): Likewise.
100 (print_debug_macro_section): Likewise.
101 (print_debug_pubnames_section): Likewise.
102 (print_debug_str_section): Liekwise.
103 (print_debug_str_offsets_section): Likewise.
104 (print_gdb_index_section): Likewise.
106 2018-10-16 Mark Wielaard <mark@klomp.org>
108 * readelf.c (print_debug_frame_section): Make sure readp is never
111 2018-10-19 Mark Wielaard <mark@klomp.org>
113 * dwfl_module_getdwarf.c (adjust_relocs): Check sh_entsize is not
115 (add_new_section_symbols): Likewise.
116 (copy_elided_sections): Likewise.
118 2018-10-18 Mark Wielaard <mark@klomp.org>
120 * size.c (handle_ar): Only close elf if prefix was NULL.
122 2018-10-18 Mark Wielaard <mark@klomp.org>
124 * arlib.c (arlib_add_symbols): Check that sh_entsize is not zero.
126 2018-10-14 Mark Wielaard <mark@klomp.org>
128 * ar.c (do_oper_extract): Assume epoch if ar_date is bogus.
130 2018-10-14 Mark Wielaard <mark@klomp.org>
132 * findtextrel.c (process_file): Check that sh_entsize is not zero.
134 2018-10-13 Mark Wielaard <mark@klomp.org>
136 * readelf.c (print_debug_macro_section): Use elf_getdata. Print
139 2018-10-19 Mark Wielaard <mark@klomp.org>
141 * unstrip.c (copy_elided_sections): Renumber group section indexes.
143 2018-10-12 Mark Wielaard <mark@klomp.org>
145 * strip.c (handle_elf): Don't remove SHF_GROUP flag from sections.
146 Skip group section flag when renumbering section indexes.
147 * unstrip.c (struct section): Add sig field.
148 (compare_unalloc_sections): Take and use sig1 and sig2 as arguments.
149 (compare_sections): Pass signatures to compare_unalloc_sections.
150 (get_group_sig): New function.
151 (find_alloc_sections_prelink): Set signature.
152 (copy_elided_sections): Likewise and pass them on.
153 (find_unalloc_section): Take and pass signatures.
155 2018-10-02 Andreas Schwab <schwab@suse.de>
157 * strip.c (handle_elf): Handle ADD/SUB relocation.
159 2018-09-13 Mark Wielaard <mark@klomp.org>
161 * readelf.c (print_shdr): Get number of section with elf_getshdrnum.
162 (print_phdr): Likewise.
164 2018-09-13 Mark Wielaard <mark@klomp.org>
166 * strip.c (handle_elf): Check against shstrndx, not e_shstrndx.
167 Explicitly set shdrstrndx for debug file.
168 * unstrip.c (copy_elf): Explicitly copy shstrndx.
169 (find_alloc_sections_prelink): Document shnum usage.
171 2018-09-13 Mark Wielaard <mark@klomp.org>
173 * elflint.c (check_elf_header): Use shnum instead of e_shnum for all
175 (check_symtab): Use shstrndx instead of e_shstrndx to get section
178 2018-09-13 Mark Wielaard <mark@klomp.org>
180 * elfcmp.c (main): Get, check and shdrstrndx for section names.
182 2018-09-12 Mark Wielaard <mark@klomp.org>
184 * elfcmp.c (main): Call ebl_section_strip_p without ehdr.
185 * strip.c (handle_elf): Likewise.
187 2018-09-12 Mark Wielaard <mark@klomp.org>
189 * elflint.c (check_symtab): Call ebl_check_special_symbol without
192 2018-07-30 Mark Wielaard <mark@klomp.org>
194 * strip.c (handle_elf): Track allocated/unallocated sections seen. Set
195 section offset of unallocated sections after handling all allocated
198 2018-08-18 Mark Wielaard <mark@klomp.org>
200 * readelf.c (print_debug_aranges_section): Make sure there is enough
201 data to read the header segment size.
203 2018-08-18 Mark Wielaard <mark@klomp.org>
205 * elflint.c (check_sysv_hash): Calculate needed size using unsigned
206 long long int to prevent overflow.
207 (check_sysv_hash64): Calculate maxwords used separately before
208 comparison to prevent overflow.
210 2018-07-24 Mark Wielaard <mark@klomp.org>
212 * unstrip.c (compare_unalloc_sections): Also compare sh_size.
214 2018-07-21 Mark Wielaard <mark@klomp.org>
216 * unstrip.c (adjust_all_relocs): Skip SHT_GROUP sections.
218 2018-07-21 Mark Wielaard <mark@klomp.org>
220 * elfcompress.c (get_sections): New function.
221 (process_file): Check whether section needs to change. Don't rewrite
222 file if no section data needs changing.
223 (main): Update 'force' help text.
225 2018-07-21 Mark Wielaard <mark@klomp.org>
227 * elfcompress.c (process_file): Swap fchmod and fchown calls.
229 2018-07-04 Mark Wielaard <mark@klomp.org>
231 * readelf.c (print_debug_addr_section): Rename index var to uidx.
232 (attr_callback): Rename index var to word.
233 (print_debug_str_offsets_section): Rename index var to uidx.
235 2018-07-04 Ross Burton <ross.burton@intel.com>
237 * addr2line.c: Remove error.h include.
239 * arlib.c: Likewise and add system.h include.
240 * arlib2.c: Likewise.
241 * elfcmp.c: Likewise.
242 * elfcompress.c: Likewise.
243 * elflint.c: Likewise.
244 * findtextrel.c: Likewise.
246 * objdump.c: Likewise.
247 * ranlib.c: Likewise.
248 * readelf.c: Likewise.
250 * strings.c: Likewise.
252 * unstrip.c: Likewise.
254 2018-06-25 Mark Wielaard <mark@klomp.org>
256 * readelf.c (print_decoded_line_section): Use dwarf_next_lines
257 instead of dwarf_nextcu.
258 (print_debug_line_section): Don't explicitly lookup CU.
260 2018-06-15 Mark Wielaard <mark@klomp.org>
262 * readelf.c (attr_callback): Only print block as expressions if it
263 isn't DW_FORM_data16.
265 2018-06-12 Mark Wielaard <mark@klomp.org>
267 * readelf.c (print_form_data): Check we have 4, not 2, bytes
268 available for DW_FORM_block4.
270 2018-06-12 Mark Wielaard <mark@klomp.org>
272 * readelf.c (print_form_data): Don't increase strreadp after use.
273 Do increase readp for DW_FORM_strx[1234].
275 2018-06-16 Mark Wielaard <mark@klomp.org>
277 * readelf.c (print_debug_loc_section): Make sure next_off doesn't
280 2018-06-13 Mark Wielaard <mark@klomp.org>
282 * readelf.c (die_type_sign_bytes): New function.
283 (attr_callback): Recognized DW_FORM_implicit_cost as signed. Use
284 die_type_sign_bytes to lookup the signedness and size of const
287 2018-06-11 Mark Wielaard <mark@klomp.org>
289 * readelf.c (print_form_data): Don't reuse readp and readendp when
290 reading str_offsets section.
292 2018-06-10 Mark Wielaard <mark@klomp.org>
294 * readelf.c (print_form_data): Don't cast value to ptrdiff_t, cast
297 2018-06-08 Mark Wielaard <mark@klomp.org>
299 * readelf.c (print_debug_rnglists_section): Calculate max_entries
300 instead of needed bytes to prevent overflowing. Always print
301 max_entries (but not more).
302 (print_debug_loclists_section): Likewise.
304 2018-06-08 Mark Wielaard <mark@klomp.org>
306 * readelf.c (print_debug_line_section): Stop printing directories
307 and files when we are at the end of the unit data.
309 2018-06-07 Mark Wielaard <mark@klomp.org>
311 * readelf.c (format_result): Removed.
312 (format_result_size): Removed.
313 (format_dwarf_addr): Renamed to...
314 (print_dwarf_addr): ...this. Simply call printf, don't setup buffer,
316 (print_ops): Use print_dwarf_addr instead of format_dwarf_addr.
317 (print_debug_addr_section): Likewise.
318 (print_debug_aranges_section): Likewise.
319 (print_debug_rnglists_section): Likewise.
320 (print_debug_ranges_section): Likewise.
321 (print_debug_frame_section): Likewise.
322 (attr_callback): Likewise.
323 (print_decoded_line_section): Likewise.
324 (print_debug_line_section): Likewise.
325 (print_debug_loclists_section): Likewise.
326 (print_debug_loc_section): Likewise.
327 (print_gdb_index_section): Likewsie.
329 2018-06-05 Mark Wielaard <mark@klomp.org>
331 * readelf.c (print_debug_addr_section): Set unit_length always to
332 (next_unitp - readp) in case we don't have a real header.
334 2018-06-05 Mark Wielaard <mark@klomp.org>
336 * readelf.c (print_debug_loc_section): Set begin to idx when failing
337 to read the start address if DW_LLE_GNU_start_end_entry.
339 2018-06-05 Mark Wielaard <mark@klomp.org>
341 * readelf.c (handle_sysv_hash): Don't leak lengths array when
342 detecting an invalid chain.
343 (handle_sysv_hash64): Likewise.
345 2018-06-05 Mark Wielaard <mark@klomp.org>
347 * readelf.c (print_debug_macro_section): Extend vendor array by one
348 to include max DW_MACRO_hi_user opcode.
350 2018-06-07 Mark Wielaard <mark@klomp.org>
352 * readelf.c (main): Lookup "no" for no_str.
353 (print_debug_abbrev_section): Use yes_str and no_str.
354 (print_form_data): Likewise.
356 2018-06-04 Mark Wielaard <mark@klomp.org>
358 * readelf (format_result): New static char pointer.
359 (format_result_size): New static size_t.
360 (format_dwarf_addr): Calculate max string size, reuse format_result
361 if possible, otherwise realloc. Use sprintf on result, not asprintf.
362 (print_ops): Don't free format_dwarf_addr, make sure result is
363 printed before calling format_dwarf_addr again.
364 (print_debug_addr_section): Likewise.
365 (print_debug_aranges_section): Likewise.
366 (print_debug_rnglists_section): Likewise.
367 (print_debug_ranges_section): Likewise.
368 (print_debug_frame_section): Likewise.
369 (attr_callback): Likewise.
370 (print_decoded_line_section): Likewise.
371 (print_debug_line_section): Likewise.
372 (print_debug_loclists_section): Likewise.
373 (print_debug_loc_section): Likewise.
374 (print_gdb_index_section): Likewsie.
376 2018-06-04 Mark Wielaard <mark@klomp.org>
378 * readelf.c (yes_str): New static char pointer.
380 (main): Set yes_str and no_str using gettext.
381 (attr_callback): Use yes_str and no_str instead of calling gettext.
383 2018-06-04 Mark Wielaard <mark@klomp.org>
385 * readelf.c (main): Call __fsetlocking (stdout, FSETLOCKING_BYCALLER).
387 2018-05-31 Mark Wielaard <mark@klomp.org>
389 * readelf.c (print_debug_units): Print the dwo name and id when
390 unable to find a .dwo file.
392 2018-05-31 Mark Wielaard <mark@klomp.org>
394 * readelf.c (enum section_e): Make section_types not an alias of
396 (section_all): Add section_types.
397 (parse_opt): Add both section_info and section_types for "info"
399 (print_debug_units): Don't be silent for debug_types.
401 2018-05-31 Mark Wielaard <mark@klomp.org>
403 * readelf.c (attr_callback): Only register section_loc when not
404 looking at a split dwarf from a skeleton.
406 2018-05-30 Mark Wielaard <mark@klomp.org>
408 * readelf.c (print_debug_loc_section): Use correct listptr for
411 2018-05-31 Mark Wielaard <mark@klomp.org>
413 * readelf.c (print_debug_units): Check offset against -1 not ~0ul.
415 2018-05-29 Mark Wielaard <mark@klomp.org>
417 * readelf.c (print_debug_loc_section): Handle GNU DebugFission list
420 2018-05-29 Mark Wielaard <mark@klomp.org>
422 * readelf.c (print_debug): Record and reset section_info status in
423 implicit_debug_sections and print_debug_sections.
425 2018-05-28 Mark Wielaard <mark@klomp.org>
427 * readelf.c (print_debug_units): Turn "Could not find split compile
428 unit" into an Warning instead of an error.
430 2018-04-29 Mark Wielaard <mark@klomp.org>
432 * readelf.c (parse_opt): Request implicit section_info for "str".
433 (known_stroffbases): New static variable.
434 (attr_callbackattr_callback): Handle DW_AT_str_offets_base.
435 (print_debug_str_offsets_section): New function.
436 (print_debug): Handle .debug_str_offsets as section_str. Reset
439 2018-04-27 Mark Wielaard <mark@klomp.org>
441 * readelf.c (options): Add addr.
442 (enum section_e): Add section_addr.
443 (section_all): Add section_addr.
444 (parse_opt): Parse "addr".
445 (known_addrbases): New static variable.
446 (get_listptr): New function.
447 (print_debug_addr_section): Likewise.
448 (attr_callback): Handle DW_AT_addr_base and DW_AT_GNU_addr_base.
449 (print_debug): Add NEW_SECTION (addr). Reset known_addrbases.
451 2018-04-07 Mark Wielaard <mark@klomp.org>
453 * readelf.c (attr_callback): Handle DW_FORM_loclistx and
456 2018-04-12 Mark Wielaard <mark@klomp.org>
458 * readelf.c (dwarf_loc_list_encoding_string): New functions.
459 (dwarf_loc_list_encoding_name): Likewise.
460 (known_loclistptr): Renamed and split in two...
461 (known_locsptr): this and ...
462 (known_loclistsptr): this.
463 (listptr_base): Split out...
464 (cudie_base): ...this.
465 (is_split_dwarf): New function.
466 (attr_callback): Handle DW_AT_loclists_base and notice sec_offset
468 (print_debug_rnglists_section): Use spit_dwarf_cu_base.
469 (print_debug_loclists_section): New function.
470 (print_debug_loc_section): Use known_locsptr instead of
472 (print_debug): Recognize .debug_loclists. Reset known_locsptr and
475 2018-05-25 Mark Wielaard <mark@klomp.org>
477 * readelf.c (DWARF_SKELETON): New constant.
478 (do_not_close_dwfl): New bool.
479 (options): Add dwarf-skeleton.
480 (dwarf_skeleton): New static variable.
481 (parse_opt): Handle DWARF_SKELETON, set dwarf_skeleton.
482 (create_dwfl): New function, with code extracted from...
483 (process_file): ...here. Check do_not_close_dwfl.
484 (is_split_darf): New function.
485 (getone_dwflmod): Likewise.
486 (print_debug): Use new functions to find skeleton DWARF file to use
487 when inspecting .dwo split DWARF file.
489 2018-04-11 Mark Wielaard <mark@klomp.org>
491 * readelf.c (dwarf_range_list_encoding_string): New function.
492 (dwarf_range_list_encoding_name): Likewise.
493 (known_rnglistptr): New static variable.
494 (listptr_cu): New function.
495 (print_debug_rnglists_section): Likewise.
496 (attr_callback): Call notice_listptr for DW_AT_ranges. Handle
497 DW_AT_rnglists_base. Handle DW_FORM_rnglistx. DW_AT_start_scope
498 can also have a rnglist.
499 (print_debug_units): Do (silently) scan split DWARF also for
500 debug_ranges before DWARF5 to catch all rangelistptrs.
501 (print_debug): Recognize .debug_rnglists. Reset known_rnglistptr.
503 2018-01-21 Mark Wielaard <mark@klomp.org>
505 * readelf.c (get_indexed_addr): New function.
506 (print_ops): Handle DW_OP_addrx, DW_OP_GNU_addr_index,
507 DW_OP_constx, DW_OP_GNU_const_index separately and resolve
509 (attr_callback): Print index and address for
510 DW_FORM_GNU_addr_index and DW_FORM_addrx[1234].
512 2018-01-19 Mark Wielaard <mark@klomp.org>
514 * readelf.c (options): Add info+.
515 (show_split_units): New static boolean defaulting to false.
516 (parse_opt): For all (no arg) --debug-dump set show_split_units
517 to yes. For "info+" enable section_info and show_split_units.
518 (attrcb_args): Add is_split field.
519 (attr_callback): Use is_split to format DIE offsets differently.
520 (print_debug_units): Likewise. Get subdie (type or split) only
521 when needed. When not silent reiterate over split DIEs when
524 2018-05-15 Mark Wielaard <mark@klomp.org>
526 * readelf.c (print_debug_units): Print unit type and id for any
527 unit type that has it even when version < 5.
529 2018-05-14 Mark Wielaard <mark@klomp.org>
531 * readelf.c (print_ops): Handle DW_OP_GNU_addr_index and
532 DW_OP_GNU_const_index.
533 (attr_callback): Handle DW_FORM_GNU_addr_index as DW_FORM_addrx.
534 Handle DW_FORM_GNU_str_index as DW_FORM_constx. Add as_hex_id.
535 Handle DW_AT_GNU_dwo_id as_hex_id.
536 (print_form_data): Handle DW_FORM_GNU_str_index as DW_FORM_strx.
538 2018-05-12 Mark Wielaard <mark@klomp.org>
540 * readelf.c (print_debug): Also recognize .dwo section name variants.
542 2018-05-15 Dmitry V. Levin <ldv@altlinux.org>
544 * elflint.c (check_elf_header): Fix typo in error diagnostics.
546 2018-05-15 Mark Wielaard <mark@klomp.org>
548 * readelf.c (print_form_data): Cast comparisons against offset_len to
550 (print_debug_line_section): Print uint64_t as PRIu64.
552 2018-05-11 Mark Wielaard <mark@klomp.org>
554 * readelf.c (print_debug_macro_section): Use libdw_valid_user_form.
555 Use print_form_data for strx and sup strings.
557 2018-05-09 Mark Wielaard <mark@klomp.org>
559 * readelf.c (dwarf_line_content_description_string): New function.
560 (dwarf_line_content_description_name): Likewise.
561 (print_bytes): Likewise.
562 (print_form_data): Likewise. Based on code taken from...
563 (print_debug_macro_section): ...here. Now calls print_form_data
564 and str_offsets_base_off.
565 (print_debug_line_section): Parse DWARF5 header, directory and file
568 2018-05-12 Mark Wielaard <mark@klomp.org>
570 * addr2line.c (main): Add fflush (stdout) after handle_address ()
571 when reading from stdin.
573 2018-04-24 Mark Wielaard <mark@klomp.org>
575 * readelf.c (print_debug_aranges_section): Try elf_rawdata if no
577 (print_debug_ranges_section): Likewise.
578 (print_debug_frame_section): Likewise.
579 (print_debug_line_section): Likewise. Check for data == NULL.
580 (print_debug_loc_section): Likewise.
581 (print_debug_macinfo_section): Likewise.
582 (print_debug_macro_section): Likewise.
584 2018-04-28 Mark Wielaard <mark@klomp.org>
586 * readelf.c (print_debug): If .debug_info is needed implicitly by
587 then handle it first before handling any other debug section.
588 (parse_opt): Set implicit_debug_sections to section_info when
589 showing all debug sections.
591 2018-05-05 Mark Wielaard <mark@klomp.org>
593 * readelf.c (attr_callback): Handle DW_FORM_ref_sup4 and
594 DW_FORM_ref_sup8 as references.
596 2018-04-24 Mark Wielaard <mark@klomp.org>
598 * readelf.c (print_debug_str_section): Take raw section data. Don't
599 use dwarf_getstring, but determine start and end of string from
600 offset and section data directly.
601 (print_debug): Handle ".debug_line_str" like ".debug_str".
603 2018-04-19 Andreas Schwab <schwab@suse.de>
605 * elflint.c (valid_e_machine): Add EM_RISCV.
607 2018-04-16 Mark Wielaard <mark@klomp.org>
609 * readelf.c (print_debug_line_section). In advance_pc, advance
610 using op_addr_advance, not op_advance.
612 2018-04-14 Mark Wielaard <mark@klomp.org>
614 * readelf.c (attr_callback): Only show errors when not silent.
616 2018-03-23 Mark Wielaard <mark@klomp.org>
618 * readelf.c (attr_callback): Handle DW_FORM_strx[1234].
620 2018-03-22 Mark Wielaard <mark@klomp.org>
622 * readelf.c (attr_callback): Handle DW_FORM_addrx[1234].
624 2018-03-28 Mark Wielaard <mark@klomp.org>
626 * readelf.c (handle_sysv_hash): Break bucket chain after nchain
628 (handle_sysv_hash64): Likewise.
630 2018-03-27 Mark Wielaard <mark@klomp.org>
632 * readelf.c (attr_callback): Print dwarf_dieoffset as %PRIx64,
635 2018-03-20 Mark Wielaard <mark@klomp.org>
637 * readelf.c (attr_callback): Report error when DW_AT_decl_file or
638 DW_AT_call_file cannot be resolved.
640 2018-03-06 Mark Wielaard <mark@klomp.org>
642 * readelf.c (print_ops): Handle DW_OP_addrx, DW_OP_constx,
643 DW_OP_implicit_pointer, DW_OP_entry_value, DW_OP_const_type,
644 DW_OP_regval_type, DW_OP_deref_type, DW_OP_xderef_type,
645 DW_OP_convert, DW_OP_reinterpret.
647 2018-03-01 Mark Wielaard <mark@klomp.org>
649 * readelf.c (struct listptr): Add attr field.
650 (compare_listptr): Warn when two listptrs for the same offset have
651 different attributes.
652 (notice_listptr): Take attr as argument and add it to listptr.
653 (skip_listptr_hole): New attr argument.
654 (next_listptr_offset): New function.
655 (print_debug_ranges_section): Pass NULL attr to skip_listptr_hole.
656 (attr_callback): Handle DW_AT_GNU_locviews. Call notice_listptr with
658 (print_debug_loc_section): Keep track of which attr is associated with
659 a listptr. If the attr is DW_AT_GNU_locview print view pairs till the
662 2018-02-09 Mark Wielaard <mark@klomp.org>
664 * elflint.c (check_group): Make sure we can read a complete
665 element when iterating over the group.
667 2018-02-09 Mark Wielaard <mark@klomp.org>
669 * readelf.c (attr_callback): Handle DW_FORM_data16 as Dwarf_Block.
671 2018-02-09 Mark Wielaard <mark@klomp.org>
673 * readelf.c (print_debug_abbrev_section): Print the value of a
674 DW_FORM_implicit_const using dwarf_getabbrevattr_data.
675 (attr_callback): Handle DW_FORM_implicit_const.
677 2018-01-30 Mark Wielaard <mark@klomp.org>
679 * readelf.c (dwarf_unit_string): New function.
680 (dwarf_unit_name): Likewise.
681 (print_debug_units): Use dwarf_get_units and dwarf_cu_die instead
682 of dwarf_next_unit. Print unit type, id and subdie if available.
684 2018-02-09 Joshua Watt <JPEWhacker@gmail.com>
686 * addr2line.c (handle_address): Use FALLTHROUGH macro instead of
688 * elfcompress.c (parse_opt): Likewise.
689 * elflint.c (check_dynamic): Likewise.
690 (check_sections): Likewise.
691 (check_note_data): Likewise.
692 * objdump.c (parse_opt): Likewise.
693 * readelf.c (parse_opt): Likewise.
694 (attr_callback): Likewise.
695 (handle_auxv_note): Likewise.
696 * strings.c (parse_opt): Likewise.
697 * backtrace.c (callback_verify): Likewise.
699 2018-01-25 Mark Wielaard <mark@klomp.org>
701 * readelf.c (print_debug_ranges_section): Initialize cu to last_cu.
702 (print_debug_loc_section): Likewise.
704 2018-01-01 Mark Wielaard <mark@klomp.org>
706 * readelf.c (attr_callback): Use dwarf_form_name for unknown forms.
707 (print_debug_macro_section): Print form using dwarf_form_name.
709 2017-12-28 Mark Wielaard <mark@klomp.org>
711 * readelf.c (print_debug_units): Print DIE offset in error message
714 2017-12-18 Mark Wielaard <mark@klomp.org>
716 * readelf.c (handle_notes_data): Don't use EXIT_FAILURE in error.
717 Adjust error message depending on whether or not we got data.
719 2017-12-07 Mark Wielaard <mark@klomp.org>
721 * readelf.c (print_ops): Update data pointer and print arguments
722 to DW_OP_call2 and DW_OP_call4 as DIE offsets.
724 2017-11-29 Mark Wielaard <mark@klomp.org>
726 * readelf.c (argp_options): Add "section-groups", 'g'.
728 2017-11-29 Mark Wielaard <mark@klomp.org>
730 * readelf.c (print_debug_loc_section): Print CU base and unresolved
731 addresses. Adjust formatting.
733 2017-11-29 Mark Wielaard <mark@klomp.org>
735 * readelf.c (print_debug_ranges_section): Print CU base and unresolved
736 addresses. Adjust formatting.
738 2017-11-29 Mark Wielaard <mark@klomp.org>
740 * readelf.c (attr_callback): Set valuestr to resolved file name
741 for DW_AT_decl_file and DW_AT_call_file.
743 2017-11-29 Mark Wielaard <mark@klomp.org>
745 * readelf.c (print_debug_units): Print abbrev code after DIE tag.
747 2017-11-29 Mark Wielaard <mark@klomp.org>
749 * readelf.c (print_ops): Use only2 space for index. re-indent +5
750 for DW_OP_GNU_entry_value.
752 2017-11-21 Mark Wielaard <mark@klomp.org>
754 * readelf.c (attr_callback): Print attribute name and form in error
755 message. If only the value cannot be retrieved/resolved don't abort.
757 2017-10-03 Mark Wielaard <mark@klomp.org>
759 * readelf.c (attr_callback): Print DIE offset in error messages.
761 2017-11-03 Mark Wielaard <mark@klomp.org>
763 * readelf.c (print_ops): Handle DW_OP_GNU_variable_value. Print
764 referenced DIE as offset.
766 2017-09-10 Mark Wielaard <mark@klomp.org>
768 * ar.c (do_oper_delete): Remove DEBUG conditional check.
769 (no0print): Return bool. Check snprintf return value.
770 (do_oper_insert): Initialize elf. Remove DEBUG conditional check.
771 Check no0print calls succeed. Explicitly elf_end found elfs.
772 (do_oper_extract): Make sure we don't create an empty variable
775 2017-09-01 Mark Wielaard <mark@klomp.org>
777 * stack.c (main): Replace \v in doc string with \n\n.
778 * unstrip.c (main): Likewise.
780 2017-05-04 Ulf Hermann <ulf.hermann@qt.io>
782 * stack.c: Print pid_t using %lld.
784 2017-08-18 Ulf Hermann <ulf.hermann@qt.io>
786 * readelf.c: Hardcode the signal numbers for non-linux systems.
788 2017-07-26 Mark Wielaard <mark@klomp.org>
790 * readelf.c (print_debug_macro_section): Accept either version 4 or
791 version 5. Use DW_MACRO names instead of DW_MACRO_GNU names. Add
792 minimal support for DW_MACRO_define_sup, DW_MACRO_undef_sup,
793 DW_MACRO_import_sup, DW_MACRO_define_strx and DW_MACRO_undef_strx.
795 2017-07-26 Mark Wielaard <mark@klomp.org>
797 * readelf.c (dwarf_defaulted_string): New function.
798 (dwarf_defaulted_name): Likewise.
799 (attr_callback): Use dwarf_defaulted_name to get value of
802 2017-07-20 Mark Wielaard <mark@klomp.org>
804 * strip.c (handle_elf): Deal with data marker symbols pointing to
805 debug sections (they can be removed).
807 2017-07-14 Mark Wielaard <mark@klomp.org>
809 * strip (OPT_KEEP_SECTION): New define.
810 (options): Add documentation for remove-section. Add keep-section.
811 (struct section_pattern): New data type.
812 (keep_secs, remove_secs): New globals.
813 (add_pattern, free_sec_patterns, free_patterns, section_name_matches):
815 (main): Call free_patterns.
816 (parse_opt): Handle 'R' and OPT_KEEP_SECTION. Check remove_comment
818 (handle_elf): Handle and sanity check keep_secs and remove_secs.
820 2017-06-07 Mark Wielaard <mark@klomp.org>
822 * strip.c (handle_elf): Introduce new handle_elf boolean. Use it to
823 determine whether to create an output and/or debug file. Remove new
824 output file on error.
826 2017-06-06 Mark Wielaard <mark@klomp.org>
828 * strip.c (handle_elf): Assume e_shstrndx section can be removed.
830 2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
832 * readelf.c: Include strings.h.
834 2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
836 * unstrip.c: Check shnum for 0 before subtracting from it.
838 2017-04-20 Ulf Hermann <ulf.hermann@qt.io>
840 * readelf.c: Replace YESSTR and NOSTR with gettext ("yes") and
841 gettext ("no"), respectively.
843 2017-04-05 Mark Wielaard <mark@klomp.org>
845 * elflint.c (check_elf_header): Decompress all sections.
847 2017-03-28 Mark Wielaard <mark@klomp.org>
849 * elflint (check_group): Don't check if there is no flag word.
851 2017-03-27 Mark Wielaard <mark@klomp.org>
853 * elflint.c (check_elf_header): Sanity check phnum and shnum.
855 2017-03-27 Mark Wielaard <mark@klomp.org>
857 * elflint.c (check_sysv_hash): Return early if section size is
859 (check_sysv_hash64): Likewise.
860 (check_hash): Calculate expect_entsize to check section size.
862 2017-03-27 Mark Wielaard <mark@klomp.org>
864 * elflint.c (check_symtab_shndx): Check data->d_size.
866 2017-03-24 Mark Wielaard <mjw@redhat.com>
868 * elfcmp.c (main): If n_namesz == 0 then the note name data is the
870 * readelf.c (handle_notes_data): Likewise.
872 2017-03-24 Mark Wielaard <mjw@redhat.com>
874 * readelf.c (handle_gnu_hash): Check inner < max_nsyms before
875 indexing into chain array.
877 2017-02-16 Ulf Hermann <ulf.hermann@qt.io>
879 * addr2line.c: Include printversion.h
881 * elflint.c: Likewise.
883 * objdump.c: Likewise.
884 * ranlib.c: Likewise.
885 * readelf.c: Likewise.
888 * strings.c: Likewise.
890 * elfcmp.c: Include printversion.h, remove system.h include.
891 * elfcompress.c: Likewise.
892 * findtextrel.c: Likewise.
893 * unstrip.c: Likewise.
895 2017-02-14 Ulf Hermann <ulf.hermann@qt.io>
897 * nm.c: Include color.h.
898 * objdump.c: Likewise.
900 2016-12-24 Mark Wielaard <mark@klomp.org>
902 * Makefile.am (findtextrel_LDADD): Add $(libeu).
903 (addr2line_LDADD): Likewise.
904 (elfcmp_LDADD): Likewise.
905 * addr2line.c (print_version): Removed.
906 * ar.c (print_version): Likewise.
907 * elfcmp.c (print_version): Likewise.
908 * elfcompress.c (print_version): Likewise.
909 * elflint.c (print_version): Likewise.
910 * findtextrel.c (print_version): Likewise.
911 * nm.c (print_version): Likewise.
912 * objdump.c: Likewise.
913 * ranlib.c: Likewise.
914 * readelf.c: Likewise.
917 * strings.c: Likewise.
919 * unstrip.c: Likewise.
921 2016-11-17 Mark Wielaard <mjw@redhat.com>
923 * readelf.c (options): Add optional arg SECTION for symbols.
924 (symbol_table_section): New static variable.
925 (parse_opt): Set symbol_table_section on 's'.
926 (print_symtab): Filter on symbol_table_section name is set.
928 2016-11-10 Mark Wielaard <mjw@redhat.com>
930 * ar.c (write_member): Make sure tmpbuf is large enough to contain
931 a starting '/' and ending '\0' char.
932 (do_oper_insert): Likewise.
933 * arlib.c (arlib_finalize): Format tmpbuf as PRId32 decimal.
935 2016-11-02 Mark Wielaard <mjw@redhat.com>
937 * addr2line.c (handle_address): Add fallthrough comment.
938 * elfcompress.c (parse_opt): Adjust fallthrough comment.
939 * elflint.c (parse_opt): Add missing break after 'd' case.
940 (check_sections): Add fallthrough comments.
941 * objdump.c (parse_opt): Add explantion for fallthrough comment.
943 2016-10-22 Kevin Cernekee <cernekee@chromium.org>
945 * unstrip.c: Fix "invalid string offset" error caused by using the
946 unstripped .symtab with the stripped .strtab.
948 2016-10-11 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
950 * arlib.c: Remove system.h include, add libeu.h include.
951 * arlib2.c: Remove sys/param.h include.
952 * elfcompress.c: Add libeu.h include.
953 * elflint.c: Remove sys/param.h include, add libeu.h include.
955 * objdump.c: Likewise.
956 * ranlib.c: Likewise.
957 * readelf.c: Likewise.
958 * size.c: Remove sys/param.h include.
959 * strings.c: Likewise, add libeu.h include.
961 * unstrip.c: Likewise.
963 2016-10-06 Mark Wielaard <mjw@redhat.com>
965 * strip.c (handle_elf): Don't remove real symbols from allocated
968 2016-08-25 Mark Wielaard <mjw@redhat.com>
970 * strip.c (handle_elf): Recompress with ELF_CHF_FORCE.
972 2016-08-06 Mark Wielaard <mjw@redhat.com>
974 * strip.c (handle_elf): Uncompress and recompress relocation target
975 section if necessary.
977 2016-07-08 Mark Wielaard <mjw@redhat.com>
979 * Makefile.am (strip_LDADD): Add libdw.
980 * elfcompress.c (process_file): Use dwelf_strtab functions instead of
982 * strip.c (handle_elf): Likewise.
983 * unstrip.c (new_shstrtab): Likewise.
985 2016-07-06 Mark Wielaard <mjw@redhat.com>
987 * elf32-i386.script, i386_ld.c, ld.c, ld.h, ldgeneric.c, ldlex.l,
988 ldscript.y, libld_elf_i386.map, none_ld.c, sectionhash.c,
989 sectionhash.h, symbolhash.c, symbolhash.h, unaligned.h,
990 versionhash.c, versionhash.h, xelf.h: Removed.
991 * Makefile.am (YACC): Removed.
992 (AM_YFLAGS): Removed.
993 (AM_LFLAGS): Removed.
994 (native_ld): Removed.
996 (bin_PROGRAMS): Removed ld.
998 (ld_SOURCES): Removed.
999 (noinst_LIBRARIES): Only libar.a.
1000 (EXTRA_DIST): Just arlib.h and debugpred.h.
1001 (ld_LDADD): Removed.
1002 (ld_LDFLAGS): Removed.
1004 (ldscript.h): Removed.
1006 (CLEANFILES): Just *.gconv.
1007 (MAINTAINERCLEANFILES): Removed.
1009 2016-07-06 Mark Wielaard <mjw@redhat.com>
1011 * unstrip.c (copy_elided_sections): Use unstripped_strent[] from
1012 index zero, instead of one.
1014 2016-06-28 Richard Henderson <rth@redhat.com>
1016 * elflint.c (valid_e_machine): Add EM_BPF.
1018 2016-04-11 David Abdurachmanov <davidlt@cern.ch>
1020 * elfcmp.c (main): Fix self-comparison error with GCC 6.
1022 2016-03-21 Mark Wielaard <mjw@redhat.com>
1024 * nm.c (show_symbols): Check for malloc size argument overflow.
1026 2016-02-13 Mark Wielaard <mjw@redhat.com>
1028 * readelf.c (print_scngrp): Call error when gelf_getshdr fails.
1029 (print_symtab): Likewise.
1030 (handle_hash): Likewise.
1031 (dump_data_section): Print a warning if decompressing fails.
1032 (print_string_section): Likewise.
1034 2016-02-13 Mark Wielaard <mjw@redhat.com>
1036 * elfcompress.c (parse_opt): Don't fallthrough after processing -q.
1038 2016-02-12 Mark Wielaard <mjw@redhat.com>
1040 * strip.c (handle_elf): Correct elf_assert shndxdata check.
1042 2016-02-09 Mark Wielaard <mjw@redhat.com>
1044 * readelf.c (read_encoded): Move up.
1045 (print_cfa_program): Add encoding argument. Use it for read_encoded
1046 when reading DW_CFA_set_loc op.
1047 (print_debug_frame_section): Pass fde_encoding to print_cfa_program.
1049 2016-02-09 Mark Wielaard <mjw@redhat.com>
1051 * elflint.c (compare_hash_gnu_hash): Check hash sh_entsize against
1052 sizeof (Elf64_Xword). Correct invalid sh_entsize error message
1053 section idx and name.
1055 2016-01-13 Mark Wielaard <mjw@redhat.com>
1057 * elflint.c (check_elf_header): Recognize ELFOSABI_FREEBSD.
1059 2016-01-08 Mark Wielaard <mjw@redhat.com>
1061 * elfcompress.c (compress_section): Use %zu to print size_t.
1062 * readelf.c (print_shdr): Use %zx to print size_t.
1064 2015-12-16 Mark Wielaard <mjw@redhat.com>
1066 * elfcompress.c: New file.
1067 * Makefile.am (bin_PROGRAMS): Add elfcompress.
1068 (elfcompress_LDADD): New variable.
1070 2015-12-18 Mark Wielaard <mjw@redhat.com>
1072 * elflint.c (section_flags_string): Add NEWFLAG COMPRESSED.
1073 (check_sections): SHF_COMPRESSED can be on any special section.
1074 SHF_COMPRESSED is a valid section flag. SHF_COMPRESSED cannot
1075 be used together with SHF_ALLOC or with SHT_NOBITS. Should have
1078 2015-10-20 Mark Wielaard <mjw@redhat.com>
1080 * readelf.c (options): Expand -z help text.
1081 (dump_data_section): Check whether we need and can decompress section
1082 data and call elf_rawzdata if so,
1083 (print_string_section): Likewise.
1084 (elf_contains_chdrs): New function.
1085 (process_elf_file): Rename print_unrelocated to print_unchanged,
1086 use elf_contains_chdrs.
1087 (print_scngrp): Check whether section is compressed before use.
1088 (print_symtab): Likewise.
1089 (handle_hash): Likewise.
1091 2015-10-16 Mark Wielaard <mjw@redhat.com>
1093 * readelf.c (argp_option): Describe --decompress,-z.
1094 (print_decompress): New bool.
1095 (parse_opt): Handle -z.
1096 (elf_ch_type_name): New function.
1097 (print_shdr): Print section compress information.
1099 2015-12-31 Mark Wielaard <mjw@redhat.com>
1101 * elflint.c (check_symtab): Add _edata and _end (plus extra underscore
1102 variants) to to the list of possibly dangling symbols.
1104 2015-12-02 Mark Wielaard <mjw@redhat.com>
1106 * nm.c (process_file): Accept fd and pass it on.
1107 (handle_elf): Likewise.
1108 (find_no_debuginfo): New.
1109 (struct getdbg): Likewise.
1110 (getdbg_dwflmod): Likewise.
1111 (show_symbols): Take fd. If the file is ET_REL use libdwfl to get
1112 the relocated Dwarf.
1114 2015-12-02 Mark Wielaard <mjw@redhat.com>
1116 * nm.c (get_local_names): Check for duplicates in local_root tree.
1118 2015-12-02 Mark Wielaard <mjw@redhat.com>
1120 * unstrip.c (struct data_list): New.
1121 (new_data_list): Likewise.
1122 (record_new_data): Likewise.
1123 (free_new_data): Likewise.
1124 (adjust_relocs): Call record_new_data.
1125 (add_new_section_symbols): Likewise.
1126 (copy_elided_sections): Call free_new_data.
1128 2015-12-01 Mark Wielaard <mjw@redhat.com>
1130 * elfcmp.c (main): Close ebl1 and ebl2 backends.
1132 2015-10-16 Mark Wielaard <mjw@redhat.com>
1134 * Makefile.am [BUILD_STATIC](libdw): Add -lz.
1135 [BUILD_STATIC](libelf): Likewise.
1137 2015-10-16 Mark Wielaard <mjw@redhat.com>
1139 * elflint.c (check_symtab): Don't check TLS symbol value against TLS
1140 phdr offset in debuginfo files.
1141 (check_sections): Don't try to match section offsets to phdrs offsets
1144 2015-10-16 Mark Wielaard <mjw@redhat.com>
1146 * elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
1147 SHF_MERGE and SHF_STRINGS set.
1149 2015-10-13 Jose E. Marchesi <jose.marchesi@oracle.com>
1151 * elflint.c (check_sections): Do not rely on
1152 ebl_check_special_section when checking debuginfo files. Also
1153 check that the type of WE sections in debuginfo files is NOBITS.
1155 2015-10-13 Mark Wielaard <mjw@redhat.com>
1157 * elflint.c (check_program_header): Check relro flags are a subset
1158 of the load segment if they don't fully overlap.
1160 2015-10-07 Mark Wielaard <mjw@redhat.com>
1162 * Makefile.am (ldlex_no_Wstack_usage): New.
1163 * ldlex.l ([RWX]): Make cnt unsigned.
1165 2015-10-09 Josh Stone <jistone@redhat.com>
1167 * elflint.c (main): Replace stat64 and fstat64 with stat and fstat.
1168 * readelf.c (process_file): Likewise.
1169 (process_elf_file): Replace off64_t with off_t.
1170 * findtextrel.c (process_file): Replace open64 with open.
1171 * ld.c (main): Replace sizeof (off64_t) with 8.
1172 * strings.c: Replace off64_t with off_t throughout.
1173 (main): Replace stat64 and fstat64 with stat and fstat.
1174 (map_file): Replace mmap64 with mmap.
1175 (read_block): Likewise, and replace lseek64 with lseek.
1176 * strip.c (handle_elf): Replace ftruncate64 with ftruncate.
1177 (process_file): Replace stat64 and fstat64 with stat and fstat.
1178 * unstrip.c (parse_opt): Replace stat64 with stat.
1179 (handle_file): Replace open64 with open.
1180 (open_file): Likewise.
1182 2015-10-08 Chih-Hung Hsieh <chh@google.com>
1184 * ld.c (determine_output_format): Move recursive nested
1185 function "try" to file scope.
1187 2015-10-04 Mark Wielaard <mjw@redhat.com>
1189 * strip.c (handle_elf): Only sanity check section symbols to not
1190 kept discarded sections if we are creating a debug file.
1192 2015-10-07 Mark Wielaard <mjw@redhat.com>
1194 * unstrip.c (MAX): Removed.
1195 (find_alloc_sections_prelink): Allocate exact amount of bytes for
1198 2015-10-05 Chih-Hung Hsieh <chh@google.com>
1200 * unstrip.c (find_alloc_sections_prelink): Do not allocate
1201 on stack union types with variable length arrays; use xmalloc
1202 for such dynamic sized objects.
1203 * readelf.c (handle_core_item): Likewise, but use alloca
1204 for small variable size data object and add assert(count < 128).
1206 2015-10-05 Josh Stone <jistone@redhat.com>
1208 * Makefile.am (libld_elf_i386.so): Add AM_V_CCLD silencer.
1209 (.deps/none_ld.Po): Always silence the dummy command.
1210 (make-debug-archive): Add AM_V_GEN and AM_V_at silencers.
1212 2015-10-02 Mark Wielaard <mjw@redhat.com>
1214 * unstrip.c (copy_elided_sections): Use SH_INFO_LINK_P, not just
1217 2015-10-02 Mark Wielaard <mjw@redhat.com>
1219 * strip.c (handle_elf): Don't move around allocated NOBITS sections.
1220 Don't just mark the section header string table as unused.
1221 * unstrip.c (copy_elided_sections): Add header names to strtab if
1222 shstrndx equals the symtab strtabndx.
1224 2015-09-22 Mark Wielaard <mjw@redhat.com>
1226 * strip.c (cleanup_debug): Remove old-style function definitions.
1228 2015-09-09 Chih-Hung Hsieh <chh@google.com>
1230 * readelf.c (print_debug_exception_table): Initialize variable before
1231 it is used, because compiler does not know that error never returns.
1232 (dump_arhive_index): Likewise.
1234 2015-09-04 Chih-Hung Hsieh <chh@google.com>
1236 * elflint.c (check_group): Replace %Z length modifier with %z.
1237 (check_note_data): Likewise.
1238 * findtextrel.c (process_file): Likewise.
1239 * readelf.c (handle_dynamic): Likewise.
1240 (handle_symtab): Likewise.
1241 (handle_verneed): Likewise.
1242 (handle_verdef): Likewise.
1243 (handle_versym): Likewise.
1244 (print_hash_info): Likewise.
1245 (print_decoded_aranges_section): Likewise.
1246 (print_debug_aranges_section): Likewise.
1247 (print_debug_line_section): Likewise.
1248 (hex_dump): Likewise.
1249 (dump_data_section): Likewise.
1250 (print_string_section): Likewise.
1251 (dump_archive_index): Likewise.
1252 * unstrip.c (adjust_relocs): Likewise.
1253 (collect_symbols): likewise.
1254 (get_section_name): Likewise.
1255 (find_alloc_sections_prelink): Likewise.
1256 (copy_elided_sections): Likewise.
1257 * ldscript.y (add_id_list): Add missing '%s'.
1259 2015-09-03 Mark Wielaard <mjw@redhat.com>
1261 * readelf.c (handle_core_item): Handle right shift >= 32 bits.
1263 2015-08-11 Mark Wielaard <mjw@redhat.com>
1265 * elflint.c (check_sections): When gnuld and a NOBITS section falls
1266 inside a segment make sure any ELF file contents is zero.
1268 2015-07-29 Mark Wielaard <mjw@redhat.com>
1270 * unstrip.c (sections_flags_match): New function.
1271 (sections_match): Use sections_flags_match.
1272 (find_alloc_sections_prelink): Only clear matched sections if there
1274 (copy_elided_sections): Add SHF_INFO_LINK to shdr_mem.sh_flags if
1277 2015-06-27 Pino Toscano <toscano.pino@tiscali.it>
1279 * src/strings.c: Define MAP_POPULATE if not defined already.
1281 2015-06-27 Mark Wielaard <mjw@redhat.com>
1283 * nm.c (show_symbols): First call elf_getdata, then allocate memory.
1285 2015-06-18 Mark Wielaard <mjw@redhat.com>
1287 * findtextrel.c (process_file): Free segments after use.
1289 2015-06-18 Mark Wielaard <mjw@redhat.com>
1291 * readelf.c (print_phdr): Make sure phdr2_mem lifetime/scope equals
1294 2015-06-18 Mark Wielaard <mjw@redhat.com>
1296 * readelf.c (handle_gnu_hash): Free lengths on invalid_data.
1298 2015-06-18 Mark Wielaard <mjw@redhat.com>
1300 * elflint.c (check_symtab): Only check the PT_TLS phdr if it actually
1301 exists. Warn otherwise.
1303 2015-06-18 Mark Wielaard <mjw@redhat.com>
1305 * nm.c (show_symbols): Check sizeof (sym_mem[0]), not GElf_Sym to
1306 known whether or not we stack allocated memory.
1308 2015-06-18 Mark Wielaard <mjw@redhat.com>
1310 * strings.c (readelf): Use "<unknown>" if we cannot retrieve section
1313 2015-06-09 Mark Wielaard <mjw@redhat.com>
1315 * addr2line.c (print_dwarf_function): Always free scopes before
1318 2015-06-09 Mark Wielaard <mjw@redhat.com>
1320 * strip.c (handle_ar): Mark as unused.
1321 (process_file): Produce an error when trying to handle an ar.
1323 2015-05-30 Mark Wielaard <mjw@redhat.com>
1325 * elfcmp.c (main): Only call memcmp when d_size != 0.
1327 2015-05-23 Mark Wielaard <mjw@redhat.com>
1329 * Makefile.am: Define ldgeneric, readelf, nm, size, strip, elflint,
1330 findtextrel, elfcmp objdump, ranlib, ar and unstrip no_Wstack_usage.
1332 2015-05-21 Mark Wielaard <mjw@redhat.com>
1334 * addr2line.c (handle_address): Set scopes to NULL after free.
1336 2015-05-20 Mark Wielaard <mjw@redhat.com>
1338 * addr2line.c (OPT_PRETTY): New constant define.
1339 (argp_option): Add "pretty-print".
1340 (pretty): New static bool.
1341 (parse_opt): Set pretty.
1342 (print_dwarf_function): Adjust output when pretty is set.
1343 (print_addrsym): Likewise.
1344 (handle_address): Likewise.
1346 2015-05-20 Mark Wielaard <mjw@redhat.com>
1348 * Makefile.am (addr2line_LDADD): Add demanglelib.
1349 * addr2line.c (argp_option): Move demangle under output format.
1350 (demangle): New static bool.
1351 (demangle_buffer_len): New static size_t.
1352 (demangle_buffer): New static char *.
1353 (main): free demangle_buffer.
1354 (parse_opt): Set demangle.
1355 (symname): New static function.
1356 (get_diename): Use symname.
1357 (print_dwarf_function): Likewise.
1358 (print_addrsym): Likewise.
1359 (handle_address): Likewise.
1361 2015-05-20 Mark Wielaard <mjw@redhat.com>
1363 * addr2line.c (argp_option): Add "addresses", 'a'.
1364 (print_addresses): New static bool.
1365 (parse_opt): Set print_addresses.
1366 (get_addr_width): New static function.
1367 (handle_address): Print address if print_addresses is true.
1369 2015-05-20 Mark Wielaard <mjw@redhat.com>
1371 * addr2line.c (handle_address): Call strtoumax with base 16. Make
1372 sure all input has been processed.
1374 2015-05-20 Mark Wielaard <mjw@redhat.com>
1376 * addr2line (argp_option): Group 'section' under "Input format
1379 2015-05-12 Mark Wielaard <mjw@redhat.com>
1381 * strip.c (debug_fd): New static variable.
1382 (tmp_debug_fname): Likewise.
1383 (cleanup_debug): New function using the above to clean up temporary
1385 (INTERNAL_ERROR): Call cleanup_debug.
1386 (handle_elf): Use debug_fd and tmp_debug_fname statics and call
1387 cleanup_debug before any error. Use output_fname instead of fname in
1388 error messages when it exists (-o was given). SHT_NOBITS sections
1389 can also be moved freely even if SHF_ALLOC is set. Add various
1390 sanity checks. Use elf_assert instead of plain assert.
1392 2015-05-08 Mark Wielaard <mjw@redhat.com>
1394 * nm.c (show_symbols): Call gelf_fsize with EV_CURRENT.
1395 * strip.c (handle_elf): Likewise.
1397 2015-05-06 Mark Wielaard <mjw@redhat.com>
1399 * elflint.c (check_gnu_hash): Return early when 2nd hash function
1400 shift too big. Check there is enough data available. Make sure
1401 bitmask_words is not zero.
1402 (check_verdef): Use Elf64_Word for shdr->sh_info cnt.
1403 (check_verneed): Likewise.
1404 (check_attributes): Break when vendor name isn't terminated.
1405 Add overflow check for subsection_len.
1407 2015-05-05 Mark Wielaard <mjw@redhat.com>
1409 * nm.c (show_symbols): Handle dwarf_linesrc returning NULL.
1411 2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
1413 * ar.c (do_oper_extract): Replace struct timeval with struct timespec
1414 and futimes with futimens.
1415 * strip.c (process_file): Replace struct timeval with struct timespec.
1416 (handle_elf, handle_ar): Replace struct timeval with struct timespec
1417 in prototype. Replace futimes with futimens.
1419 2015-05-04 Max Filippov <jcmvbkbc@gmail.com>
1421 * addr2line.c (main): Drop mtrace() call and #include <mcheck.h>.
1425 * objdump.c: Likewise.
1426 * ranlib.c: Likewise.
1428 * strip.c: Likewise.
1429 * unstrip.c: Likewise.
1431 2015-05-04 Anthony G. Basile <blueness@gentoo.org>
1433 * Makefile.am (readelf_LDADD, nm_LDADD, size_LDADD, strip_LDADD)
1434 (ld_LDADD, elflint_LDADD, findtextrel_LDADD, addr2line_LDADD)
1435 (elfcmp_LDADD, objdump_LDADD, ranlib_LDADD, strings_LDADD)
1436 (ar_LDADD, unstrip_LDADD, stack_LDADD): Append $(argp_LDADD).
1438 2015-03-22 Mark Wielaard <mjw@redhat.com>
1440 * readelf.c (print_debug_frame_section): Cast start to Dwarf_Off
1441 before subtracting cie_id. And cast cie_offset to Dwarf_Off before
1444 2015-03-22 Mark Wielaard <mjw@redhat.com>
1446 * readelf.c (print_gdb_index_section): Check all offsets used
1447 against section d_size.
1449 2015-03-17 Mark Wielaard <mjw@redhat.com>
1451 * readelf.c (print_debug): Don't return, but always use dummy_dbg.
1453 2015-03-17 Mark Wielaard <mjw@redhat.com>
1455 * readelf.c (print_gdb_index_section): Add overflow checking for
1458 2015-03-14 Mark Wielaard <mjw@redhat.com>
1460 * nm.c (INTERNAL_ERROR): Remove __DATE__.
1461 * objdump.c (INTERNAL_ERROR): Likewise.
1462 * size.c (INTERNAL_ERROR): Likewise.
1463 * strip.c (INTERNAL_ERROR): Likewise.
1465 2015-03-18 Petr Machata <pmachata@redhat.com>
1467 * readelf.c (dwarf_tag_string, dwarf_attr_string)
1468 (dwarf_form_string, dwarf_lang_string, dwarf_inline_string)
1469 (dwarf_encoding_string, dwarf_access_string)
1470 (dwarf_visibility_string, dwarf_virtuality_string)
1471 (dwarf_identifier_case_string, dwarf_calling_convention_string)
1472 (dwarf_ordering_string, dwarf_discr_list_string)
1473 (dwarf_locexpr_opcode_string): Adjust uses of know-dwarf.h macros
1474 to match the API changes.
1476 2015-03-09 Mark Wielaard <mjw@redhat.com>
1478 * elflint.c (compare_hash_gnu_hash): Correct gnu_symbias usage.
1480 2015-01-03 Mark Wielaard <mjw@redhat.com>
1482 * elfcmp (main): Check section name is not NULL. Check sh_entsize
1483 is not zero for symbol tables. Check phdrs are not NULL.
1484 (search_for_copy_reloc): Check sh_entsize is not zero.
1486 2014-12-30 Mark Wielaard <mjw@redhat.com>
1488 * elflint.c (check_scn_group): Check d_buf and name are not NULL.
1489 (is_rel_dyn): Check d is not NULL. Check shdr->sh_entsize is not
1491 (check_dynamic): Check strshdr is not NULL. Check d_tag is positive.
1492 (check_symtab_shndx): Check symshdr and data->d_buf are not NULL.
1493 Check shdr and symshdr sh_entsize are not zero.
1494 (check_gnu_hash): Make sure maskidx is smaller than bitmask_words.
1495 Check symshdr->sh_entsize is not zero. Check data->d_buf is not
1497 (compare_hash_gnu_hash): Check sections d_buf are not NULL.
1498 Check section data is large enough. Use gnu_symbias.
1499 (check_group): Check section val is valid.
1500 (has_copy_reloc): Check sh_entsize is not zero.
1501 (check_versym): Likewise.
1502 (unknown_dependency_p): Likewise.
1503 (check_verneed): Break on invalid ref or offset. Don't assert.
1504 Report error when next offset is zero, but more vers expected.
1505 (check_verdef): Likewise.
1506 (check_attributes): Make sure d_buf is not NULL.
1507 (check_note): Likewise.
1508 (check_note_section): Likewise.
1509 (check_program_header): Make sure section name is not NULL.
1511 2014-12-26 Mark Wielaard <mjw@redhat.com>
1513 * strings.c (read_elf): Produce error when section data falls outside
1516 2014-12-26 Mark Wielaard <mjw@redhat.com>
1518 * nm.c (show_symbols): Guard against divide by zero in error check.
1519 Add section index number in error message.
1521 2014-12-26 Mark Wielaard <mjw@redhat.com>
1523 * nm.c (handle_ar): Skip over /SYM64/ entries.
1525 2014-12-26 Mark Wielaard <mjw@redhat.com>
1527 * nm.c (handle_ar): Break on arsym with invalid offset.
1529 2014-12-20 Mark Wielaard <mjw@redhat.com>
1531 * readelf.c (print_debug_macinfo_section): Mark cus sentinel files
1532 as -1 non-existent. Check macoff against sentinel cus.
1534 2014-12-20 Mark Wielaard <mjw@redhat.com>
1536 * readelf.c (print_debug_exception_table): Add max_action overflow
1537 check. Check action_table_end before reading slib128. Check
1538 max_ar_filter underflow.
1540 2014-12-18 Ulrich Drepper <drepper@gmail.com>
1542 * Makefile.am: Suppress output of textrel_check command.
1544 2014-12-17 Mark Wielaard <mjw@redhat.com>
1546 * readelf.c (print_cfa_program): Add bounds check before each op that
1547 takes at least one argument.
1549 2014-12-16 Mark Wielaard <mjw@redhat.com>
1551 * readelf.c (print_decoded_line_section): Print dwarf_errmsg if
1552 dwarf_onesrcline or dwarf_linesrc fails.
1554 2014-12-16 Mark Wielaard <mjw@redhat.com>
1556 * readelf.c (print_debug_line_section): Correct overflow check for
1558 (print_debug_aranges_section): Correct overflow check for length.
1560 2014-12-15 Mark Wielaard <mjw@redhat.com>
1562 * readelf.c (notice_listptr): Return false if offset doesn't fit
1564 (attr_callback): Warn if loclist or rangelist offset doesn't fit.
1566 2014-12-15 Mark Wielaard <mjw@redhat.com>
1568 * readelf.c (print_ops): Don't assert when addr_size or ref_size
1569 is not 4 or 8, just report invalid data.
1571 2014-12-15 Mark Wielaard <mjw@redhat.com>
1573 * readelf.c (print_gdb_index_section): Add more bounds checks.
1575 2014-12-15 Mark Wielaard <mjw@redhat.com>
1577 * readelf.c (print_debug_line_section): Check there is enough room
1578 for DW_LNE_set_address argument. Make sure there is enough room
1579 for the the initial unit_length.
1581 2014-12-14 Mark Wielaard <mjw@redhat.com>
1583 * elflint.c (check_attributes): Call get_uleb128 with end pointer.
1584 * readelf.c (print_attributes): Likewise.
1585 (print_ops): Likewise and also for get_sleb128.
1586 (print_cfa_program): Likewise and add more readp bounds checks.
1587 (read_encoded): Likewise.
1588 (print_debug_frame_section): Likewise.
1589 (print_debug_line_section): Likewise.
1590 (print_debug_macinfo_section): Likewise.
1591 (print_debug_macro_section): Likewise.
1592 (print_debug_exception_table): Likewise.
1594 2014-12-16 Mark Wielaard <mjw@redhat.com>
1596 * elfcmp.c (compare_Elf32_Word): Make sure (unsigned) Elf32_Word
1597 difference doesn't wrap around before returning as int.
1599 2014-12-11 Mark Wielaard <mjw@redhat.com>
1601 * readelf.c (print_debug_exception_table): Check TType base offset
1602 and Action table are sane.
1604 2014-12-11 Mark Wielaard <mjw@redhat.com>
1606 * readelf.c (print_debug_frame_section): Check number of augmentation
1609 2014-12-09 Mark Wielaard <mjw@redhat.com>
1611 * readelf.c (handle_file_note): Check count fits data section and
1612 doesn't overflow fptr.
1614 2014-12-08 Mark Wielaard <mjw@redhat.com>
1616 * readelf.c (print_debug_exception_table): Report invalid data if
1617 action table doesn't immediately follow call site table.
1619 2014-12-10 Josh Stone <jistone@redhat.com>
1621 * addr2line.c (get_diename): New, get linkage_name or name.
1622 * addr2line.c (print_dwarf_function): Use get_diename.
1623 * addr2line.c (handle_address): Likewise.
1624 * addr2line.c (print_diesym): Removed.
1626 2014-12-10 Josh Stone <jistone@redhat.com>
1628 * addr2line.c (handle_address): Find the proper inline parents.
1630 2014-12-07 Mark Wielaard <mjw@redhat.com>
1632 * readelf.c (print_debug_line_section): max_ops_per_instr cannot
1635 2014-12-07 Mark Wielaard <mjw@redhat.com>
1637 * readelf.c (print_ops): Handle zero ref_size for DW_OP_call_ref
1638 and DW_OP_GNU_implicit_pointer.
1640 2014-12-04 Mark Wielaard <mjw@redhat.com>
1642 * objdump.c (show_relocs_x): Make sure destshdr exists.
1643 (show_relocs_rel): Don't rely on shdr->sh_entsize, use gelf_fsize.
1644 (show_relocs_rela): Likewise.
1645 (show_relocs): Make sure destshdr, symshdr and symdata exists.
1647 2014-11-30 Mark Wielaard <mjw@redhat.com>
1649 * readelf.c (handle_sysv_hash64): Fix overflow check.
1651 2014-11-28 Mark Wielaard <mjw@redhat.com>
1653 * readelf.c (handle_relocs_rel): Don't reuse destshdr to store
1654 section header of a relocation against a STT_SECTION symbol. Use
1655 a new local variable secshdr.
1656 (handle_relocs_rela): Likewise.
1658 2014-11-26 Mark Wielaard <mjw@redhat.com>
1660 * readelf.c (print_debug_aranges_section): Cast Dwarf_Word length
1661 to ptrdiff_t for comparison.
1663 2014-11-24 Mark Wielaard <mjw@redhat.com>
1665 * readelf.c (print_debug_line_section): Check line_range is not zero
1668 2014-11-23 Mark Wielaard <mjw@redhat.com>
1670 * readelf.c (print_debug_aranges_section): Check length to catch
1673 2014-11-21 Mark Wielaard <mjw@redhat.com>
1675 * readelf.c (print_attributes): Guard against empty section.
1676 Document attribute format. Break when vendor name isn't terminated.
1677 Add overflow check for subsection_len. Handle both gnu and non-gnu
1680 2014-11-22 Mark Wielaard <mjw@redhat.com>
1682 * elflint.c (check_sections): Call ebl_bss_plt_p without ehdr.
1683 * findtextrel.c (process_file): Use elf_getphdrnum.
1684 * readelf.c (process_elf_file): Remove redundant ehdr->e_phoff check.
1685 (print_phdr): Check phnum.
1686 * size.c (show_segments): Use elf_getphdrnum.
1687 * strip.c (handle_elf): Likewise.
1688 * unstrip.c (copy_elf): Likewise.
1689 (copy_elided_sections): Likewise.
1690 (handle_file): Likewise.
1692 2014-11-18 Mark Wielaard <mjw@redhat.com>
1694 * readelf.c (print_cfa_program): Fix sanity check of DW_FORM_block
1697 2014-11-17 Mark Wielaard <mjw@redhat.com>
1699 * readelf.c (handle_verneed): Check vna_next and vn_next exist.
1700 (handle_verdef): Check vda_next and vd_next exist.
1701 (handle_versym): Check vd_next, vna_next and vn_next exist.
1702 Check vername and filename are not NULL before use.
1704 2014-11-17 Mark Wielaard <mjw@redhat.com>
1706 * elfcmp.c (main): Check section names are NULL before use.
1707 * objdump.c (section_match): Likewise.
1708 * size.c (show_sysv): Likewise.
1710 2014-11-17 Mark Wielaard <mjw@redhat.com>
1712 * readelf.c (print_debug_frame_section): Warn if ptr_size is not 4
1713 or 8 instead of just calling print_cfa_program.
1715 2014-11-16 Mark Wielaard <mjw@redhat.com>
1717 * readelf (process_elf_file): Set phnum to zero if there aren't
1718 actually any pheaders.
1719 (print_phdr): Check there actually is a phdr.
1721 2014-11-16 Mark Wielaard <mjw@redhat.com>
1723 * readelf.c (print_cfa_program): Check block len before calling
1726 2014-11-14 Mark Wielaard <mjw@redhat.com>
1728 * readelf.c (print_debug_frame_section): Sanity Check CIE
1729 unit_length and augmentationlen.
1731 2014-11-14 Mark Wielaard <mjw@redhat.com>
1733 * readelf.c (handle_versym): Check def == NULL before use.
1735 2014-11-08 Mark Wielaard <mjw@redhat.com>
1737 * readelf.c (handle_versym): Initialize vername and filename array
1740 2014-11-07 Mark Wielaard <mjw@redhat.com>
1742 * readelf.c (handle_sysv_hash): Sanity check section contents.
1743 (handle_sysv_hash64): Likewise.
1744 (handle_gnu_hash): Likewise.
1746 2014-09-14 Petr Machata <pmachata@redhat.com>
1748 * readelf.c (handle_relocs_rela): Typo fix, test DESTSHDR properly.
1750 2014-09-12 Petr Machata <pmachata@redhat.com>
1752 * readelf.c (encoded_ptr_size): In the switch statement, change
1753 magic constants 3 and 4 to DW_EH_PE_* counterparts. Still accept
1754 0. Print diagnostic for anything else.
1756 2014-08-25 Josh Stone <jistone@redhat.com>
1758 * Makefile.am: Prevent premature @AR@ replacement in a sed expression.
1760 2014-07-04 Menanteau Guy <menantea@linux.vnet.ibm.com>
1761 Mark Wielaard <mjw@redhat.com>
1763 * elflint (check_symtab): Add ".TOC." to the list of possibly
1764 dangling symbols because of sourceware PR13621.
1766 2014-06-14 Mark Wielaard <mjw@redhat.com>
1768 * elflint (check_symtab): Use ebl_func_addr_mask on st_value.
1770 2014-05-27 Mark Wielaard <mjw@redhat.com>
1772 * readelf.c (print_debug): Skip section if name is NULL.
1774 2014-05-26 Mark Wielaard <mjw@redhat.com>
1776 * readelf.c (handle_relocs_rela): Print header like handle_relocs_rel
1777 does, when sh_info == 0.
1779 2014-05-26 Mark Wielaard <mjw@redhat.com>
1781 * unstrip.c (find_alloc_sections_prelink): Allow non-split .bss
1782 section when sh_size of the original and undo .bss section are equal.
1784 2014-05-26 Mark Wielaard <mjw@redhat.com>
1786 * unstrip.c (options): Add --force, -F.
1787 (struct arg_info): Add bool force.
1788 (parse_opt): Handle 'F', set force.
1789 (handle_explicit_files): Add force argument, add warn function,
1790 separate check ehdr field checks, use warn.
1791 (handle_dwfl_module): Add force argument, pass on to
1792 handle_explicit_files.
1793 (handle_output_dir_module): Add force argument, pass on to
1795 (handle_implicit_modules): Pass info->force to handle_dwfl_module and
1796 handle_output_dir_module.
1797 (main): Pass info.force to handle_explicit_files.
1799 2014-05-19 Mark Wielaard <mjw@redhat.com>
1801 * elflint.c (check_reloc_shdr): Check ebl_check_reloc_target_type.
1803 2014-05-01 Mark Wielaard <mjw@redhat.com>
1805 * readelf.c (find_no_debuginfo): Call dwfl_standard_find_debuginfo
1806 if looking for alternate debug file.
1808 2014-04-11 Mark Wielaard <mjw@redhat.com>
1810 * Makefile.am (AM_CPPFLAGS): Add -I libdwelf.
1812 2014-04-22 Mark Wielaard <mjw@redhat.com>
1814 * readelf.c (handle_core_item): Make sure variable length array
1815 contains at least enough space for terminating zero char.
1817 2014-04-22 Mark Wielaard <mjw@redhat.com>
1819 * readelf.c (print_gdb_index_section): Use unsigned int for 31 bits
1822 2014-03-13 Mark Wielaard <mjw@redhat.com>
1824 * Makefile.am: Remove no_mudflap.os. Remove libmudflap from all
1826 * strings.c (process_chunk): Remove _MUDFLAP condition.
1828 2014-04-09 Mark Wielaard <mjw@redhat.com>
1830 * readelf.c (print_debug_aranges_section): Don't get the raw section
1831 data, use the possibly decompressed .[z]debug sectiondata.
1832 (print_debug_ranges_section): Likewise.
1833 (print_debug_frame_section): Likewise.
1834 (print_debug_line_section): Likewise.
1835 (print_debug_loc_section): Likewise.
1836 (print_debug_macinfo_section): Likewise.
1837 (print_debug_macro_section): Likewise.
1839 2014-04-10 Mark Wielaard <mjw@redhat.com>
1841 * readelf.c (buf_read_ulong): Pass actual long size to convert.
1843 2014-03-05 Mark Wielaard <mjw@redhat.com>
1845 * readelf.c (attr_callback): Print DW_FORM_sdata values as signed
1848 2014-02-24 Mark Wielaard <mjw@redhat.com>
1850 * readelf (print_phdr): Check there is a SHT_PROGBITS section at the
1851 offset given by p_offsets for a PT_INTERP segment before trying to
1852 display the interpreter string.
1854 2014-02-07 Mark Wielaard <mjw@redhat.com>
1856 * readelf.c (print_phdr): Check phdr->p_filesz and make sure
1857 interpreter string is zero terminated before calling printf.
1859 2014-01-22 Mark Wielaard <mjw@redhat.com>
1861 * Makefile.am (nm_no_Wformat): Removed.
1862 (size_no_Wformat): Likewise.
1863 (strings_no_Wformat): Likewise.
1864 (addr2line_no_Wformat): Likewise.
1865 * size.c (show_sysv): Use fmtstr directly as literal in printf.
1866 (show_sysv_one_line): Likewise.
1867 * strings.c (locfmt): Removed.
1868 (radix): New static enum.
1869 (parse_opt): Set radix, not locfmt.
1870 (process_chunk_mb): Use fmtstr directly as literal in printf based
1872 (process_chunk): Likewise.
1873 * nm.c (show_symbols_sysv): Use fmtstr directly as literal in printf.
1874 (show_symbols_bsd): Likewise.
1875 (show_symbols_posix): Likewise.
1877 2014-01-21 Mark Wielaard <mjw@redhat.com>
1879 * stack.c (show_inlines): New static boolean.
1880 (print_frame): New function split out from...
1881 (print_frames): ..here. If show_inlines is true and we found a
1882 DIE for the frame address, call print_inline_frames otherwise
1883 call print_frame. Keep track of and track frame_nr.
1884 (print_inline_frames): New function.
1885 (parse_opt): Handle '-i'.
1886 (main): Add 'i' to options.
1888 2014-01-27 Mark Wielaard <mjw@redhat.com>
1890 * stack.c (maxframes): Initialize to 256.
1891 (main): Document new default in options. Document magic number
1892 used in frames.allocated initialization.
1894 2014-01-20 Mark Wielaard <mjw@redhat.com>
1896 * stack.c (show_debugname): New static boolean.
1897 (die_name): New function.
1898 (print_frames): If show_debugname is true set symname to the
1899 first function-like DIE with a name in scope for the address in
1901 (parse_opt): Handle '-d'.
1902 (main): Add 'd' to options.
1904 2014-01-20 Mark Wielaard <mjw@redhat.com>
1906 * addr2line.c (handle_address): Initialize scopes to NULL.
1908 2014-01-17 Roland McGrath <roland@redhat.com>
1910 * strip.c (handle_elf): Check for bogus values in sh_link, sh_info,
1911 st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data.
1912 Don't use assert on input values, instead bail with "illformed" error.
1914 2014-01-17 Roland McGrath <roland@redhat.com>
1916 * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link.
1917 (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise.
1918 (handle_scngrp): Check for bogus sh_info.
1920 2014-01-17 Jakub Jelinek <jakub@redhat.com>
1922 * elflint.c (section_name): Return "<invalid>" instead of
1923 crashing on invalid section name.
1924 (check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic,
1925 check_symtab_shndx, check_hash, check_versym): Robustify.
1926 (check_hash): Don't check entries beyond end of section.
1927 (check_note): Don't crash if gelf_rawchunk fails.
1929 2014-01-17 Petr Machata <pmachata@redhat.com>
1931 * readelf.c (handle_dynamic, handle_relocs_rel)
1932 (handle_relocs_rela, handle_versym, print_liblist):
1933 Use gelf_fsize instead of relying on shdr->sh_entsize.
1935 2014-01-14 Mark Wielaard <mjw@redhat.com>
1937 * readelf.c (print_debug_macro_section): Clear vendor array before
1940 2014-01-15 Jan Kratochvil <jan.kratochvil@redhat.com>
1942 Fix corruption of non-C++ symbols by the demangler.
1943 * nm.c (show_symbols_sysv, show_symbols_bsd, show_symbols_posix)
1944 (show_symbols): Check for _Z.
1945 * stack.c (print_frames) <USE_DEMANGLE>: Check for _Z.
1947 2014-01-02 Mark Wielaard <mjw@redhat.com>
1949 * stack.c (show_raw): Declare unconditionally.
1950 (parse_opt): Handle '-r' unconditionally.
1951 (main): Show "raw" option even without USE_DEMANGLE.
1953 2014-01-02 Mark Wielaard <mjw@redhat.com>
1955 * stack.c (print_frames): Print 0x before build-id hex-offset.
1957 2014-01-02 Mark Wielaard <mjw@redhat.com>
1959 * stack.c (maxframes): Increase to 2048.
1960 (struct frames): Add allocated field.
1961 (frame_callback): If frames used is frames allocated, realloc.
1962 (print_frames): Show an error if maxframes has been reached.
1963 (parse_opt): Allow -n 0 for unlimited frames.
1964 (main): Document -n 0 and new default 2048 frames. Allocate initial
1965 number of frames with malloc.
1967 2013-12-30 Mark Wielaard <mjw@redhat.com>
1969 * stack.c (parse_opt): Explicitly call dwfl_linux_proc_attach
1970 or dwfl_core_file_attach and check for errors.
1972 2013-12-28 Mark Wielaard <mjw@redhat.com>
1974 * stack.c (print_frames): Remove address width code and use...
1975 (get_addr_width): ...this new function.
1976 (show_modules): New static boolean.
1977 (module_callback): New static function.
1978 (parse_opt): Handle '-l'.
1979 (main): Add 'l' to options. If show_modules then use dwfl_getmodules
1980 with module_callback to show all detected modules and possible
1981 build_id, elf and dwarf files.
1983 2013-12-27 Mark Wielaard <mjw@redhat.com>
1985 * stack.c (frames_shown): New static boolean.
1986 (EXIT_OK,EXIT_ERROR,EXIT_BAD,EXIT_USAGES): New defines.
1987 (frame_callback): Return -1 on error. Don't print error.
1988 (print_frames): Add arguments, tid, dwflerr and what. Print tid.
1989 If there was an error report it with address and module if possible.
1990 Record whether any frames were actually printed.
1991 (thread_callback): Collect tid and err, pass it to print_frames.
1992 (parse_opt): Use EXIT_BAD for errors. On ARGP_KEY_END print errno
1993 if dwfl_linux_proc_report returned it. Check whether we are properly
1994 attached with dwfl_pid.
1995 (main): Document exit status. Don't report DWARF_CB_ABORT from
1996 callbacks as error. Pass real errors to print_frames. Return
1997 EXIT_BAD if no frames could be shown. Return EXIT_ERROR if there
1998 were any non-fatal errors.
2000 2013-12-23 Mark Wielaard <mjw@redhat.com>
2002 * Makefile.am (stack_LDADD): Add demanglelib.
2003 * stack.c (show_quiet): New static boolean, default false.
2004 (show_raw): Likewise.
2005 (demangle_buffer_len): New static size_t.
2006 (demangle_buffer): New static char *.
2007 (print_frames): Don't resolve pc name if show_quiet. Demangle name
2009 (parse_opt): Handle '-q' and '-r'.
2010 (main): Add 'q' and 'r' to options. Free demangle_buffer.
2012 2013-12-23 Mark Wielaard <mjw@redhat.com>
2014 * stack.c (OPT_DEBUGINFO): New define.
2015 (OPT_COREFILE): Likewise.
2017 (core_fd): Likewise.
2020 (debuginfo_path): Likewise.
2021 (parse_opt): Handle '-p', '--core', '-e' and '--debuginfo-path'.
2022 Do argument sanity checking. Setup Dwfl.
2023 (main): Add 'p', 'core', 'e' and 'debuginfo-path' to options.
2024 Remove argp_child children, simplify argp doc, remove custom
2025 usage message and construction of dwfl with dwfl_standard_argp.
2026 Use pid directly as tid. close core and core_fd if opened. Print
2027 pid of process or core.
2029 2013-12-23 Mark Wielaard <mjw@redhat.com>
2031 * stack.c (show_build_id): New static boolean.
2032 (print_frames): Print module build-id, load address and pc offset
2033 if show_build_id is true.
2034 (parse_opt): Handle '-b'.
2035 (main): Add -b to options.
2037 2013-12-22 Mark Wielaard <mjw@redhat.com>
2039 * stack.c (maxframes): New static unsigned. Initialize to 64.
2040 (struct frame): New struct.
2041 (struct frames): Likewise.
2042 (dwfl): New static Dwfl pointer.
2043 (frame_callback): Use arg as struct frames and fill it next frame.
2044 Return DWARF_CB_ABORT when maxframes has been reached. Move
2045 printing of frame to...
2046 (print_frames): ...here. New function.
2047 (thread_callback): Use arg as struct frames and set frames to zero.
2049 (parse_opt): Handle '-n'.
2050 (main): Add -n to options. Allocate frames using maxframes. Pass
2051 frames to frame_callback and thread_callback.
2053 2013-12-20 Mark Wielaard <mjw@redhat.com>
2055 * stack.c (show_one_tid): New static boolean.
2056 (parse_opt): Handle '-1'.
2057 (main): Add -1 to options. Call dwfl_getthread_frames when
2058 show_one_tid is true.
2060 2013-12-18 Mark Wielaard <mjw@redhat.com>
2062 * addr2line.c (options): Add symbol-sections, 'x'.
2063 (show_symbol_sections): New static bool.
2064 (parse_opt): Handle 'x'.
2065 (print_addrsym): Use dwfl_module_addrinfo value.r
2066 Also show section of address with show_symbol_sections.
2067 (find_symbol): Use dwfl_module_getsym_info and set value.
2068 (handle_address): Request value and use it instead of sym.st_value.
2069 * readelf.c (format_dwarf_addr): Use dwfl_module_addrinfo to get
2072 2013-12-17 Masatake YAMATO <yamato@redhat.com>
2073 Mark Wielaard <mjw@redhat.com>
2075 * stack.c (show_activation, show_module, show_source): New variables.
2076 (parse_opt): Set show_activation if -a option is given.
2077 Set show_module if -m option is given. Set show_source if -s option
2078 is given. Set all show booleans when -v option is given.
2079 (main): Added `-a', `-m', `-s', and `-v' to the help message.
2080 (frame_callback): Print module and source file information.
2082 2013-11-25 Petr Machata <pmachata@redhat.com>
2084 * elflint.c (valid_e_machine): Add EM_AARCH64.
2086 2013-11-14 Petr Machata <pmachata@redhat.com>
2088 * readelf.c (handle_core_item) <'h'>: New branch for handling
2089 fields that shouldn't be displayed.
2091 2013-11-10 Mark Wielaard <mjw@redhat.com>
2093 * stack.c: Use ARGP_PROGRAM_VERSION_HOOK_DEF and
2094 ARGP_PROGRAM_BUG_ADDRESS_DEF.
2095 (print_version): New function.
2097 2013-11-09 Mark Wielaard <mjw@redhat.com>
2099 * arlib.c (arlib_init): Call snprintf before using the result
2101 (arlib_finalize): Likewise.
2102 * nm.c (show_symbols_sysv): Don't modify cnt inside assert.
2104 2013-11-07 Jan Kratochvil <jan.kratochvil@redhat.com>
2106 * Makefile.am (bin_PROGRAMS): Add stack.
2108 * stack.c: New file.
2110 2013-11-05 Mark Wielaard <mjw@redhat.com>
2112 * readelf.c (print_debug_ranges_section): Cast address to size_t
2114 (print_debug_loc_section): Likewise.
2116 2013-10-18 Mark Wielaard <mjw@redhat.com>
2118 * ar.c (main): Correct operation check when instance_specifed is set.
2120 2013-09-26 Petr Machata <pmachata@redhat.com>
2122 * readelf.c (handle_file_note): New function.
2123 (handle_notes_data): Call it to handle NT_FILE notes.
2125 2013-09-26 Petr Machata <pmachata@redhat.com>
2127 * readelf.c (handle_siginfo_note): New function.
2128 (handle_notes_data): Call it to handle NT_SIGINFO notes.
2129 (buf_read_int, buf_read_ulong, buf_has_data): New functions.
2131 2013-08-13 Mark Wielaard <mjw@redhat.com>
2133 * addr2line.c (options): Add "inlines", 'i'.
2134 (show_inlines): New bool.
2135 (parse_opt): Handle 'i'.
2136 (print_diesym): New static function.
2137 (print_src): New function taking code from...
2138 (handle_address): here. Call print_src. Print inlines.
2140 2013-08-12 Mark Wielaard <mjw@redhat.com>
2142 * addr2line.c (main): If there is a newline char at end of buf,
2145 2013-07-05 Mark Wielaard <mjw@redhat.com>
2147 * readelf.c (print_ops): Take CU as argument, use it to print
2148 parameter_ref DIE offset.
2149 (struct listptr): Replace base field with cu.
2150 (listptr_base): New function.
2151 (compare_listptr): Use listptr_base.
2152 (notice_listptr): Take CU as argument.
2153 (skip_listptr_hole): Likewise.
2154 (print_debug_ranges_section): Pass NULL as CU to skip_listptr_hole.
2155 (print_cfa_program): Pass NULL as CU to print_ops.
2156 (struct attrcb_args): Replace cu_base field with cu.
2157 (attr_callback): Pass cu not cu_base to notice_listptr.
2158 (print_debug_units): Don't calculate base, just set cu.
2159 (print_debug_loc_section): Pass cu to skip_listptr_hole and
2162 2013-05-06 Mark Wielaard <mjw@redhat.com>
2164 * readelf.c (print_ops): Format first DW_OP_GNU_implicit_pointer
2165 argument as DIE offset.
2167 2013-04-24 Mark Wielaard <mjw@redhat.com>
2169 * Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
2171 2013-03-25 Mark Wielaard <mjw@redhat.com>
2173 * readelf.c (argp_options): Add decodedline.
2174 (decodedline): New boolean initialized to false.
2175 (parse_opt): Set decodedline when arg is decodedline.
2176 (print_decoded_line_section): New function.
2177 (print_debug_line_section): Call print_decoded_line_section when
2178 decodedline is true.
2180 2013-03-25 Mark Wielaard <mjw@redhat.com>
2182 * readelf.c (argp_option): Add decodedaranges.
2183 (decodedaranges): New boolean initialized to false.
2184 (parse_opt): Set decodedaranges when arg is decodedaranges.
2185 (print_debug_aranges_section): Reimplemented and original
2186 implementation renamed to...
2187 (print_decoded_aranges_section): this.
2189 2013-03-25 Mark Wielaard <mjw@redhat.com>
2191 * readelf.c (attrcb_args): Add Dwarf_Die.
2192 (attr_callback): When highpc is in constant form also print as
2194 (print_debug_units): Set args.die.
2196 2013-03-19 Mark Wielaard <mjw@redhat.com>
2198 * readelf.c (print_gdb_index_section): Free format_dwarf_addr results.
2200 2013-03-18 Mark Wielaard <mjw@redhat.com>
2202 * readelf.c (print_gdb_index_section): Accept version 8.
2204 2013-03-01 Mark Wielaard <mjw@redhat.com>
2206 * findtextrel.c (process_file): Release ELF and close file when not
2207 text relocations are found.
2208 * strip.c (handle_elf): Track memory used for .debuglink section data
2211 2013-02-24 Mark Wielaard <mjw@redhat.com>
2213 * elflint.c (check_symtab): Add __bss_start__ to the list of symbols
2214 allowed to have out of section values because of GNU ld bugs.
2216 2013-02-06 Mark Wielaard <mjw@redhat.com>
2218 * elflint.c (check_symtab): Add __bss_start and __TMC_END__ to the
2219 list of symbols allowed to have out of section values because of
2220 GNU ld bugs in either .symtab or .dynsym, but only when they are
2223 2013-01-24 Mark Wielaard <mjw@redhat.com>
2225 * readelf.c (argp_option): Add unresolved-address-offsets, U.
2226 (print_unresolved_addresses): New static.
2227 (parse_opt): Handle 'U', set print_unprocessed_values.
2228 (format_dwarf_addr): Take and handle new raw argument.
2229 (print_ops): Call format_dwarf_addr with raw offset values.
2230 (print_debug_ranges_section): Likewise.
2231 (print_debug_frame_section): Likewise.
2232 (attr_callback): Likewise.
2233 (print_debug_line_section): Likewise.
2234 (print_debug_loc_section): Likewise.
2235 (print_gdb_index_section): Likewise.
2237 2013-01-18 Mark Wielaard <mjw@redhat.com>
2239 * readelf.c (struct listptr): Add base Dwarf_Addr field.
2240 (compare_listptr): Warn for same offset with different base.
2241 (notice_listptr): Take base argument and set it.
2242 (skip_listptr_hole): Likewise.
2243 (struct attrcb_args): Removed unused cu_offset field.
2244 Add cu_base Dwarf_Addr field.
2245 (attr_callback): Call notice_listptr with cbargs->cu_base.
2246 (print_debug_units): Set args.cu_base.
2247 (print_debug_ranges_section): Get base and use for format_dwarf_addr.
2248 (print_debug_loc_section): Likewise.
2250 2013-01-29 Jan Kratochvil <jan.kratochvil@redhat.com>
2252 * readelf.c (handle_core_items): Limit special repeated items handling
2253 to single-item formats '\n', 'b' and 'B', assert OFFSET 0 there.
2255 2012-12-18 Mark Wielaard <mark@bordewijk.wildebeest.org>
2257 * readelf.c (ELF_INPUT_SECTION): New argp key value.
2258 (argp_option): Add elf-section.
2259 (elf_input_section): New static.
2260 (parse_opt): Handle ELF_INPUT_SECTION and set elf_input_section.
2261 (open_input_section): New function.
2262 (process_file): Call open_input_section if elf_input_section set.
2264 2013-01-13 David Abdurachmanov <David.Abdurachmanov@cern.ch>
2266 ar.c (do_oper_delete): Fix num passed to memset.
2268 2012-12-21 Mark Wielaard <mjw@redhat.com>
2270 * readelf.c (print_debug_frame_section): Adjust FDE start address
2271 if pcrel before feeding it to format_dwarf_addr.
2273 2012-12-21 Mark Wielaard <mjw@redhat.com>
2275 * addr2line.c (main): Call dwfl_end.
2277 2012-12-11 Roland McGrath <roland@hack.frob.com>
2279 * nm.c (show_symbols_sysv): Fix size passed to snprintf for invalid
2281 Reported by David Abdurachmanov <David.Abdurachmanov@cern.ch>.
2283 2012-10-16 Mark Wielaard <mjw@redhat.com>
2285 * readelf.c (print_ops): DW_OP_skip and DW_OP_bra targets are
2286 calculated beginning after the operand and 2-byte constant.
2288 2012-10-12 Jan Kratochvil <jan.kratochvil@redhat.com>
2290 * readelf.c (ITEM_WRAP_COLUMN, REGISTER_WRAP_COLUMN): Merge to ...
2291 (WRAP_COLUMN): ... here.
2292 (print_core_item): Remove parameter format_max. Update function
2293 comment. Replace FORMAT_MAX by the real output width.
2294 (handle_core_item): Remove the FORMAT_MAX values in TYPES, DO_TYPE,
2295 calls of print_core_item, remove variable maxfmt, change
2296 ITEM_WRAP_COLUMN to WRAP_COLUMN.
2297 (handle_core_register): Remove the FORMAT_MAX values in TYPES, BITS,
2298 calls of print_core_item, change REGISTER_WRAP_COLUMN to WRAP_COLUMN.
2300 2012-10-11 Jan Kratochvil <jan.kratochvil@redhat.com>
2302 * readelf.c (handle_core_item) <b>: Make run an outer block variable.
2303 Increase run only if LASTBIT != 0. Print last element only if RUN > 0.
2305 2012-08-27 Mark Wielaard <mjw@redhat.com>
2307 * readelf.c (print_debug_macro_section): Print offset as PRIx64.
2309 2012-08-27 Mark Wielaard <mjw@redhat.com>
2311 * readelf.c (register_info): Handle loc == NULL.
2313 2012-08-22 Jeff Kenton <jkenton@tilera.com>
2315 * elflint.c (valid_e_machine): Add EM_TILEGX and EM_TILEPRO.
2317 2012-08-16 Mark Wielaard <mjw@redhat.com>
2319 * readelf.c (dwarf_tag_name): Renamed from dwarf_tag_string.
2320 Uses new dwarf_tag_string or adds ??? or lo_user+%#x when
2322 (dwarf_attr_name): Likewise.
2323 (dwarf_form_name): Likewise.
2324 (dwarf_lang_name): Likewise.
2325 (dwarf_inline_name): Likewise.
2326 (dwarf_encoding_name): Likewise.
2327 (dwarf_access_name): Likewise.
2328 (dwarf_visibility_name): Likewise.
2329 (dwarf_virtuality_name): Likewise.
2330 (dwarf_identifier_case_name): Likewise.
2331 (dwarf_calling_convention_name): Likewise.
2332 (dwarf_ordering_name): Likewise.
2333 (dwarf_discr_list_name): Likewise.
2334 (print_ops): Remove KNOWN. Use dwarf_locexpr_opcode_string.
2335 (attr_callback): Call new dwarf_foobar_name instead of old
2336 dwarf_foobar_string functions.
2337 (dwarf_tag_string): New function using known-dwarf.h macros.
2338 (dwarf_attr_string): Likewise.
2339 (dwarf_form_string): Likewise.
2340 (dwarf_lang_string): Likewise.
2341 (dwarf_inline_string): Likewise.
2342 (dwarf_encoding_string): Likewise.
2343 (dwarf_access_string): Likewise.
2344 (dwarf_visibility_string): Likewise.
2345 (dwarf_virtuality_string): Likewise.
2346 (dwarf_identifier_case_string): Likewise.
2347 (dwarf_calling_convention_string): Likewise.
2348 (dwarf_ordering_string): Likewise.
2349 (dwarf_discr_list_string): Likewise.
2350 (dwarf_locexpr_opcode_string): Likewise.
2352 2012-06-27 Mark Wielaard <mjw@redhat.com>
2354 * readelf.c (dwarf_form_string): Handle DW_FORM_GNU_ref_alt and
2355 DW_FORM_GNU_strp_alt.
2356 (attr_callback): Likewise.
2358 2012-07-30 Petr Machata <pmachata@redhat.com>
2360 * nm.c (show_symbols_bsd): Reorder arguments in {S,}FMTSTRS (and
2361 corresponding printf) so that those that are referenced by only
2362 one of the formatting strings are at the end.
2364 2012-07-29 Mark Wielaard <mjw@redhat.com>
2366 * readelf.c (dwarf_lang_string): Use DW_LANG_ObjC, not DW_LANG_Objc.
2367 (print_ops): Use known[op], not op_name, for DW_OP_GNU_parameter_ref.
2369 2012-07-19 Mark Wielaard <mjw@redhat.com>
2371 * readelf.c (print_ops): Handle DW_OP_GNU_parameter_ref.
2373 2012-07-11 Mark Wielaard <mjw@redhat.com>
2375 * readelf.c (options): Add macro to help of debug-dump.
2376 (section_e): Add section_macro.
2377 (section_all): Add section_macro.
2378 (parse_opt): Handle macro.
2379 (print_debug_macro_section): New function.
2380 (print_debug): Add NEW_SECTION (macro).
2382 2012-07-10 Mark Wielaard <mjw@redhat.com>
2384 * readelf.c (print_gdb_index_section): Add version 7 support.
2385 Keep track of cu_nr. Print kind and static/global flag for each
2386 symbol. When a symbol is in the TU list add 'T'.
2388 2012-06-26 Mark Wielaard <mjw@redhat.com>
2390 * readelf.c (dwarf_attr_string): Add DW_AT_GNU_macros.
2392 2012-06-22 Mark Wielaard <mjw@redhat.com>
2394 * readelf.c (print_ops): Cast printf PRIu/x64 arguments to uint64_t
2395 for gcc 4.7 -Wformat.
2397 2012-05-09 Roland McGrath <roland@hack.frob.com>
2399 * elflint (check_sections): Allow zero sized sections at (filesz) end
2400 of segment. And make check overflow-proofed.
2402 2012-04-24 Mark Wielaard <mjw@redhat.com>
2404 * readelf.c (print_ops): Add DW_OP_GNU_push_tls_address,
2405 DW_OP_GNU_uinit and DW_OP_GNU_encoded_addr.
2407 2012-03-28 Roland McGrath <roland@hack.frob.com>
2409 * elflint.c (special_sections): Accept SHF_INFO_LINK for reloc sections.
2411 2012-03-28 Mark Wielaard <mjw@redhat.com>
2413 * readelf.c (print_debug_abbrev_section): Check there is Dwarf
2415 (print_debug_str_section): Likewise.
2417 2012-03-21 Mark Wielaard <mjw@redhat.com>
2419 * readelf.c (print_gdb_index_section): Accept version 6.
2421 2012-01-31 Mark Wielaard <mjw@redhat.com>
2423 * readelf.c (attr_callback): Don't special case DW_FORM_sec_offset.
2425 2012-01-21 Ulrich Drepper <drepper@gmail.com>
2427 * addr2line.c: Update copyright year.
2429 * elfcmp.c: Likewise.
2430 * elflint.c: Likewise.
2431 * findtextrel.c: Likewise.
2434 * objdump.c: Likewise.
2435 * ranlib.c: Likewise.
2436 * readelf.c: Likewise.
2438 * strings.c: Likewise.
2439 * strip.c: Likewise.
2440 * unstrip.c: Likewise.
2442 * nm.c (argp_children): Define.
2443 (argp): Hook up argp_children.
2444 (handle_ar): Optimize puts call.
2445 (show_symbols_bsd): Use positional parameters to also print color
2446 codes. Don't print STT_FILE symbols.
2447 * objdump.c (options): Improve help text.
2448 (argp_children): Define.
2449 (argp): Hook up argp_children.
2450 (disasm_info): Add elements for color codes.
2451 (disasm_output): Print color codes as well.
2452 (show_disasm): Set up disasm_info data for callback.
2454 2012-01-20 Roland McGrath <roland@hack.frob.com>
2456 * arlib-argp.c (arlib_deterministic_output): Initialize from
2458 (help_filter): New function.
2461 * ar.c (main): Handle oper_none as usage error.
2463 * arlib-argp.c (options, parse_opt): Grok -U as inverse of -D.
2465 * ranlib.c (argp): Use arlib_argp_children.
2467 * arlib.c (arlib_init): Obey arlib_deterministic_output.
2469 * arlib-argp.c: New file.
2470 * Makefile.am (libar_a_SOURCES): Add it.
2471 * arlib.h (arlib_deterministic_output, arlib_argp_children):
2472 Declare new variables.
2473 * ar.c (deterministic_output): Variable removed.
2474 (do_oper_insert): Use arlib_deterministic_output instead.
2475 (options, parse_opt): Don't handle -D here. Add group numbers.
2476 (argp): Use arlib_argp_children.
2478 2011-12-20 Roland McGrath <roland@hack.frob.com>
2480 * readelf.c (print_debug): Initialize DUMMY_DBG.elf.
2481 Reported by Karel Klic <kklic@redhat.com>.
2483 2011-11-05 Roland McGrath <roland@hack.frob.com>
2485 * ar.c (deterministic_output): New flag variable.
2486 (options, parse_opt): Grok -D to set it.
2487 (do_oper_insert): When set, use zero from mtime, uid, and gid.
2489 * ar.c (do_oper_insert): Fix check on elf_rawfile return value.
2491 2011-10-04 Marek Polacek <mpolacek@redhat.com>
2493 * readelf.c (register_info): Assume the right size of an array.
2495 2011-10-03 Ulrich Drepper <drepper@gmail.com>
2497 * nm.c: Recognize option --mark-special. Still recognize --mark-weak
2498 but don't show it in help anymore.
2499 (mark_special): Renamed from mark_weak.
2500 (parse_opt): Adjust.
2501 (class_type_char): Take additional parameters for ELF file and ELF
2502 header. Treat TLS symbols like objects.
2503 In case of D symbols, show u for unique symbols, R for symbols in
2504 read-only sections, B for symbols in BSS sections.
2505 (show_symbols_bsd): Take additional parameters for ELF file and ELF
2506 header. Adjust for class_type_char change. Show TLS symbols with
2507 @ after them in case --mark-special is selected.
2508 (show_symbols_posix): Likewise.
2509 (show_symbols): Adjust calls to show_symbols_bsd and
2511 (show_symbols_sysv): Avoid printing adress and size for undefined
2512 symbols. Don't print initial special entry and section entries.
2514 2011-10-02 Ulrich Drepper <drepper@gmail.com>
2516 * Makefile.am (demanglelib): Define.
2517 (nm_LDADD): Add demanglelib.
2518 * nm.c (options): Add -C option.
2519 (demangle): Define as global variable.
2520 (parse_opt): Recognize -C.
2521 (show_symbols_sysv): Handle demangling.
2522 (show_symbols_bad): Likewise.
2523 (show_symbols_posix): Likewise.
2524 (show_symbols): Likewise.
2526 2011-07-09 Roland McGrath <roland@hack.frob.com>
2528 * readelf.c (options, parse_opt): Grok -W/--wide and ignore it.
2530 * ar.c (parse_opt): Grok -u.
2532 2011-05-30 Mark Wielaard <mjw@redhat.com>
2534 * strip.c (relocate): Make offset check overflow-proof.
2536 2011-05-23 Mark Wielaard <mjw@redhat.com>
2538 * strip.c (relocate): Take new arguments is_rela to indicate
2539 whether the relocation is from a SHT_REL or SHT_RELA section.
2540 Relocate against any debug section symbol, not just STT_SECTION
2541 symbols. For SHT_REL relocations, fetch addend from offset and
2542 add it to symbol value if not zero.
2544 2011-05-23 Mark Wielaard <mjw@redhat.com>
2546 * strip.c (OPT_RELOC_DEBUG): New option.
2547 (argp_option): Add new --reloc-debug-sections option.
2548 (main): Check new option.
2549 (parse_opt): Likewise.
2550 (handle_elf): Remove any relocations between debug sections
2551 in ET_REL for the debug file when requested.
2553 2011-05-18 Mark Wielaard <mjw@redhat.com>
2555 * strip.c (handle_elf): Make sure all sections of a removed group
2556 section are removed too. Don't discard SHT_GROUP sections, copy
2557 section table before it gets modified. Section group signature
2558 symbols don't have to be retained.
2560 2011-05-16 Jakub Jelinek <jakub@redhat.com>
2562 * readelf.c (print_ops): Handle DW_OP_GNU_const_type,
2563 DW_OP_GNU_regval_type, DW_OP_GNU_deref_type, DW_OP_GNU_convert
2564 and DW_OP_GNU_reinterpret.
2566 2011-05-17 Mark Wielaard <mjw@redhat.com>
2568 * readelf.c (dwarf_tag_string): Fixup DW_TAG_GNU_call_site and
2569 DW_TAG_GNU_call_site_parameter return strings.
2571 2011-05-11 Marek Polacek <mpolacek@redhat.com>
2573 * nm.c (show_symbols_sysv): Remove unused if/else, remove
2574 unused `prefix' and `fname' parameters.
2576 2011-05-07 Marek Polacek <mpolacek@redhat.com>
2578 * unstrip.c (compare_sections_nonrel): Mark this function as static.
2580 2011-04-26 Mark Wielaard <mjw@redhat.com>
2582 * readelf.c (handle_notes_data): Call ebl_object_note_type_name
2585 2011-04-14 Mark Wielaard <mjw@redhat.com>
2587 * readelf.c (options): Add gdb_index.
2588 (section_e): Define section_gdb_index.
2589 (parse_opt): Recognize gdb_index debug-dump argument.
2590 (print_gdb_index_section): New function.
2591 (print_debug): Add gdb_index to debug_sections.
2593 2011-03-24 Petr Machata <pmachata@redhat.com>
2595 * readelf.c (print_debug_line_section): Emit initial space for all
2596 opcode lines. Print offset in front of each opcode.
2598 2011-03-22 Marek Polacek <mpolacek@redhat.com>
2600 * readelf.c (handle_dynamic): Don't segfault at DT_PLTREL case.
2602 2011-03-22 Mark Wielaard <mjw@redhat.com>
2604 * readelf.c (dwarf_tag_string): Support DW_TAG_GNU_call_site
2605 and DW_TAG_GNU_call_site_parameter.
2606 (dwarf_attr_string): Support DW_AT_GNU_call_site_value,
2607 DW_AT_GNU_call_site_data_value,
2608 DW_AT_GNU_call_site_target,
2609 DW_AT_GNU_call_site_target_clobbered,
2610 DW_AT_GNU_tail_call,
2611 DW_AT_GNU_all_tail_call_sites,
2612 DW_AT_GNU_all_call_sites,
2613 and DW_AT_GNU_all_source_call_sites.
2614 (print_ops): Handle DW_OP_GNU_entry_value.
2615 (attr_callback): Handle DW_AT_GNU_call_site_value,
2616 DW_AT_GNU_call_site_data_value,
2617 DW_AT_GNU_call_site_target,
2618 and DW_AT_GNU_call_site_target_clobbered.
2620 2011-03-10 Mark Wielaard <mjw@redhat.com>
2622 * elflint.c (check_symtab): Use ebl_check_st_other_bits.
2624 2011-02-27 Jan Kratochvil <jan.kratochvil@redhat.com>
2626 * readelf.c (reset_listptr): Clear TABLE->TABLE.
2628 2011-02-25 Mark Wielaard <mjw@redhat.com>
2630 * readelf.c (dwarf_attr_string): Add DW_AT_GNU_* handling.
2631 (dwarf_form_string): Properly format and return unknown form.
2633 2011-02-23 Roland McGrath <roland@redhat.com>
2635 * readelf.c (section_name): New function.
2636 (print_debug_abbrev_section): Use it instead of constant.
2637 (print_debug_aranges_section): Likewise.
2638 (print_debug_ranges_section): Likewise.
2639 (print_debug_units): Likewise.
2640 (print_debug_line_section): Likewise.
2641 (print_debug_loc_section): Likewise.
2642 (print_debug_macinfo_section): Likewise.
2643 (print_debug_pubnames_section): Likewise.
2644 (print_debug_str_section): Likewise.
2645 (print_debug) [USE_ZLIB]: Match .zdebug_* sections too.
2646 (print_debug_abbrev_section): Use decoded d_size, not sh_size.
2647 (print_debug_str_section): Likewise.
2649 * readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature.
2651 2011-02-11 Roland McGrath <roland@redhat.com>
2653 * elfcmp.c (verbose): New variable.
2654 (options, parse_opt): Grok -l/--verbose to set it.
2655 (main): Under -l, keep going after first difference.
2657 * elfcmp.c (ignore_build_id): New variable.
2658 (options, parse_opt): Grok --ignore-build-id to set it.
2659 (main): For SHT_NOTE sections, compare note details rather than raw
2660 bytes. Under --ignore-build-id, don't complain about differing build
2661 ID contents if lengths match.
2663 2011-02-08 Roland McGrath <roland@redhat.com>
2665 * ldscript.y (filename_id_star): Remove unused variable.
2667 * unstrip.c (copy_elided_sections): Remove unused variable.
2669 * elflint.c (check_dynamic): Remove unused variables.
2671 * elflint.c (check_symtab): Warn about missing xndx section only once.
2673 * ldgeneric.c (check_for_duplicate2): Remove unused variable.
2675 2011-01-06 Roland McGrath <roland@redhat.com>
2677 * strip.c (handle_elf): Under --strip-sections, remove all
2678 non-allocated sections and never generate .gnu_debuglink.
2680 2011-01-04 Roland McGrath <roland@redhat.com>
2682 * strip.c (remove_shdrs): New variable.
2683 (options, parse_opt): Grok --strip-sections to set it.
2684 (handle_elf): When that's set, truncate off .shstrtab and shdrs.
2686 2010-11-10 Roland McGrath <roland@redhat.com>
2688 * findtextrel.c (process_file): Don't assume order of sections.
2689 Reported by Mike Hommey <mh@glandium.org>.
2691 2010-07-26 Roland McGrath <roland@redhat.com>
2693 * readelf.c (print_ops): Handle DW_OP_GNU_implicit_pointer.
2695 2010-08-30 Roland McGrath <roland@redhat.com>
2697 Print .debug_loc/.debug_ranges with cognizance of actual DIE uses.
2698 * readelf.c (parse_opt): Add section_info to implicit_debug_sections
2700 (struct listptr, struct listptr_table): New types.
2701 (compare_listptr, reset_listptr, sort_listptr): New functions.
2702 (notice_listptr, skip_listptr_hole): New functions.
2703 (struct attrcb_args): Add silent member.
2704 (attr_callback): Call notice_listptr for loclistptr and rangelistptr.
2705 Suppress output if silent, but still call notice_listptr.
2706 (print_debug_units): Suppress output if section_info not requested.
2707 (print_debug_loc_section): Call sort_listptr, skip_listptr_hole.
2708 (print_debug_ranges_section): Likewise.
2709 (print_debug): Call reset_listptr on both tables.
2711 * readelf.c (print_debug_ranges_section): Print empty list.
2712 (print_debug_loc_section): Likewise.
2714 * readelf.c (print_debug_loc_section): Check for bogus length
2715 before calling print_ops.
2716 (print_ops): Check harder for bogus data that would read off end.
2718 2010-08-11 Roland McGrath <roland@redhat.com>
2720 * readelf.c (for_each_section_argument): Process all sections with
2721 matching name, not just the first.
2723 2010-07-26 Roland McGrath <roland@redhat.com>
2725 * readelf.c (print_ops): Take new argument for CU version.
2726 Fix DW_OP_call_ref decoding to depend on it.
2727 (print_debug_loc_section): Update caller.
2728 (print_cfa_program): Take new argument, pass it down.
2729 (print_debug_frame_section): Update caller.
2730 (struct attrcb_args): New member version.
2731 (print_debug_units): Initialize it.
2733 2010-07-02 Roland McGrath <roland@redhat.com>
2735 * readelf.c (print_debug_frame_section): Use format_dwarf_addr for
2738 2010-06-30 Roland McGrath <roland@redhat.com>
2740 * strings.c (main): Use STDIN_FILENO, not STDOUT_FILENO.
2741 Ignore st_size for a non-S_ISREG file descriptor.
2742 (read_block): Move assert after no-mmap bail-out.
2743 (read_block_no_mmap): Fix size calculations for moving buffer remnant.
2745 2010-06-22 Roland McGrath <roland@redhat.com>
2747 * readelf.c (print_debug_line_section): Fix braino in DW_LNS_set_isa.
2749 2010-06-21 Roland McGrath <roland@redhat.com>
2751 * readelf.c (dwarf_tag_string): Handle new v4 tags.
2752 (dwarf_attr_string): Add new attributes.
2753 (dwarf_tag_string): Handle DW_TAG_GNU_*.
2755 * readelf.c (print_ops): Use 64-bit types for LEB128 operands.
2756 (print_cfa_program): Likewise.
2758 2010-06-20 Roland McGrath <roland@redhat.com>
2760 * readelf.c (print_debug_units): New function, broken out of ...
2761 (print_debug_info_section): ... here. Call it.
2762 (print_debug_types_section): New function.
2763 (enum section_e): Add section_types alias for section_info.
2764 (print_debug): Add types to the sections table.
2766 * readelf.c (print_debug_frame_section): Handle version 4 format.
2768 * readelf.c (print_debug_line_section): Handle version 4 format.
2770 2010-06-14 Roland McGrath <roland@redhat.com>
2772 * unstrip.c (copy_elided_sections): Make sure all sections' data have
2773 been read in before we write anything out.
2775 2010-06-04 Roland McGrath <roland@redhat.com>
2777 * unstrip.c (update_shdr): New function.
2778 (update_sh_size): Call it instead of gelf_update_shdr.
2779 (adjust_relocs, add_new_section_symbols): Likewise.
2780 (new_shstrtab, copy_elided_sections): Likewise.
2782 * unstrip.c (copy_elided_sections): Bail if stripped file has more
2783 sections than unstripped file, rather than getting confused later.
2785 2010-06-01 Roland McGrath <roland@redhat.com>
2787 * readelf.c (dwarf_form_string): Handle DWARF 4 forms.
2788 (attr_callback): Handle DW_FORM_flag_present, DW_FORM_exprloc,
2789 DW_FORM_sec_offset, DW_FORM_ref_sig8.
2791 * readelf.c (print_debug): Don't bail if libdw setup fails.
2792 Suppress complaint if we only want .eh_frame anyway.
2794 2010-05-28 Ulrich Drepper <drepper@redhat.com>
2796 * readelf.c (attr_callback): Also print form information.
2798 2010-05-19 Roland McGrath <roland@redhat.com>
2800 * addr2line.c (find_symbol): Short-circuit on empty name.
2801 (handle_address): Handle SYMBOL with no +OFFSET.
2803 2010-05-08 Roland McGrath <roland@redhat.com>
2805 * readelf.c (print_ops): Take new arg OFFSET_SIZE.
2806 Use that for DW_OP_call_ref, not ADDRSIZE.
2807 (print_cfa_program): Update caller.
2808 (struct attrcb_args): Add offset_size field.
2809 (attr_callback): Use it for print_ops call.
2810 (print_debug_info_section): Initialize it.
2811 (print_ops): Likewise.
2813 2010-04-14 Roland McGrath <roland@redhat.com>
2815 * readelf.c (handle_core_item): Fix bitmask printing.
2817 2010-04-06 Roland McGrath <roland@redhat.com>
2819 * ld.c (options): Fix some typos in messages.
2820 * elflint.c (check_scn_group, check_group): Likewise.
2821 * ldscript.y (add_id_list): Likewise.
2822 * readelf.c (print_hash_info): Add xgettext:no-c-format magic comment
2823 before translated string containing a literal %.
2825 2010-02-26 Roland McGrath <roland@redhat.com>
2827 * readelf.c (process_file): Don't leak an fd in failure case.
2829 2010-02-15 Roland McGrath <roland@redhat.com>
2831 * Makefile.am: Use config/eu.am for common stuff.
2833 * readelf.c (print_debug_frame_section): Add a cast to avoid sign
2834 mismatch in comparison.
2836 2010-02-02 Roland McGrath <roland@redhat.com>
2838 * readelf.c (print_encoding_base): Handle DW_EH_PE_absptr (zero).
2839 (read_encoded): Likewise.
2840 (print_debug_frame_section): Check for bogus augmentation length.
2841 For P augmentation, use read_encoded, print the encoding description,
2842 and use hex for unsigned values.
2844 2010-01-15 Roland McGrath <roland@redhat.com>
2846 * ar.c: Include <sys/stat.h>.
2847 * elflint.c: Likewise.
2848 * readelf.c: Likewise.
2849 * strip.c: Likewise.
2850 * unstrip.c: Likewise
2852 2010-01-07 Roland McGrath <roland@redhat.com>
2854 * readelf.c (print_ehdr): Handle PN_XNUM.
2855 (phnum): New static variable.
2856 (process_elf_file): Set it with elf_getphdrnum.
2857 (print_phdr): Use phnum instead of EHDR->e_phnum.
2858 (print_dynamic, handle_notes): Likewise.
2859 (handle_relocs_rel, handle_relocs_rela): Likewise.
2861 * elfcmp.c (main): Use elf_getshdrnum and elf_getphdrnum.
2863 * elflint.c (phnum): New static variable.
2864 (check_elf_header): Set it, handling PN_XNUM.
2865 Use that in place of EHDR->e_phnum throughout.
2866 (check_symtab, check_reloc_shdr, check_dynamic): Likewise.
2867 (unknown_dependency_p, check_sections, check_program_header): Likewise.
2869 2010-01-05 Roland McGrath <roland@redhat.com>
2871 * readelf.c (dwarf_attr_string): Match DW_AT_GNU_vector and
2872 DW_AT_GNU_template_name.
2874 2010-01-04 Roland McGrath <roland@redhat.com>
2876 * readelf.c (handle_notes_data): Grab NT_AUXV only for name "CORE".
2877 (handle_core_note): Pass NHDR and NAME to ebl_core_note.
2878 (handle_core_item): Handle .format of '\n' as \n-separated strings.
2880 * readelf.c (implicit_debug_sections): New variable.
2881 (parse_opt): Set it instead of print_debug_sections for -a.
2882 OR them together for print_debug check.
2883 (print_debug): OR them together for section check.
2885 * readelf.c (options): Repartition into set implied by -a and others.
2886 Correct -a text to match reality.
2888 * readelf.c (struct section_argument): Add bool member 'implicit'.
2889 (parse_opt): Set it for -a cases, clear it for -x args.
2890 (for_each_section_argument): Don't complain about a missing section by
2891 name if it's implicit.
2893 2009-11-16 Roland McGrath <roland@redhat.com>
2895 * readelf.c (print_string_section): Punt SHT_NOBITS like empty
2896 sections, just as dump_data_section already does.
2898 2009-09-21 Ulrich Drepper <drepper@redhat.com>
2900 * elflint.c (special_sections): Allow MERGE and STRINGS flags to be
2901 set for .comment section.
2902 Patch by Mark Wielaard <mjw@redhat.com>.
2904 2009-09-08 Roland McGrath <roland@redhat.com>
2906 * ar.c (main): Fix typo in message format.
2908 2009-08-21 Roland McGrath <roland@redhat.com>
2910 * readelf.c (attr_callback): Use print_block only when we don't use
2913 2009-08-14 Roland McGrath <roland@redhat.com>
2915 * ar.c (do_oper_extract): Use pathconf instead of statfs.
2917 2009-08-01 Ulrich Drepper <drepper@redhat.com>
2919 * debugpred.h: Add two most const.
2921 2009-07-26 Mark Wielaard <mjw@redhat.com>
2923 * elflint.c (check_note_data): Recognize NT_GNU_GOLD_VERSION.
2925 2009-07-25 Mark Wielaard <mjw@redhat.com>
2927 * Makefile.am (addr2line_LDADD): Add $(libelf).
2929 2009-07-24 Roland McGrath <roland@redhat.com>
2931 * readelf.c (print_block): New function.
2932 (print_ops): Use it.
2933 (attr_callback): Use it for DW_FORM_block* forms.
2935 2009-07-20 Mark Wielaard <mjw@redhat.com>
2937 * readelf.c (print_ops): Add handling of DW_OP_implicit_value
2938 and DW_OP_stack_value.
2940 2009-07-14 Ulrich Drepper <drepper@redhat.com>
2942 * elflint.c (check_elf_header): Allow Linux ABI.
2943 (check_symtab): Handle STB_GNU_UNIQUE.
2945 2009-07-08 Mark Wielaard <mjw@redhat.com>
2947 * readelf.c (attr_callback): Handle DW_Form constants for
2948 DW_AT_data_member_location.
2950 2009-07-06 Roland McGrath <roland@redhat.com>
2952 * readelf.c (register_info): New function. Handle unknown register #s.
2953 (print_cfa_program): Use it.
2954 (handle_core_register, handle_core_registers): Likewise.
2956 2009-06-28 Roland McGrath <roland@redhat.com>
2958 * readelf.c (print_address_names): New static variable.
2959 (options, parse_opt): Grok -N/--numeric-addresses to clear it.
2960 (format_dwarf_addr): Don't look up name if !print_address_names.
2962 2009-06-13 Ulrich Drepper <drepper@redhat.com>
2964 * ldgeneric.c: Don't use deprecated libelf functions.
2966 * objdump.c: Likewise.
2967 * readelf.c: Likewise.
2969 * strip.c: Likewise.
2970 * unstrip.c: Likewise.
2971 * ld.h: Fix up comment.
2973 2009-06-01 Ulrich Drepper <drepper@redhat.com>
2975 * readelf.c (print_relocs): Expect ELF header argument and pass on
2976 to handle_relocs_rel* functions. Adjust caller.
2977 (handle_relocs_rel): Add ELF header argument. Add special case for
2978 the IRELATIVE relocations in statically linked executables.
2979 (handle_relocs_rela): Likewise.
2981 2009-04-29 Ulrich Drepper <drepper@redhat.com>
2983 * elflint.c (check_symtab): Add tests of st_other field.
2985 2009-04-23 Ulrich Drepper <drepper@redhat.com>
2987 * Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS).
2989 2009-04-20 Roland McGrath <roland@redhat.com>
2991 * addr2line.c (print_dwarf_function): Honor -s and -A for file names
2992 of inline call sites.
2994 * addr2line.c (just_section): New variable.
2995 (adjust_to_section): New function, broken out of ...
2996 (handle_address): ... here.
2997 (options, parse_opt): Add -j/--section=NAME to set it.
2999 2009-04-15 Roland McGrath <roland@redhat.com>
3001 * readelf.c (print_debug_frame_section): Check for DW_CIE_ID_64 in
3002 64-bit format header, DW_CIE_ID_32 in 32-bit format header.
3004 2009-04-14 Roland McGrath <roland@redhat.com>
3006 * readelf.c (print_attributes): Treat SHT_ARM_ATTRIBUTES on EM_ARM
3007 like SHT_GNU_ATTRIBUTES.
3009 * readelf.c (handle_core_registers): Fix error message.
3011 * strip.c (handle_elf: check_preserved): Don't note any change when
3012 .debug_data is already filled from a previous pass.
3014 2009-02-05 Ulrich Drepper <drepper@redhat.com>
3016 * objdump.c (show_relocs_x): Minor cleanups.
3018 * readelf.c (print_cfa_program): Correct a few labels.
3019 Print first DW_CFA_expression and DW_CFA_val_expression parameter
3022 2009-02-01 Ulrich Drepper <drepper@redhat.com>
3024 * objdump.c (show_relocs_rel, show_relocs_rela): Split common parts
3026 (show_relocs_x): ...here. New function.
3027 (show_relocs): Better spacing in output.
3029 * objdump.c (show_relocs_rela): Show offsets as signed values.
3031 * ar.c (main): Fix recognition of invalid modes for a, b, i modifiers.
3032 Improve some error messages.
3033 Use program_invocation_short_name instead of AR macro.
3034 * Makefile.am (CFLAGS_ar): Remove.
3035 * elflint.c (parse_opt): ARGP_HELP_EXIT_ERR does nothing for argp_help.
3036 * objdump.c (parse_opt): Likewise.
3037 * readelf.c (parse_opt): Likewise.
3039 2009-01-27 Roland McGrath <roland@redhat.com>
3041 * readelf.c (print_ops): Notice short length, don't overrun buffer
3042 (still need to fix LEB128).
3044 * readelf.c (print_ops): Fix DW_OP_call[24] decoding.
3046 * readelf.c (print_ops): Print (empty)\n when LEN == 0.
3048 2009-01-24 Ulrich Drepper <drepper@redhat.com>
3050 * readelf.c (print_debug_frame_section): Fix computation of vma_base
3051 for PC-relative mode.
3053 2009-01-23 Ulrich Drepper <drepper@redhat.com>
3055 * size.c (process_file): When handling archive, close file descriptor
3056 here. For unknown file format also close file descriptor.
3057 (handle_ar): Don't close file descriptor here.
3059 * readelf.c (parse_opt): Move code to add to dump_data_sections and
3060 string_sections list in local function add_dump_section. Adjust 'x'
3061 key handling. For 'a' key add .strtab, .dynstr, and .comment section
3062 to string_sections list.
3064 2009-01-22 Roland McGrath <roland@redhat.com>
3066 * readelf.c (print_phdr): Don't print section mapping when no sections.
3068 * Makefile.am (AM_CFLAGS): Pass -Wno-format for *_no_Wformat.
3070 * readelf.c (print_debug_frame_section): Initialize IS_SIGNED to false
3071 and reset it only for the 'true' cases.
3073 * Makefile.am (addr2line_no_Wformat): New variable.
3075 * readelf.c (print_debug_frame_section): Use t instead of j formats
3076 for ptrdiff_t OFFSET.
3078 2009-01-21 Ulrich Drepper <drepper@redhat.com>
3080 * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
3081 test. Handle debuginfo files.
3082 (check_exception_data): First sanity test.
3084 2009-01-17 Ulrich Drepper <drepper@redhat.com>
3086 * readelf.c (print_debug_exception_table): Show target of ar_disp
3089 * elflint.c (check_program_header): Add most consistency checks for
3090 PT_GNU_EH_FRAME entry.
3092 * addr2line.c: Use ARGP_PROGRAM_VERSION_HOOK_DEF and
3093 ARGP_PROGRAM_BUG_ADDRESS_DEF.
3095 * elfcmp.c: Likewise.
3096 * elflint.c: Likewise.
3097 * findtextrel.c: Likewise.
3100 * objdump.c: Likewise.
3101 * ranlib.c: Likewise.
3102 * readelf.c: Likewise.
3105 * strings.c: Likewise.
3106 * strip.c: Likewise.
3107 * unstrip.c: Likewise.
3109 2009-01-16 Ulrich Drepper <drepper@redhat.com>
3111 * elflint.c (check_program_header): Check that PT_GNU_EH_FRAME entry
3112 matches .eh_frame_hdr section, if it is available. Also check that
3113 the segment is allocated, not writable, not executable.
3115 * readelf.c: Add -e option. Dump exception and unwind related
3116 sections. Add -e to -a.
3117 (print_encoding_base): Handle DW_EH_PE_omit.
3118 (print_debug_exception_table): Beginning of support.
3119 (print_debug): Hook up print_debug_exception_table for
3120 .gcc_except_table sections.
3122 * readelf.c (print_debug_frame_section): Some fixes for last change.
3124 2009-01-15 Ulrich Drepper <drepper@redhat.com>
3126 * readelf.c (print_encoding): Now a toplevel function.
3127 (print_relinfo): Likewise.
3128 (print_encoding_base): Broken out of print_debug_frame_section.
3129 (print_debug_frame_section): Print different header for .eh_frame
3130 sections. Fix recognition of matching CIEs in .debug_frame sections.
3131 Print absolute offset for PC-relative FDE locations. Don't print
3132 table header for FDEs if the table is empty.
3133 (read_encoded): New function.
3134 (print_debug_frame_hdr_section): New function.
3135 (print_debug): Hook up print_debug_frame_hdr_section for .eh_frame_hdr
3138 * readelf.c (handle_relocs_rel): Print section number.
3139 (print_debug_abbrev_section): Likewise.
3140 (print_debug_aranges_section): Likewise.
3141 (print_debug_ranges_section): Likewise.
3142 (print_debug_info_section): Likewise.
3143 (print_debug_line_section): Likewise.
3144 (print_debug_loc_section): Likewise.
3145 (print_debug_macinfo_section): Likewise.
3146 (print_debug_pubnames_section): Likewise.
3147 (print_debug_str_section): Likewise.
3149 2009-01-10 Ulrich Drepper <drepper@redhat.com>
3151 * strings.c (read_block): Fix typo in error message string.
3153 2009-01-07 Ulrich Drepper <drepper@redhat.com>
3155 * ld.c (ld_new_searchdir): Fix adding to search path list.
3157 2009-01-06 Ulrich Drepper <drepper@redhat.com>
3159 * readelf.c: Implement call frame debug section dumping.
3161 2009-01-05 Roland McGrath <roland@redhat.com>
3163 * elfcmp.c: Exit with status 2 for errors (like cmp, diff, grep).
3164 Status 1 (aka EXIT_FAILURE) is only for completed OK but not equal.
3166 2009-01-01 Ulrich Drepper <drepper@redhat.com>
3168 * addr2line.c: Update copyright year.
3170 * elfcmp.c: Likewise.
3171 * elflint.c: Likewise.
3172 * findtextrel.c: Likewise.
3175 * objdump.c: Likewise.
3176 * ranlib.c: Likewise.
3177 * readelf.c: Likewise.
3179 * strings.c: Likewise.
3180 * strip.c: Likewise.
3181 * unstrip.c: Likewise.
3183 2008-12-11 Roland McGrath <roland@redhat.com>
3185 * nm.c (sym_name): New function.
3186 (show_symbols_sysv): Use it in place of elf_strptr.
3187 (show_symbols_bsd, show_symbols_posix): Likewise.
3190 * nm.c (show_symbols_sysv): Use an alloca'd backup section name when
3193 2008-12-02 Roland McGrath <roland@redhat.com>
3195 * readelf.c (count_dwflmod, process_file): Don't presume encoding of
3196 nonzero OFFSET argument to dwfl_getmodules.
3198 2008-08-07 Roland McGrath <roland@redhat.com>
3200 * addr2line.c (main): Pass string to handle_address.
3201 (see_one_module): New function, subroutine of handle_address.
3202 (find_symbol): Likewise.
3203 (handle_address): Take string argument rather than address.
3204 Convert plain number, or handle strings like "(section)+offset"
3207 2008-08-01 Roland McGrath <roland@redhat.com>
3209 * readelf.c (handle_core_item): Handle 'B' type for 1-origin bitset.
3210 For 'b' and 'B', print <x-y,z> or ~<x,y-z> rather than 1/0 string.
3212 * readelf.c (convert): Take new argument SIZE.
3213 (handle_core_register, handle_core_item): Update callers.
3214 (handle_core_item): Take new arg REPEATED_SIZE.
3215 (handle_core_items): Special case for a singleton item,
3216 let handle_core_item handle repeats if it wants to.
3218 * readelf.c (handle_core_items): Give abridged output
3219 for identical groups repeated more than twice.
3221 2008-07-04 Roland McGrath <roland@redhat.com>
3223 * readelf.c (handle_core_items): Handle ELF_T_ADDR.
3225 2008-04-10 Roland McGrath <roland@redhat.com>
3227 * strip.c (handle_elf): Don't keep sections that kept symbol tables
3228 refer to. Instead, just be sure to preserve the original symbol
3229 table in the debug file so those symbols go with their sections and
3230 can be elided from the stripped version of the symbol table.
3232 * strip.c (handle_elf): When a discarded section kept in the debug
3233 file refers to a nondiscard section via sh_link/sh_info, preserve
3234 that nondiscarded section unmodified in the debug file as well.
3235 Skip adjustment of discarded sections symbol table references when
3236 that symbol table is copied in this way.
3238 * elflint.c (check_symtab): Don't crash from missing symbol names
3239 after diagnosing bogus strtab.
3241 * strip.c (handle_elf): Cosmetic cleanup in special section contents
3242 adjustment for symtab changes.
3244 2008-03-31 Roland McGrath <roland@redhat.com>
3246 * elflint.c (check_sections): Add checks on SHF_EXECINSTR sections:
3247 must be SHT_PROGBITS, must not be SHF_WRITE. Let backend hook
3248 excuse a special section.
3250 2008-03-27 Roland McGrath <roland@redhat.com>
3252 * elflint.c (check_sections): Check that executability and writability
3253 of sections is reflected in segment p_flags.
3255 2008-03-26 Roland McGrath <roland@redhat.com>
3257 * elflint.c (check_program_header): Accept PT_GNU_RELRO p_flags
3258 that matches its PT_LOAD's p_flags &~ PF_W. On sparc, PF_X really
3261 2008-02-29 Roland McGrath <roland@redhat.com>
3263 * readelf.c (print_attributes): Add a cast.
3264 * elflint.c (check_attributes): Likewise.
3266 * unaligned.h (add_8ubyte_unaligned): Cast PTR argument for parity
3267 with [UNALIGNED_ACCESS_CLASS == BYTE_ORDER] definition.
3268 (add_4ubyte_unaligned, add_2ubyte_unaligned): Likewise.
3270 2008-02-03 Ulrich Drepper <drepper@redhat.com>
3272 * i386_ld.c (elf_i386_count_relocations): Implement R_386_TLS_GD
3273 when linked into executable.
3274 (elf_i386_create_relocations): Likewise.
3276 2008-02-20 Roland McGrath <roland@redhat.com>
3278 * readelf.c (print_attributes): New function.
3279 (process_elf_file): Call it under -A.
3281 * elflint.c (check_attributes): Implement it for real.
3283 2008-02-19 Roland McGrath <roland@redhat.com>
3285 * elflint.c (special_sections): Handle .gnu.attributes section.
3286 (check_sections): Likewise.
3287 (check_attributes): New function.
3289 2008-02-10 Roland McGrath <roland@redhat.com>
3291 * elfcmp.c (main): Ignore sh_offset differences in non-SHF_ALLOC
3292 sections and ET_REL files.
3294 2008-02-02 Ulrich Drepper <drepper@redhat.com>
3296 * elf32-i386.script: Add .eh_frame_hdr, .tdata, and .tbss sections.
3297 * i386_ld.c (elf_i386_count_relocations): Handle R_386_TLS_LDO_32
3299 (elf_i386_create_relocations): Likewise.
3300 * ld.h (struct ld_state): Add need_tls, tls_start, and tls_tcb
3302 * ldgeneric.c (add_section): If TLS section is used, set need_tls flag.
3303 (ld_generic_create_outfile): Add PT_TLS entry to program header.
3304 Fix generation of PT_GNU_STACK entry.
3306 2008-02-01 Ulrich Drepper <drepper@redhat.com>
3308 * ld.c (replace_args): Prevent loop over replacements if the parameter
3309 is only two characters long.
3311 * ld.c: Recognize sha1 argument for --build-id parameter.
3312 * ldgeneric.c (create_build_id_section): Handle sha1.
3313 (compute_hash_sum): New function. Broken out of compute_build_id.
3314 Take hash function and context as parameters.
3315 (compute_build_id): Use compute_hash_sum for md5 and the new sha1
3318 2008-01-31 Ulrich Drepper <drepper@redhat.com>
3320 * elf32-i386.script: Add .note.ABI-tag and .note.gnu.build-id sections.
3321 * ld.c: Recognize --build-id command line parameter.
3322 * ld.h: Define scn_dot_note_gnu_build_id.
3323 (struct ld_state): Add build_id and buildidscnidx elements.
3324 * ldgeneric.c: Implement --build-id command line parameter.
3325 * ldlex.l (ID): Recognize - as valid character after the first one.
3327 2008-01-29 Ulrich Drepper <drepper@redhat.com>
3329 * ld.c (replace_args): New function.
3330 (main): Use it to rewrite old-style parameters.
3332 * elf32-i386.script: Add .gnu.hash section.
3333 * ldgeneric.c (optimal_bucket_size): A tiny bit more efficient.
3334 (fillin_special_symbol): Initialize st_size.
3335 (sortfct_hashval): New function.
3336 (create_gnu_hash): New function.
3337 (create_hash): New function.
3338 (ld_generic_create_outfile): Use the new functions to create the
3341 * elflint.c (check_gnu_hash): Fix index value printed in error message.
3343 2008-01-24 Ulrich Drepper <drepper@redhat.com>
3345 * elflint.c (check_group): Check that signature symbol for section
3346 group is not an empty string.
3347 * ldgeneric.c: Remove magic assignment of indeces in the dynsym
3348 section. Start implementation of --hash-style.
3349 * i386_ld.c: Likewise.
3350 * ld.c: Recognize --hash-style.
3351 * ld.h (struct scninfo): Add comdat_group.
3352 Add additional parameter to finalize_plt callback.
3354 2008-01-22 Ulrich Drepper <drepper@redhat.com>
3356 * ld.h (struct callbacks): Add initialize_gotplt.
3357 (struct scnhead): Add scn_dot_gotplt.
3358 (struct ld_state): Add gotpltscnidx.
3359 * i386_ld.c (elf_i386_initialize_plt): Minor optimization.
3360 (elf_i386_initialize_pltrel): Likewise.
3361 (elf_i386_initialize_got): There is now a separate .got.plt, so
3362 don't do the PLT-related work here. Initialize d_type.
3363 (elf_i386_initialize_gotplt): New function.
3364 (elf_i386_plt0): Use ud2a after indirect jump.
3365 (elf_i386_pic_plt0_entry): Likewise.
3366 (elf_i386_finalize_plt): Reference now .got.plt.
3367 (elf_i386_count_relocations): For GOT entries which need no relocation
3368 don't bump nrel_got.
3369 (elf_i386_create_relocations): Also get .got.plt. Rewrite R-386_GOT32
3370 handling for split .got/.got.plt.
3371 (elf_i386_ld_init): Initialize callbacks.initialize_gotplt.
3372 * elf32-i386.script: Sort sections for security. There are no .got
3373 input sections. Add .got.plt.
3374 * ldgeneric.c (ld_generic_generate_sections): Add .got.plt section.
3375 (ld_generic_create_outfile): Initialize .got.plt section.
3376 Use .got.plt address for _GLOBAL_OFFSET_TABLE_ symbol and DT_PLTGOT.
3378 2008-01-19 Ulrich Drepper <drepper@redhat.com>
3380 * i386_ld.c (elf_i386_count_relocations): PLT relocations for undefined
3381 symbols are not carried over into statically linked output files.
3382 Add dummy entries for more TLS relocations.
3384 * ld.c (options): Add long names for -( and -).
3386 * ldgeneric.c (check_definition): For newly found definitions don't
3387 mark section as used if symbol is absolute.
3388 (extract_from_archive): Only assign archive sequence number the first
3389 time the archive is handled. Update ld_state.last_archive_used
3390 if any symbol was used. Remove nround variable.
3391 (file_process2): When using symbol from an archive, update
3392 ld_state.group_start_archive, ld_state.archives, and
3393 ld_state.tailarchives.
3394 (ld_generic_file_process): If group is not handled anymore, after
3395 freeing ELF handles for the archives, clear ld_state.archives and
3396 *nextp. Fix wrong logic in recognizing first iteration of group
3397 loop. When clearing flags, also clear ld_state.group_start_archive.
3399 2008-01-11 Ulrich Drepper <drepper@redhat.com>
3401 * objdump.c (show_disasm): Adjust disassembler format string for
3404 2008-01-04 Roland McGrath <roland@redhat.com>
3406 * readelf.c (handle_core_items): Take new arg DESCSZ; if nonzero,
3407 a size greater than the items cover means multiple sets of items.
3408 (handle_core_note): Update caller.
3410 2008-01-04 Roland McGrath <roland@redhat.com>
3412 * strip.c (handle_elf): Move SHDRIDX defn to silence gcc warning.
3414 2008-01-03 Roland McGrath <roland@redhat.com>
3416 * ld.h (linked_from_dso_p): Use __attribute__ ((__gnu_inline__)).
3418 * elflint.c (check_dynamic): Remove duplicate initializer.
3420 2008-01-02 Ulrich Drepper <drepper@redhat.com>
3422 * addr2line.c: Update copyright year.
3424 * elfcmp.c: Likewise.
3425 * elflint.c: Likewise.
3426 * findtextrel.c: Likewise.
3429 * objdump.c: Likewise.
3430 * ranlib.c: Likewise.
3431 * readelf.c: Likewise.
3433 * strings.c: Likewise.
3434 * strip.c: Likewise.
3435 * unstrip.c: Likewise.
3437 2007-12-30 Ulrich Drepper <drepper@redhat.com>
3439 * objdump (show_disasm): Use %e after third parameter.
3441 2007-12-21 Ulrich Drepper <drepper@redhat.com>
3443 * strip.c: Fix wrong parenthesis in a few branch predictions.
3444 * strings.c: Likewise.
3446 2007-12-20 Ulrich Drepper <drepper@redhat.com>
3448 * Makefile.am (DEFS): Add DEBUGPRED.
3449 * addr2line.c: Include debugpred.h.
3451 * elfcmp.c: Likewise.
3452 * elflint.c: Likewise.
3453 * findtextrel.c: Likewise.
3455 * objdump.c: Likewise.
3456 * ranlib.c: Likewise.
3457 * readelf.c: Likewise.
3459 * strings.c: Likewise.
3460 * strip.c: Likewise.
3461 * unstrip.c: Likewise.
3462 * debugpred.h: New file.
3464 * readelf.c (handle_relocs_rel): Use elf_scnshndx.
3465 (handle_relocs_rela): Likewise.
3467 * readelf.c: Add lots of likely/unlikely.
3469 * elflint.c: Minor cleanups.
3471 2007-11-19 Roland McGrath <roland@redhat.com>
3473 * readelf.c (print_ops): Handle all bad op codes gracefully.
3474 Print their numbers instead of just ???.
3476 2007-11-09 Roland McGrath <roland@redhat.com>
3478 * readelf.c (attr_callback): Handle DW_AT_data_location.
3479 Handle block forms to mean a DWARF expression for DW_AT_allocated,
3480 DW_AT_associated, DW_AT_bit_size, DW_AT_bit_offset, DW_AT_bit_stride,
3481 DW_AT_byte_size, DW_AT_byte_stride, DW_AT_count, DW_AT_lower_bound,
3484 2007-10-20 Roland McGrath <roland@redhat.com>
3486 * unstrip.c (options): Update -R description.
3487 (struct symbol): Put symbol details a union with a size_t pointer
3489 (compare_symbols_output): Use null ->name as marker for discard
3490 symbols, not zero *->map.
3491 (copy_elided_sections): Record forwarding pointers for discarded
3492 duplicates and fill SYMNDX_MAP elements through them.
3494 * readelf.c (process_file): Set offline_next_address to 0 at start.
3495 (struct process_dwflmod_args): New type.
3496 (process_dwflmod): Take args in it, pass fd to process_elf_file.
3497 (process_file): Update caller; dup FD for passing to libdwfl.
3498 (process_elf_file): Take new arg FD. For ET_REL file when
3499 displaying data affected by libdwfl relocation, open a new Elf handle.
3501 2007-10-17 Roland McGrath <roland@redhat.com>
3503 * readelf.c (print_debug_line_section): For invalid data inside a
3504 unit with plausible length, keep printing at the next unit boundary.
3506 * readelf.c (attr_callback): Use dwarf_formref_die, not dwarf_formref.
3508 2007-10-16 Roland McGrath <roland@redhat.com>
3510 * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
3512 2007-10-15 Roland McGrath <roland@redhat.com>
3514 * make-debug-archive.in: New file.
3515 * Makefile.am (EXTRA_DIST): Add it.
3516 (make-debug-archive): New target.
3517 (bin_SCRIPTS, CLEANFILES): Add it.
3519 2007-10-10 Roland McGrath <roland@redhat.com>
3521 * elflint.c (special_sections): Add new attrflag value exact_or_gnuld.
3522 Use it to check MERGE|STRINGS for .debug_str.
3523 (check_sections): Handle exact_or_gnuld.
3525 2007-10-08 Roland McGrath <roland@redhat.com>
3527 * readelf.c (handle_core_item): Handle 'T'|0x80 to indicate
3528 64-bit struct timeval with 32-bit tv_usec.
3530 2007-10-07 Roland McGrath <roland@redhat.com>
3532 * readelf.c (check_archive_index): New function.
3533 (process_file): Call it. Change signature to take only fd and name.
3534 Use libdwfl to open the file, then iterate on its modules (multiple
3535 for an archive) to print file name and call process_elf_file.
3536 (main): Update caller. Let process_file do elf_begin.
3537 (count_dwflmod, process_dwflmod, find_no_debuginfo): New functions.
3538 (process_elf_file): Take only Dwfl_Module * argument.
3539 Don't print the file name here.
3540 (print_debug_*_section): Take Dwfl_Module * argument.
3541 (print_debug): Likewise. Update caller.
3542 (format_dwarf_addr): New function.
3543 (print_debug_ranges_section): Use it.
3544 (attr_callback): Likewise.
3545 (print_debug_line_section, print_debug_loc_section): Likewise.
3547 * readelf.c (print_debug_ranges_section): Translate all strings.
3548 (print_debug_loc_section): Likewise.
3550 * unstrip.c (copy_elided_sections): Initialize SEC.
3552 * ar.c (do_oper_insert): Put trailing / on short names.
3554 * arlib.h (MAX_AR_NAME_LEN): Decrease by one.
3556 * arlib2.c (arlib_add_long_name): Adjust for header size.
3558 * arlib.c (arlib_finalize): Pad long name table to keep size even.
3560 * ar.c (do_oper_insert): Use write_retry for padding write.
3562 * ar.c (do_oper_insert): Initialize CUR_OFF in no_old case.
3563 Unconditionally set FOUND[CNT]->elf when setting ->mem.
3564 (remember_long_name): New function.
3565 (do_oper_insert): Call it. Correctly use length of basename,
3566 not original name. Don't store long name twice for new member.
3568 2007-10-06 Roland McGrath <roland@redhat.com>
3570 * elflint.c (check_note): Skip empty segment.
3571 (check_note_section): Skip empty section.
3573 * unstrip.c (options, parse_opt, struct arg_info): Grok -R/--relocate.
3574 (handle_output_dir_module, handle_implicit_modules): Pass it down.
3575 (handle_dwfl_module): When set, use ET_REL already loaded by Dwfl.
3576 (compare_alloc_sections): Take new arg REL, ignore address if true.
3577 (compare_sections): Likewise, pass it down.
3578 (compare_sections_rel, compare_sections_nonrel): New functions.
3579 (find_alloc_sections_prelink, copy_elided_sections): Use them
3580 instead of compare_sections.
3581 (sections_match): New function, broken out of ...
3582 (find_alloc_section): ... here.
3583 (copy_elided_sections): Reorganize section match-up logic.
3584 Use sections_match for SHF_ALLOC in ET_REL.
3585 For ET_REL, let the nonzero sh_addr from the debug file dominate.
3587 * unstrip.c (add_new_section_symbols): Take new arg REL.
3588 When true, do not update section symbol values.
3589 (collect_symbols): Likewise. Update section symbols with address
3590 of chosen output section, not original section.
3591 (check_symtab_section_symbols, copy_elided_sections): Update callers.
3593 * unstrip.c (compare_alloc_sections): At the same address, preserve
3594 original section order.
3596 * elflint.c (special_sections): Don't require MERGE|STRINGS for
3597 .debug_str, it didn't always have them with older tools.
3599 * elflint.c (check_symtab, check_one_reloc): Ignore sh_addr in ET_REL.
3601 2007-10-05 Roland McGrath <roland@redhat.com>
3603 * elflint.c (check_symtab): Allow SHN_UNDEF _GLOBAL_OFFSET_TABLE_ in
3606 * elflint.c (check_symtab): For _GLOBAL_OFFSET_TABLE_, diagnose
3607 SHN_UNDEF as "bad section". Use shndx value in messages.
3609 * elflint.c (special_sections): Add ".debug_str". Decrement namelen
3610 for ".debug" so it matches as a prefix.
3611 (IS_KNOWN_SPECIAL): New macro.
3612 (check_sections): Use it for ".plt" match. Cite wrong SHT_NOBITS
3613 type even under -d, for a .debug* or .shstrtab section.
3615 * readelf.c (print_ops): Use hex for address operand.
3617 2007-10-04 Roland McGrath <roland@redhat.com>
3619 * unstrip.c (copy_elided_sections): Initialize NDX_SECTION element for
3620 .gnu_debuglink section to SHN_UNDEF. Drop STT_SECTION symbols for
3621 sections mapped to SHN_UNDEF.
3623 2007-10-04 Ulrich Drepper <drepper@redhat.com>
3625 * readelf.c (dump_archive_index): Avoid warning about uninitialized
3626 variable with older glibc versions.
3627 Add some branch prediction.
3629 2007-10-04 Roland McGrath <roland@redhat.com>
3631 * readelf.c (print_archive_index): New variable.
3632 (options, parse_opt): Accept -c/--archive-index to set it.
3633 (dump_archive_index): New function.
3634 (process_file): Take new arg WILL_PRINT_ARCHIVE_INDEX.
3635 Call dump_archive_index on archives if set.
3636 (main): Update caller.
3637 (any_control_option): Give it file scope, moved out of ...
3638 (parse_opt): ... here.
3640 2007-10-03 Roland McGrath <roland@redhat.com>
3642 * unstrip.c (struct arg_info): Add `list' flag.
3643 (options, parse_opt): Grok -n/--list to set it.
3644 (list_module): New function.
3645 (handle_implicit_modules): Call it under -n.
3647 * elflint.c (check_note_section): New function.
3648 (check_sections): Call it for SHT_NOTE.
3650 * readelf.c (handle_notes): Use sections when available.
3652 * elflint.c (check_note_data): New function, broken out of ...
3653 (check_note): ... here. Call it and elf_getdata_rawchunk.
3655 * readelf.c (handle_auxv_note): Take offset as argument, not buffer.
3656 Use elf_getdata_rawchunk and gelf_getauxv.
3657 (handle_notes_data): New function, broken out of ...
3658 (handle_notes): ... here. Call it and elf_getdata_rawchunk.
3660 2007-10-01 Roland McGrath <roland@redhat.com>
3662 * readelf.c (hex_dump): Fix transposed subtraction generating spaces.
3664 * readelf.c (hex_dump): Fix line header to be hex instead of decimal.
3666 2007-09-10 Roland McGrath <roland@redhat.com>
3668 * readelf.c (options): Give -p optional argument, alias --string-dump.
3669 (string_sections, string_sections_tail): New static variables.
3670 (parse_opt): Set them when -p has an argument.
3671 (print_string_section): New function, broken out of ...
3672 (print_strings): ... here. Call it.
3673 (dump_data_section): New function, broken out of ...
3674 (dump_data): ... here. Call it.
3675 (for_each_section_argument): New function, broken out of ...
3676 (dump_data): ... here. Call it.
3677 (dump_strings): New function.
3679 2007-08-31 Roland McGrath <roland@redhat.com>
3681 * readelf.c (print_strings): Typo fix.
3683 2007-08-23 Roland McGrath <roland@redhat.com>
3685 * readelf.c (printf_with_wrap): Function removed.
3686 (REGISTER_WRAP_COLUMN): New macro.
3687 (handle_core_register): Use print_core_item instead.
3688 (struct register_info): New type.
3689 (compare_registers, compare_register_sets): New functions.
3690 (register_bitpos, compare_sets_by_info): New functions.
3691 (handle_core_registers): Use those to segregate and sort registers
3694 * readelf.c (ITEM_WRAP_COLUMN): New macro.
3695 (print_core_item): New function.
3696 (handle_core_item): Use it instead of printf_with_wrap.
3697 (compare_core_items, compare_core_item_groups): New functions.
3698 (handle_core_items): Use them. Sort by group and force line breaks
3701 * readelf.c (handle_core_registers, handle_core_items): New functions,
3703 (handle_core_note): ... here. Call them.
3705 2007-08-22 Roland McGrath <roland@redhat.com>
3707 * unstrip.c (new_shstrtab): New function, broken out of ...
3708 (copy_elided_sections): ... here.
3710 2007-08-20 Roland McGrath <roland@redhat.com>
3712 Avoid local function trampolines in nm binary.
3713 * nm.c (sort_by_address): Move to a static function instead of local
3714 inside show_symbols.
3715 (sort_by_name_strtab): New static variable.
3716 (sort_by_name): Use it. Move to a static function instead of local
3717 inside show_symbols.
3718 (show_symbols): Set sort_by_name_strtab.
3720 2007-08-19 Roland McGrath <roland@redhat.com>
3722 * readelf.c (handle_auxv_note): New function.
3723 (handle_notes): Call it.
3725 * readelf.c (printf_with_wrap, convert): New functions.
3726 (handle_core_item, (handle_core_register): New functions.
3727 (handle_notes): Call those with details from ebl_core_note.
3729 2007-08-12 Roland McGrath <roland@redhat.com>
3731 * elflint.c (check_note): Accept type 0 with name "Linux".
3733 * elflint.c (special_sections): Accept SHF_ALLOC for ".note".
3735 * elflint.c (section_flags_string): Return "none" for 0, not "".
3737 2007-08-11 Roland McGrath <roland@redhat.com>
3739 * elflint.c (check_note): Accept NT_GNU_HWCAP, NT_GNU_BUILD_ID.
3741 2007-08-04 Ulrich Drepper <drepper@redhat.com>
3743 * readelf.c (hex_dump): Use isprint to determine whether to print
3744 character itself or full stop character.
3745 (dump_data): No need to check endp for NULL after strtol call.
3747 2007-08-03 Roland McGrath <roland@redhat.com>
3749 * readelf.c (print_string_sections): New variable.
3750 (options, parse_opt): Handle --strings/-p to set it.
3751 (print_strings): New function.
3752 (process_elf_file): Call it under -p.
3754 * readelf.c (options): Add hidden aliases --segments, --sections,
3755 as taken by binutils readelf.
3757 2007-08-01 Roland McGrath <roland@redhat.com>
3759 * readelf.c (dump_data_sections, dump_data_sections_tail):
3761 (options, parse_opt): Handle --hex-dump/-x, set them.
3762 (hex_dump): New function.
3763 (dump_data): New function, call it.
3764 (process_elf_file): Call it.
3766 2007-07-25 Roland McGrath <roland@redhat.com>
3768 * addr2line.c (show_symbols): New variable.
3769 (print_addrsym): New function.
3770 (handle_address): Call it.
3771 (options, parse_opt): Handle -S/--symbols.
3773 2007-06-05 Ulrich Drepper <drepper@redhat.com>
3775 * addr2line.c: Update for latest autoconf header.
3777 * elfcmp.c: Likewise.
3778 * elflint.c: Likewise.
3779 * findtextrel.c: Likewise.
3781 * ldgeneric.c: Likewise.
3783 * objdump.c: Likewise.
3784 * ranlib.c: Likewise.
3785 * readelf.c: Likewise.
3787 * strings.c: Likewise.
3788 * strip.c: Likewise.
3789 * unstrip.c: Likewise.
3791 2007-05-18 Roland McGrath <roland@redhat.com>
3793 * unstrip.c (copy_elided_sections): Match up non-NOBITS sections with
3794 stripped file, so as not to duplicate a section copied in both.
3796 * strip.c (handle_elf): Keep SHT_NOTE section copies in the debug file.
3798 2007-05-17 Roland McGrath <roland@redhat.com>
3800 * unstrip.c (copy_elided_sections): Don't call gelf_newphdr for 0.
3802 * unstrip.c (handle_file): Tweak BIAS != 0 warning.
3804 * unstrip.c (handle_file): Take new arg CREATE_DIRS. If set,
3805 call make_directories here.
3806 (handle_explicit_files): Take new arg CREATE_DIRS, pass it down.
3807 (handle_dwfl_module): Likewise.
3808 (handle_implicit_modules): Update callers.
3809 (handle_output_dir_module): Likewise. Don't do make_directories here.
3811 * unstrip.c (get_section_name): New function, broken out of ...
3812 (copy_elided_sections): here. Update callers.
3813 (find_alloc_section): Broken out of ...
3814 (copy_elided_sections): ... here. Update caller.
3815 (symtab_count_leading_section_symbols): Take new arg NEWSYMDATA,
3816 update STT_SECTION symbols' st_value fields as a side effect.
3817 (check_symtab_section_symbols): Update caller.
3818 (add_new_section_symbols): Set st_value in symbols added.
3819 (collect_symbols): Reset S->value for STT_SECTION symbols recorded.
3820 Take new arg SPLIT_BSS. Adjust S->shndx recorded for symbols moved
3821 from .bss to .dynbss.
3822 (find_alloc_sections_prelink): New function. Associate debug file
3823 allocated SHT_NOBITS shdrs with stripped moved by prelink via
3824 .gnu.prelink_undo information.
3825 (copy_elided_sections): Call it when we couldn't find every allocated
3826 section. Don't use a debug file non-NOBITS section if SHF_ALLOC.
3827 Take STRIPPED_EHDR arg instead of E_TYPE and PHNUM.
3828 (handle_file): Update callers.
3830 * unstrip.c (copy_elided_sections): Ignore unfound unallocated section
3833 * elflint.c (check_sections): Fix association of segments with
3834 sections when p_memsz > p_filesz.
3836 2007-04-29 Roland McGrath <roland@redhat.com>
3838 * addr2line.c (options, main): Tweak argp group settings to fix
3841 2007-04-28 Roland McGrath <roland@redhat.com>
3843 * strip.c (handle_elf): Update debug file's SHT_NOBITS sections'
3844 sizes to match sections adjusted in the stripped file.
3846 2007-04-24 Roland McGrath <roland@redhat.com>
3848 * elfcmp.c (OPT_HASH_INEXACT): New macro.
3849 (hash_inexact): New variable.
3850 (options, parse_opt): Add --hash-inexact option to set it.
3851 (hash_content_equivalent): New function.
3852 (main): Call it for differing SHT_HASH sections under --hash-inexact.
3854 2007-04-23 Roland McGrath <roland@redhat.com>
3856 * unstrip.c: New file.
3857 * Makefile.am (bin_PROGRAMS): Add it.
3858 (unstrip_LDADD): New variable.
3860 * strip.c (options): Allow --output for -o.
3862 2007-02-15 Ulrich Drepper <drepper@redhat.com>
3864 * readelf.c: Remove unused code. Add a few consts.
3866 2007-02-15 Roland McGrath <roland@redhat.com>
3868 * readelf.c (print_debug): Fix brainos in SHDR test.
3870 2007-02-05 Roland McGrath <roland@redhat.com>
3872 * ar.c: Include <limits.h>, since we use LONG_MAX.
3874 2007-02-05 Ulrich Drepper <drepper@redhat.com>
3876 * ar.c: Add ugly hack to work around gcc complaining that we
3877 ignore fchown's return value.
3878 (do_oper_insert): Handle error when writing padding.
3879 * ranlib.c: Add fchown complain work around.
3881 * arlib.c: Make symtab a global variable. Change all users.
3882 * arlib2.c: Likewise.
3883 * ranlib.c: Likewise.
3885 * arlib.h: Declare it.
3887 2007-01-11 Roland McGrath <roland@redhat.com>
3889 * elflint.c (check_sections): Use ebl_machine_section_flag_check on
3890 SHF_MASKPROC bits separately from generic sh_flags validation.
3892 2007-02-04 Ulrich Drepper <drepper@redhat.com>
3895 * arlib.c: New file.
3896 * arlib2.c: New file.
3897 * arlib.h: New file.
3898 * Makefile (noinst_LIBRARIES): Add libar.
3899 (libar_a_SOURCES): Define.
3901 (CFLAGS_ar): Define.
3902 * ranlib.c: Change to use arlib.
3904 * elflint.c (check_symtab): Work around GNU ld bug which omits
3905 sections but not symbols in those sections.
3907 2007-01-10 Ulrich Drepper <drepper@redhat.com>
3909 * addr2line.c: Update copyright year.
3910 * elfcmp.c: Likewise.
3911 * elflint.c: Likewise.
3912 * findtextrel.c: Likewise.
3915 * objdump.c: Likewise.
3916 * ranlib.c: Likewise.
3917 * readelf.c: Likewise.
3919 * strings.c: Likewise.
3920 * strip.c: Likewise.
3922 2006-12-09 Ulrich Drepper <drepper@redhat.com>
3924 * elflint.c (compare_hash_gnu_hash): New function. Report if the
3925 two hash tables have different content (module expected omission
3926 of undefined symbols).
3928 2006-10-31 Roland McGrath <roland@redhat.com>
3930 * elflint.c (check_program_header): Don't complain about
3931 p_filesz > p_memsz if p_memsz is zero and p_type is PT_NOTE.
3933 2006-09-19 Jakub Jelinek <jakub@redhat.com>
3935 * strip.c (process_file): Disallow -f on archives.
3937 2006-10-09 Roland McGrath <roland@redhat.com>
3939 * Makefile.am (libld_elf_i386.so): Use $(LINK), not $(CC).
3941 2006-08-29 Roland McGrath <roland@redhat.com>
3943 * Makefile.am (MAINTAINERCLEANFILES): New variable.
3945 * readelf.c (handle_relocs_rel): Typo fix, test DESTSHDR properly.
3946 Reported by Christian Aichinger <Greek0@gmx.net>.
3948 * elflint.c (valid_e_machine): Add EM_ALPHA.
3949 Reported by Christian Aichinger <Greek0@gmx.net>.
3951 2006-08-08 Ulrich Drepper <drepper@redhat.com>
3953 * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
3954 Keep track of which "high DT" entries are present.
3955 Check that either old or GNU-style hash table is present.
3956 If GNU-style hash table is used a symbol table is mandatory.
3957 Check that if any prelink entry is present all of them are.
3958 (check_gnu_hash): Only fail for undefined symbols in GNU-style hash
3959 table if they don't refer to functions.
3961 2006-07-17 Roland McGrath <roland@redhat.com>
3963 * elflint.c (struct version_namelist): Use GElf_Versym for `ndx' field.
3964 (add_version): Likewise for argument.
3965 (check_versym): Cast constant to GElf_Versym for comparison.
3967 2006-07-12 Roland McGrath <roland@redhat.com>
3969 * readelf.c (handle_gnu_hash): Add casts for machines where
3970 Elf32_Word != unsigned int.
3972 2006-07-12 Ulrich Drepper <drepper@redhat.com>
3974 * elflint.c (check_sysv_hash64): Fix printf format.
3976 2006-07-11 Roland McGrath <roland@redhat.com>
3978 * addr2line.c (options): English fix in -f doc string.
3980 * addr2line.c (use_comp_dir): New variable.
3981 (options, parse_opt): Grok -A/--absolute to set it.
3982 (handle_address): If set, prepend dwfl_line_comp_dir results to
3983 relative file names.
3985 2006-07-06 Ulrich Drepper <drepper@redhat.com>
3987 * elflint.c: Adjust for latest new hash table format.
3988 * readelf.c: Likewise.
3990 * elflint.c (check_versym): Ignore hidden bit when comparing version
3993 2006-07-05 Ulrich Drepper <drepper@redhat.com>
3995 * ldgeneric.c (ld_generic_create_outfile): Correctly recognize
3996 discarded COMDAT symbols.
3998 * i386_ld.c (elf_i386_count_relocations): Lot of corrections.
3999 (elf_i386_create_relocations): Likewise.
4000 * ld.h (struct symbol): Add local and hidden bits.
4001 * ld.c (create_special_section_symbol): These synthsized symbols
4002 are local and hidden.
4003 * ldgeneric.c (file_process2): Check whether input file matches
4005 (fillin_special_symbol): Create symbols as local and/or hidden
4007 (ld_generic_create_outfile): Make local copy of symbol.
4008 Don't hide global, defined symbols in dynamic symbol table unless
4009 requested. Synthetic symbols have no version information.
4011 * elflint.c: Add support for checking 64-bit SysV-style hash tables.
4012 * readelf.c: Add support for printing 64-bit SysV-style hash tables.
4014 2006-07-04 Ulrich Drepper <drepper@redhat.com>
4016 * elflint.c (is_rel_dyn): Fix and extend DT_RELCOUNT/DT_RELACOUNT
4019 2006-07-03 Ulrich Drepper <drepper@redhat.com>
4021 * elflint.c: Add testing of DT_GNU_HASH.
4022 * readelf.c: Implement showing histogram for DT_GNU_HASH section.
4024 * Makefile.am: Add hacks to create dependency files for non-generic
4027 2006-06-12 Ulrich Drepper <drepper@redhat.com>
4029 * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
4030 section if creating a DSO and no interpreter is given.
4031 (ld_generic_create_outfile): Don't store reference to symbols in
4032 discarded COMDAT groups. Don't create PHDR and INTERP program header
4033 for DSO if no interpreter is specified.
4034 (create_verneed_data): Pretty printing.
4036 * ldscript.y (content): If a DSO is created don't set default
4037 interpreter from linker script.
4039 * i386_ld.c (elf_i386_count_relocations): Do not add relocations
4040 for symbols in discarded COMDAT groups.
4041 (elf_i386_create_relocations): Likewise.
4042 * ld.h (struct scninfo): Add unused_comdat.
4043 * ldgeneric.c (add_section): Also check group signature when
4044 matching COMDAT sections.
4045 (add_relocatable_file): Ignore symbols in COMDAT group which are
4048 * elflint.c (check_one_reloc): For *_NONE relocs only check type
4049 and symbol reference.
4051 2006-06-11 Ulrich Drepper <drepper@redhat.com>
4053 * elflint.c (check_dynamic): Fix checking value of tags which are
4054 offsets in the string section. Make sure DT_STRTAB points to the
4055 section referenced in sh_link.
4057 * ld.c (options): Add headers. Add short option 'R' for '--rpath'.
4059 * ld.c: Recognize --eh-frame-hdr option.
4060 * ld.h (struct ld_state): Add eh_frame_hdr field.
4061 * ldgeneric.c (struct unw_eh_frame_hdr): Define.
4063 * ldgeneric.c (add_section): Use ebl_sh_flags_combine instead of
4065 (add_relocatable_file): Minor optimization of last change.
4066 (match_section): Don't preserve SHF_GROUP flag any longer.
4068 2006-06-10 Ulrich Drepper <drepper@redhat.com>
4070 * ld.c (parse_z_option): Recognize execstack and noexecstack.
4071 Handle record and ignore as position dependent options.
4072 (parse_z_option_2): Handle ignore and record here.
4073 * ld.h (struct ld_state): Add execstack field.
4074 * ldgeneric.c (add_relocatable_file): Recognize .note.GNU-stack
4076 (ld_generic_create_outfile): Fix program header creation in native
4077 linker. Add PT_GNU_STACK program header.
4079 2006-06-09 Ulrich Drepper <drepper@redhat.com>
4081 * i386_ld.c (elf_i386_finalize_plt): Don't change symbol table entries
4082 for PLT entries if there is no local definition.
4084 * ld.c (parse_option): Handle -z ignore like --as-needed and
4085 -z record like --no-as-needed.
4086 * ld.h (struct ld_state): Remove ignore_unused_dsos field.
4087 * ldgeneric.c (new_generated_scn): Always compute ndt_needed by
4088 looping over DSOs. When deciding about adding DT_NEEDED entries
4089 use ->as_needed instead of ignore_unused_dsos.
4091 2006-05-31 Ulrich Drepper <drepper@redhat.com>
4093 * ld.c: Recognize --as-needed and --no-as-needed options.
4094 * ld.h (struct usedfile): Add as_needed field.
4095 (struct ld_state): Likewise.
4096 * ldgeneric.c (ld_handle_filename_list): Copy as_needed flag from
4098 * ldscript.y (filename_id_list): Split to correctly parse all
4100 (mark_as_needed): Fix loop.
4102 2006-05-28 Ulrich Drepper <drepper@redhat.com>
4104 * addr2line.c (print_dwarf_function): Use unsigned type for lineno
4107 2006-05-27 Ulrich Drepper <drepper@redhat.com>
4109 * readelf.c (handle_relocs_rela): Better notations for addon value.
4110 (print_ehdr): Distinguish e_ident[EI_VERSION] from e_version.
4112 2006-04-04 Ulrich Drepper <drepper@redhat.com>
4114 * addr2line.c: Update copyright year.
4115 * elfcmp.c: Likewise.
4116 * elflint.c: Likewise.
4117 * findtextrel.c: Likewise.
4120 * objdump.c: Likewise.
4121 * ranlib.c: Likewise.
4122 * readelf.c: Likewise.
4124 * strings.c: Likewise.
4125 * strip.c: Likewise.
4127 2006-03-09 Roland McGrath <roland@redhat.com>
4129 * Makefile.am (AM_LDFLAGS): New variable.
4131 2006-03-01 Roland McGrath <roland@redhat.com>
4133 * readelf.c (dwarf_tag_string, dwarf_attr_string): Update name tables
4134 for dwarf.h changes matching 3.0 spec.
4135 (dwarf_encoding_string, dwarf_lang_string, print_ops): Likewise.
4137 2005-12-04 Ulrich Drepper <drepper@redhat.com>
4139 * elflint.c (check_one_reloc): If relocation section is not loaded,
4140 don't check whether the relocations modify read-only sections or
4141 loaded and unloaded sections.
4143 2005-11-28 Ulrich Drepper <drepper@redhat.com>
4145 * elflint.c (check_one_reloc): Take additional parameters. Use
4146 them to determine whether relocation is valid in this type of
4147 file. DSOs and executables can contain relocation sections in
4148 unloaded sections which just show the relocations the linker
4149 applied. Adjust all callers.
4150 (check_program_header): Check that PT_PHDR is loaded and that offset
4151 matches the one in the ELF header.
4153 2005-10-26 Roland McGrath <roland@redhat.com>
4155 * nm.c (get_var_range): dwarf_getloclist -> dwarf_getlocation.
4157 2005-09-03 Ulrich Drepper <drepper@redhat.com>
4159 * strip.c (handle_elf): Unify some error messages.
4160 * ld.c (main): Likewise.
4161 * ldgeneric.c (open_elf): Likewise.
4162 * elfcmp.c (main): Likewise.
4163 * elflint.c (check_elf_header): Likewise.
4165 * size.c (process_file): Fix typo in error message.
4167 * readelf.c: Lots of little cleanups. Use _unlocked functions.
4169 2005-09-02 Ulrich Drepper <drepper@redhat.com>
4171 * strings.c (main): Reset elfmap variable after munmap call.
4172 [_MUDFLAP] (map_file): Simplify mudflap debugging by not using mmap.
4174 2005-08-28 Ulrich Drepper <drepper@redhat.com>
4176 * ranlib.c: Don't define pread_retry and write_retry here.
4178 * Makefile.an [BUILD_STATIC] (libdw): Add -ldl.
4179 (CLEANFILES): Add *.gcno *.gcda *.gconv.
4181 * strings.c (process_chunk): Reorder expressions in conditional
4182 (process_chunk_mb): Likewise.
4184 * strings.c: New file.
4185 * Makefile.am (bin_PROGRAMS): Add strings.
4186 (strings_no_Wstring): Define.
4187 (strings_LDADD): Define.
4189 2005-08-27 Roland McGrath <roland@redhat.com>
4191 * addr2line.c (dwarf_diename_integrate): Function removed.
4192 (print_dwarf_function): Use plain dwarf_diename.
4194 2005-08-24 Ulrich Drepper <drepper@redhat.com>
4196 * elflint.c (check_versym): Versioned symbols should not have
4199 2005-08-15 Ulrich Drepper <drepper@redhat.com>
4201 * elflint.c (check_versym): Allow VER_NDX_LOCAL symbols to be
4204 * Makefile.am: Add rules to build ranlib.
4205 * ranlib.c: New file.
4207 2005-08-14 Roland McGrath <roland@redhat.com>
4209 * elflint.c (check_sections): Use ebl_section_type_name and allow any
4210 sh_type it recognizes.
4212 * elflint.c (check_sections): Print unknown flags in hex, don't
4213 truncate high bits. Print section number and name for unknown type.
4215 2005-08-13 Roland McGrath <roland@redhat.com>
4217 * elflint.c (check_program_header): Use ebl_segment_type_name and
4218 allow any p_type it recognizes. Include p_type value in error
4219 message for unknown type.
4221 2005-08-13 Ulrich Drepper <drepper@redhat.com>
4223 * elflint.c (check_symtab): Simplify last change a bit. Pass ehdr
4224 to ebl_check_special_symbol.
4225 (check_sections): Pass ehdr to ebl_bss_plt_p.
4227 2005-08-12 Roland McGrath <roland@redhat.com>
4229 * elflint.c (check_symtab): Check that _GLOBAL_OFFSET_TABLE_ st_shndx
4230 refers to the right section if it's not SHN_ABS.
4231 Let ebl_check_special_symbol override _G_O_T_ value and size checks.
4233 * elflint.c (check_sections): Don't complain about a non-NOBITS
4234 section taking no segment space, if it's sh_size is 0.
4236 * elflint.c (check_sections): Use ebl_bss_plt_p to see if .plt should
4237 be PROGBITS or NOBITS.
4239 * elflint.c (check_symtab): Use ebl_check_special_symbol to override
4240 standard st_value and st_size checks.
4242 2005-07-28 Roland McGrath <roland@redhat.com>
4244 * addr2line.c (options, parse_opt): Don't handle -e here.
4245 (executable): Variable removed.
4246 (argp_children): New static variable.
4247 (argp): Use it. Make const.
4248 (main): Fill in argp_children from dwfl_standard_argp ().
4249 Let libdwfl handle file selection, pass Dwfl handle to handle_address.
4250 (print_dwarf_function): New function. Try to figure out inline chain.
4251 (elf_getname): Function removed, libdwfl does it for us.
4252 (handle_address): Take Dwfl handle instead of Elf, Dwarf handles.
4253 Use dwfl_module_addrname instead of elf_getname.
4254 Use dwfl_module_getsrc and dwfl_lineinfo instead of libdw calls.
4255 * Makefile.am (INCLUDES): Add libdwfl directory to path.
4257 2005-08-10 Ulrich Drepper <drepper@redhat.com>
4259 * strip.c (parse_opt): STATE parameter is now used.
4260 Various little cleanups.
4262 * readelf.c (print_debug_line_section): Correct fallout of renaming
4263 of DW_LNS_set_epilog_begin.
4265 2005-08-08 Roland McGrath <roland@redhat.com>
4267 * strip.c (options, parse_opt): Grok -R .comment for compatibility
4268 with binutils strip. Likewise -d, -S, as aliases for -g.
4269 Likewise ignore -s/--strip-all.
4271 2005-08-07 Roland McGrath <roland@redhat.com>
4273 * strip.c (process_file): Open read-only when using a different output
4276 2005-08-06 Ulrich Drepper <drepper@redhat.com>
4278 * elflint.c (in_nobits_scn): New function.
4279 (check_versym): Allow references for defined symbols against versions
4280 of other DSOs also for symbols in nobits sections.
4281 Move a few variables around.
4283 * Makefile.am (AM_CFLAGS): Avoid duplication.
4284 Link with statis libs if BUILD_STATIC.
4286 2005-08-05 Ulrich Drepper <drepper@redhat.com>
4288 * elflint.c: Many, many more tests. Mostly related to symbol
4289 versioning. Those sections should now be completely checked.
4291 * readelf.c (print_dynamic): Use gelf_offscn.
4293 2005-08-04 Ulrich Drepper <drepper@redhat.com>
4295 * elflint.c: Add lots more tests: more extension symbol table sanity,
4296 versioning section tests, hash table tests. General cleanup.
4298 2005-08-02 Ulrich Drepper <drepper@redhat.com>
4300 * objdump.c: New file.
4301 * Makefile.am (bin_PROGRAMS): Add objdump.
4302 (objdump_LDADD): Define.
4304 * elflint.c (check_reloc_shdr): New function split out from check_rela
4306 (check_one_reloc): New function. Likewise.
4307 (check_rela): Use check_reloc_shdr and check_one_reloc.
4308 (check_rel): Likewise.
4309 (check_program_header): Check that PT_DYNAMIC entry matches .dynamic
4311 Add checks that relocations against read-only segments are flagged,
4312 that the text relocation flag is not set unnecessarily, and that
4313 relocations in one section are either against loaded or not-loaded
4316 2005-08-01 Ulrich Drepper <drepper@redhat.com>
4318 * elfcmp.c (main): Ignore section count and section name string table
4321 2005-07-27 Roland McGrath <roland@redhat.com>
4323 * elfcmp.c: Include <locale.h>.
4325 2005-07-27 Ulrich Drepper <drepper@redhat.com>
4327 * elfcmp.c: Print name and index of differing section.
4329 2005-07-24 Ulrich Drepper <drepper@redhat.com>
4331 * elfcmp.c: Implement comparing gaps between sections.
4333 2005-07-23 Ulrich Drepper <drepper@redhat.com>
4335 * elflint.c: Include libeblP.h instead of libebl.h.
4337 * readelf.c: Likewise.
4338 * elfcmp.c: Likewise.
4340 * elfcmp.c (main): Compare individual ELF header fields, excluding
4341 e_shoff instead of the whole struct at once.
4342 Use ebl_section_strip_p instead of SECTION_STRIP_P.
4343 * strip.c: Use ebl_section_strip_p instead of SECTION_STRIP_P.
4345 2005-07-22 Ulrich Drepper <drepper@redhat.com>
4347 * elfcmp.c (main): Take empty section into account when comparing
4350 * elflint.c (check_dynamic): Check that d_tag value is >= 0 before
4353 2005-07-21 Ulrich Drepper <drepper@redhat.com>
4355 * elfcmp.c: New file.
4356 * Makefile.am (bin_PROGRAMS): Add elfcmp.
4357 (elfcmp_LDADD): Define.
4359 * elflint.c (check_rela): Check that copy relocations only reference
4360 object symbols or symbols with unknown type.
4361 (check_rel): Likewise.
4363 2005-06-08 Roland McGrath <roland@redhat.com>
4365 * readelf.c (print_ops): Add consts.
4367 2005-05-31 Roland McGrath <roland@redhat.com>
4369 * readelf.c (print_debug_abbrev_section): Don't bail after first CU's
4370 abbreviations. Print a header line before each CU section.
4372 * readelf.c (print_debug_loc_section): Fix indentation for larger
4375 2005-05-30 Roland McGrath <roland@redhat.com>
4377 * readelf.c (print_debug_line_section): Print section offset of each
4378 CU's table, so they are easy to find from seeing the stmt_list value.
4380 * readelf.c (dwarf_attr_string): Add all attributes in <dwarf.h>.
4381 (attr_callback): Grok DW_AT_ranges and print offset in hex.
4383 * readelf.c (attr_callback): Add 2 to addrsize * 2 for %#0* format.
4384 (print_debug_ranges_section, print_debug_loc_section): Likewise.
4386 * readelf.c (print_ops): Take different args for indentation control.
4387 (attr_callback): Caller updated.
4388 Grok several more block-form attributes as being location expressions.
4389 For those same attributes with udata forms, format output differently
4390 for location list offset.
4391 (print_debug_loc_section): Implement it for real.
4393 * readelf.c (options): Mention ranges for --debug-dump.
4394 (enum section_e): Add section_ranges.
4395 (parse_opt): Grok "ranges" for -w/--debug-dump.
4396 (print_debug_ranges_section): New function.
4397 (print_debug): Handle .debug_ranges section.
4399 2005-05-30 Ulrich Drepper <drepper@redhat.com>
4401 * readelf.c (handle_notes): At least x86-64 need not have the note
4402 section values aligned to 8 bytes.
4404 2005-05-18 Ulrich Drepper <drepper@redhat.com>
4406 * readelf.c (dwarf_tag_string): Add new tags.
4408 2005-05-08 Roland McGrath <roland@redhat.com>
4410 * strip.c (handle_elf): Don't translate hash and versym data formats,
4411 elf_getdata already did it for us.
4413 2005-05-07 Ulrich Drepper <drepper@redhat.com>
4415 * Makefile.am (findtextrel_LDADD): Add $(libmudflap).
4416 (addr2line_LDADD): Likewise.
4418 2005-05-03 Roland McGrath <roland@redhat.com>
4420 * strip.c (handle_elf): Apply symbol table fixups to discarded
4421 relocation sections when they are being saved in the debug file.
4423 * strip.c (handle_elf): Pass EHDR->e_ident[EI_DATA] to gelf_xlatetom
4424 and gelf_xlatetof, not the native byte order.
4426 * strip.c (parse_opt): Give error if -f or -o is repeated.
4427 (main): Exit if argp_parse returns nonzero.
4429 * strip.c (debug_fname_embed): New variable.
4430 (options, parse_opt): New option -F to set it.
4432 2005-05-07 Ulrich Drepper <drepper@redhat.com>
4434 * readelf.c (parse_opt): Make any_control_option variable
4435 local. Simplify some tests.
4437 2005-05-03 Roland McGrath <roland@redhat.com>
4439 * strip.c (crc32_file): Function removed (now in ../lib).
4441 2005-05-03 Roland McGrath <roland@redhat.com>
4443 * elflint.c (is_debuginfo): New variable.
4444 (options, parse_opt): New option --debuginfo/-d to set it.
4445 (check_sections): If is_debuginfo, don't complain about SHT_NOBITS.
4446 (check_note): If is_debuginfo, don't try to get note contents.
4448 2005-04-24 Ulrich Drepper <drepper@redhat.com>
4450 * readelf.c (print_debug_abbrev_section): Don't print error when end of
4453 2005-04-14 Ulrich Drepper <drepper@redhat.com>
4455 * readelf.c (dwarf_encoding_string): New function.
4456 (dwarf_inline_string): New function.
4457 (dwarf_access_string): New function.
4458 (dwarf_visibility_string): New function.
4459 (dwarf_virtuality_string): New function.
4460 (dwarf_identifier_case_string): New function.
4461 (dwarf_calling_convention_string): New function.
4462 (dwarf_ordering_string): New function.
4463 (dwarf_discr_list_string): New function.
4464 (attr_callback): Decode man more attribute values.
4466 2005-04-01 Ulrich Drepper <drepper@redhat.com>
4468 * addr2line.c: Finish implementation of -f option.
4470 2005-03-29 Ulrich Drepper <drepper@redhat.com>
4472 * addr2line.c: New file.
4473 * Makefile.am (bin_PROGRAMS): Add addr2line.
4474 Define addr2line_LDADD.
4476 * findtextrel.c: Use new dwarf_addrdie function.
4478 * findtextrel.c: Fix usage message and re-add accidentally removed
4481 2005-03-28 Ulrich Drepper <drepper@redhat.com>
4483 * findtextrel.c: New file.
4484 * Makefile: Add rules to build findtextrel.
4486 2005-02-15 Ulrich Drepper <drepper@redhat.com>
4488 * ldlex.l: Provide ECHO definition to avoid warning.
4490 * elflint.c (check_program_header): Fix typo in RELRO test.
4492 * Makefile.am (AM_CFLAGS): Add more warning options.
4493 * elflint.c: Fix warnings introduced by the new warning options.
4494 * i386_ld.c: Likewise.
4497 * ldgeneric.c: Likewise.
4499 * readelf.c: Likewise.
4500 * sectionhash.c: Likewise.
4502 * string.c: Likewise.
4504 2005-02-05 Ulrich Drepper <drepper@redhat.com>
4506 * Makefile.am: Check for text relocations in constructed DSOs.
4508 * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap. Link all apps
4511 * ldscript.y: Add as_needed handling.
4512 * ldlex.l: Recognize AS_NEEDED token.
4513 * ld.h (struct filename_list): Add as_needed flag.
4515 2005-02-04 Ulrich Drepper <drepper@redhat.com>
4517 * elflint.c (check_symtab): Correctly determine size of GOT section.
4519 2005-01-19 Ulrich Drepper <drepper@redhat.com>
4521 * ld.c: Remove unnecessary more_help function. Print bug report
4523 * strip.c: Likewise.
4526 * readelf.c: Likewise.
4527 * elflint.c: Likewise.
4529 * elflint.c (main): Don't check for parameter problems here.
4530 (parse_opt): Do it here, where we get informed about some of them
4533 * readelf.c (main): Don't check for parameter problems here.
4534 (parse_opt): Do it here, where we get informed about some of them
4537 2005-01-11 Ulrich Drepper <drepper@redhat.com>
4539 * strip.c: Update copyright year.
4540 * readelf.c: Likewise.
4544 * elflint.c: Likewise.
4546 * elflint.c (check_symtab): Don't warn about wrong size for
4547 _DYNAMIC and __GLOBAL_OFFSET_TABLE__ for --gnu-ld.
4549 2004-10-05 Ulrich Drepper <drepper@redhat.com>
4551 * readelf.c (print_phdr): In section mapping, also indicate
4552 sections in read-only segments.
4554 2004-09-25 Ulrich Drepper <drepper@redhat.com>
4556 * readelf.c: Make compile with gcc 4.0.
4557 * strip.c: Likewise.
4559 2004-08-16 Ulrich Drepper <drepper@redhat.com>
4561 * strip.c (handle_elf): Rewrite dynamic memory handling to use of
4562 allocate to work around gcc 3.4 bug.
4564 2004-01-25 Ulrich Drepper <drepper@redhat.com>
4566 * ldlex.l (invalid_char): Better error message.
4568 2004-01-23 Ulrich Drepper <drepper@redhat.com>
4570 * readelf.c: Print SHT_GNU_LIBLIST sections.
4572 * none_ld.c: New file.
4574 2004-01-21 Ulrich Drepper <drepper@redhat.com>
4576 * Makefile.am: Enable building of machine specific linker.
4578 2004-01-20 Ulrich Drepper <drepper@redhat.com>
4580 * Makefile.am: Support building with mudflap.
4582 * i386_ld.c: Fix warnings gcc 3.4 spits out.
4583 * ldgeneric.c: Likewise.
4584 * ldscript.y: Likewise.
4585 * readelf.c: Likewise.
4586 * strip.c: Likewise.
4588 * readelf.c (print_debug_line_section): Determine address size
4591 2004-01-19 Ulrich Drepper <drepper@redhat.com>
4593 * readelf.c (print_phdr): Show which sections are covered by the
4596 * elflint.c (check_program_header): Check PT_GNU_RELRO entry.
4598 * readelf.c (print_debug_macinfo_section): Implement.
4600 2004-01-18 Ulrich Drepper <drepper@redhat.com>
4602 * readelf.c (print_debug_line_section): Implement.
4604 2004-01-17 Ulrich Drepper <drepper@redhat.com>
4606 * src/elflint.c: Use PACKAGE_NAME instead of PACKAGE.
4607 * src/ld.c: Likewise.
4608 * src/nm.c: Likewise.
4609 * src/readelf.c: Likewise.
4610 * src/size.c: Likewise.
4611 * src/strip.c: Likewise.
4613 * strip.c: Add a few more unlikely. Reduce scope of some variables.
4615 * Makefile.am: Support building with mudflap.
4617 2004-01-16 Ulrich Drepper <drepper@redhat.com>
4619 * readelf.c (print_debug_info_section): Free dies memory.
4621 * readelf.c: Print .debug_info section content.
4623 2004-01-13 Ulrich Drepper <drepper@redhat.com>
4625 * readelf.c (print_shdr): Add support for SHF_ORDERED and SHF_EXCLUDE.
4627 2004-01-12 Ulrich Drepper <drepper@redhat.com>
4629 * readelf.c (print_debug_aranges): Implement using libdw.
4631 2004-01-11 Ulrich Drepper <drepper@redhat.com>
4633 * nm.c: Adjust for Dwarf_Files type and dwarf_lineno interface change.
4635 * readelf.c: Use libdw instead of libdwarf. Not all of the old
4636 behavior is available yet.
4637 * Makefile.am: Link readelf with libdw. Remove libdwarf include path.
4639 2004-01-09 Ulrich Drepper <drepper@redhat.com>
4641 * nm.c (get_local_names): Adjust call to dwarf_nextcu.
4643 * nm.c: Implement getting information about local variables.
4645 2004-01-07 Ulrich Drepper <drepper@redhat.com>
4647 * nm.c: Read also debug information for local symbols.
4649 2004-01-05 Ulrich Drepper <drepper@redhat.com>
4651 * nm.c: Shuffle dwarf handling code around so the maximum column
4652 width can be computed ahead of printing. Avoid collection symbols
4653 which are not printed anyway.
4655 * nm.c: Rewrite dwarf handling to use libdw.
4656 * Makefile.am (AM_CFLAGS): Add -std parameter.
4657 (INCLUDES): Find header in libdw subdir.
4658 (nm_LDADD): Replace libdwarf with libdw.
4660 * elflint.c: Update copyright year.
4661 * readelf.c: Likewise.
4663 * strip.c: Likewise.
4666 2003-12-31 Ulrich Drepper <drepper@redhat.com>
4668 * strip.c (process_file): Close file before returning.
4670 2003-11-19 Ulrich Drepper <drepper@redhat.com>
4672 * readelf.c (handle_dynamic): Make column for tag name wider.
4674 2003-09-29 Ulrich Drepper <drepper@redhat.com>
4676 * readelf.c (handle_dynamic): Always terminate tag name with a space.
4678 2003-09-25 Ulrich Drepper <drepper@redhat.com>
4680 * strip.c (process_file): Don't mmap the input file, we modify the
4681 data structures and don't want the change end up on disk.
4683 2003-09-23 Jakub Jelinek <jakub@redhat.com>
4685 * unaligned.h (union u_2ubyte_unaligned,
4686 union u_4ubyte_unaligned, union u_8ubyte_unaligned): Add
4688 (add_2ubyte_unaligned, add_4ubyte_unaligned,
4689 add_8ubyte_unaligned): Avoid nesting bswap_NN macros.
4690 Read/store value through _ptr->u instead of *_ptr.
4692 2003-09-22 Ulrich Drepper <drepper@redhat.com>
4694 * size.c (show_sysv): Change type of maxlen to int.
4696 * strip.c (handle_elf): Handle the 64-bit archs which is 64-bit
4699 * i386_ld.c: Many many fixes and extensions.
4701 * ldgeneric.c: Likewise.
4703 2003-08-16 Ulrich Drepper <drepper@redhat.com>
4705 * ldgeneric.c (check_definition): Don't add symbol on dso_list if
4706 the reference is from another DSO.
4708 2003-08-15 Ulrich Drepper <drepper@redhat.com>
4710 * ldgeneric.c (find_entry_point): It is no fatal error if no entry
4711 point is found when creating a DSO.
4713 2003-08-14 Ulrich Drepper <drepper@redhat.com>
4715 * ld.c (main): Always call FLAG_UNRESOLVED.
4716 * ldgeneric.c (ld_generic_flag_unresolved): Only complain about
4717 undefined symbols if not creating DSO or ld_state.nodefs is not set.
4719 2003-08-13 Ulrich Drepper <drepper@redhat.com>
4721 * Makefile.in: Depend on libebl.a, not libebl.so.
4723 * ld.c (main): Mark stream for linker script as locked by caller.
4724 (read_version_script): Likewise.
4725 * ldlex.c: Define fread and fwrite to _unlocked variant.
4727 * i386_ld.c (elf_i386_finalize_plt): Replace #ifdefs with uses of
4729 * unaligned.h: Define target_bswap_16, target_bswap_32, and
4731 (store_2ubyte_unaligned, store_4ubyte_unaligned,
4732 store_8ubyte_unaligned): Define using new macros.
4734 2003-08-12 Ulrich Drepper <drepper@redhat.com>
4736 * i386_ld.c (elf_i386_finalize_plt): Use packed structs to access
4737 possibly unaligned memory. Support use of big endian machines.
4739 2003-08-11 Ulrich Drepper <drepper@redhat.com>
4741 * Moved to CVS archive.