0490088e30b91c87134d01e1c6b28f4ff4aa521b
[platform/upstream/elfutils.git] / src / ChangeLog
1 2023-01-10  Mark Wielaard  <mark@klomp.org>
2
3         * readelf.c (get_debug_elf_data): New function.
4         (print_debug_abbrev_section): Use get_debug_elf_data.
5         (print_debug_addr_section): Likewise.
6         (print_debug_aranges_section): Likewise.
7         (print_debug_rnglists_section): Likewise.
8         (print_debug_ranges_section): Likewise.
9         (print_debug_frame_section): Likewise.
10         (print_debug_units): Likewise.
11         (print_debug_line_section): Likewise.
12         (print_debug_loclists_section): Likewise.
13         (print_debug_loc_section): Likewise.
14         (print_debug_macinfo_section): Likewise.
15         (print_debug_macro_section): Likewise.
16         (print_debug_str_section): Likewise.
17         (print_debug_str_offsets_section): Likewise.
18         (print_debug_pubnames_section): Likewise.
19
20 2022-12-21  Shahab Vahedi  <shahab@synopsys.email>
21
22         * elflint.c (valid_e_machine): Add EM_ARCV2.
23
24 2022-12-02  Hengqi Chen  <hengqi.chen@gmail.com>
25
26         * elflint.c (valid_e_machine): Add EM_LOONGARCH.
27
28 2022-11-03  Mark Wielaard  <mark@klomp.org>
29
30         * readelf.c (get_dynscn_addrs): Check gelf_getdyn doesn't
31         return NULL.
32
33 2022-11-03  Mark Wielaard  <mark@klomp.org>
34
35         * readelf.c (handle_dynamic): Check phdr != NULL when
36         use_dynamic_segment, otherwise check shdr != NULL.
37
38 2022-10-28  Arsen Arsenović  <arsen@aarsen.me>
39
40         * readelf.c (options): Add Binutils-style --syms alias.
41
42 2022-10-19  Mark Wielaard  <mark@klomp.org>
43
44         * readelf.c (dwarf_loc_list_encoding_string): Handle
45         DW_LLE_GNU_view_pair.
46         (print_debug_loclists_section): Likewise.
47
48 2022-09-20  Yonggang Luo  <luoyonggang@gmail.com>
49
50         * arlib.h: Use BYTE_ORDER, LITTLE_ENDIAN and BIG_ENDIAN.
51
52 2022-08-28  Mark Wielaard  <mark@klomp.org>
53
54         * ar.c (do_oper_extract): Predecrement instance before compare
55         to zero.
56         (do_oper_delete): Likewise.
57
58 2022-08-10  Andreas Schwab  <schwab@suse.de>
59
60         * readelf.c (print_attributes): Also handle SHT_RISCV_ATTRIBUTES.
61
62 2022-08-09  Andreas Schwab  <schwab@suse.de>
63
64         * elflint.c (check_program_header): Don't complain about p_filesz
65         > p_memsz if p_memsz is zero and p_type is PT_RISCV_ATTRIBUTES.
66
67 2022-08-01  Mark Wielaard  <mark@klomp.org>
68
69         * readelf.c (handle_dynamic): Pass start of buffer to memrchr.
70         Use dyn->d_un.d_val for offsets instead of d_ptr.
71
72 2022-04-28  Di Chen  <dichen@redhat.com>
73
74         * readelf.c (options): Add use-dynamic 'D'.
75         (use_dynamic_segment): New static bool.
76         (enum dyn_idx): New.
77         (get_dynscn_strtab): New function.
78         (get_dynscn_addrs): Likewise.
79         (find_offsets): Likewise.
80         (parse_opt): Handle 'D'.
81         (handle_dynamic): New argument phdr. Get data either through the shdr
82         or phdr.  Print segment info when use_dynamic_segment. Use
83         get_dynscn_strtab. Get library name and paths through strtab_data.
84
85 2022-05-09  Mark Wielaard  <mark@klomp.org>
86
87         * strip.c (remove_debug_relocations): Check gelf_getshdr, gelf_getrela,
88         gelf_getrel and gelf_getsymshndx don't return NULL.
89
90 2022-05-10  Mark Wielaard  <mark@klomp.org>
91
92         * elfcompress.c (process_file): Sanity check shstrtab_name,
93         shstrtab_newname and symstrents are only set once.
94
95 2022-04-24  Mark Wielaard  <mark@klomp.org>
96
97         * elfclassify.c (main): Use classify_flag_no_stdin for no-std in options.
98
99 2022-04-19  Mark Wielaard  <mark@klomp.org>
100
101         * readelf.c (get_dyn_ents): Define dyn_mem outside the while loop.
102
103 2022-03-01  Di Chen  <dichen@redhat.com>
104
105         * readelf.c (get_dyn_ents): New function.
106         (handle_dynamic): Use get_dyn_ents to get the actual number of
107         Dynamic entries in the section.
108
109 2022-03-27  Mark Wielaard  <mark@klomp.org>
110
111         * addr2line.c: Replace error (EXIT_FAILURE, ...) with error_exit(...).
112         * ar.c: Likewise.
113         * arlib.c: Likewise.
114         * elfcompress.c: Likewise.
115         * nm.c: Likewise.
116         * objdump.c: Likewise.
117         * readelf.c: Likewise.
118         * size.c: Likewise.
119         * strings.c: Likewise.
120         * strip.c: Likewise.
121         * unstrip.c: Likewise.
122
123 2022-03-24  Mark Wielaard  <mark@klomp.org>
124
125         * elflint.c (check_note_data): Recognize NT_FDO_PACKAGING_METADATA.
126
127 2022-03-11  Mark Wielaard  <mark@klomp.org>
128
129         * addr2line.c (OPT_RELATIVE): New constant.
130         (options): Add --relative.
131         (use_comp_dir): Initialize to true.
132         (parse_opt): Handle OPT_RELATIVE.
133
134 2021-12-04  Mark Wielaard  <mark@klomp.org>
135
136         * readelf.c (print_ehdr): Pass sizeof (buf) - 1 to strncpy.
137
138 2021-10-20  John M Mellor-Crummey  <johnmc@rice.edu>
139
140         * readelf.c (print_debug_line_section): Try to read
141         debug_str_offset if available.  Handle DW_LNE_NVIDIA_inlined_call
142         and DW_LNE_NVIDIA_set_function_name.
143
144 2021-10-06  Mark Wielaard  <mark@klomp.org>
145
146         * elflint.c (check_sections): Don't dereference databits if bad.
147
148 2021-09-09  Dmitry V. Levin  <ldv@altlinux.org>
149
150         * findtextrel.c: Include "libeu.h".
151         (open_rootdir_file): New function.
152         (process_file): Use it to open file inside rootdir.
153         * Makefile.am (findtextrel_no_Wstack_usage): Remove.
154
155 2021-09-06  Dmitry V. Levin  <ldv@altlinux.org>
156
157         * objdump.c (show_disasm): Replace asprintf followed by
158         error(EXIT_FAILURE) with xasprintf.
159         * readelf.c (handle_gnu_hash): Likewise.
160         * unstrip.c (handle_output_dir_module, main): Likewise.
161
162         * elflint.c (check_sections): Remove cast of xcalloc return value.
163         * findtextrel.c (process_file): Remove casts of malloc and realloc
164         return values.
165         * nm.c (get_local_names, show_symbols_sysv, show_symbols): Remove
166         casts of xmalloc return values.
167         * readelf.c (print_hash_info, handle_sysv_hash, handle_sysv_hash64,
168         handle_gnu_hash): Remove cast of xcalloc return value.
169         (print_debug_units): Remove casts of xmalloc return values.
170         * strip.c (handle_elf): Remove casts of xcalloc and xmalloc return
171         values.
172
173 2021-09-05  Dmitry V. Levin  <ldv@altlinux.org>
174
175         * Makefile.am (AM_LDFLAGS): Add $(STACK_USAGE_NO_ERROR).
176
177 2021-08-20  Saleem Abdulrasool  <abdulras@google.com>
178
179         * elfclassify.c: Remove error.h include.
180
181 2021-03-18  Timm Bäder  <tbaeder@redhat.com>
182
183         * readelf.c (run_advance_pc): New static inline function
184         lifted from...
185         (print_debug_line_section): ... here. Define advance_pc
186         using run_advance_pc.
187
188 2021-07-03  Mark Wielaard  <mark@klomp.org>
189
190         * readelf.c (compare_listptr): Fix dwarf_attr_name argument.
191
192 2021-06-18  Mark Wielaard  <mark@klomp.org>
193
194         * unstrip.c (adjust_relocs): Check gelf_getrel and geld_getrela.
195
196 2021-06-18  Mark Wielaard  <mark@klomp.org>
197
198         * strip.c (remove_debug_relocations): Check gelf_update results.
199         (update_section_size): Likewise.
200
201 2021-06-06  Sergei Trofimovich  <slyfox@gentoo.org>
202
203         * elflint.c (buffer_left): Mark as 'static' to avoid external linkage
204         failure.
205
206 2021-05-12  Dmitry V. Levin  <ldv@altlinux.org>
207
208         * elfcompress.c (process_file): Return 1 instead of -1 in case of an
209         error.
210
211         * elfcompress.c (process_file): Remove redundant assignment in case of
212         "Nothing to do".
213
214         * elfcompress.c (process_file): Set res to 0 in case of "Nothing to do".
215
216 2021-04-19  Martin Liska  <mliska@suse.cz>
217
218         * elfclassify.c (run_classify): Use startswith.
219         * elfcompress.c (process_file): Likewise.
220         * nm.c (show_symbols_sysv): Likewise.
221         * readelf.c (print_debug): Likewise.
222         (handle_notes_data): Likewise.
223         (dump_data_section): Likewise.
224         (print_string_section): Likewise.
225         * strip.c (remove_debug_relocations): Likewise.
226
227 2021-04-03  Mark Wielaard  <mark@klomp.org>
228
229         * nm.c (show_symbols): close dwfl_fd if dwfl_begin fails.
230
231 2021-04-03  Mark Wielaard  <mark@klomp.org>
232
233         * unstrip.c (handle_output_dir_module): Free output_file when done.
234
235 2021-04-03  Mark Wielaard  <mark@klomp.org>
236
237         * ar.c (do_oper_insert): Always close newfd.
238
239 2021-03-03  Mark Wielaard  <mark@klomp.org>
240
241         * readelf.c (handle_symtab): Sanity check verneed vna_next,
242         vn_next and verdef vd_next offsets.
243
244 2021-03-02  Timm Bäder  <tbaeder@redhat.com>
245
246         * elfcompress.c (process_file): Remove cleanup() function and
247         replace it with a cleanup label at the end of the function.
248         Initialize res to -1.
249
250 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
251
252         * elfcompress.c (process_file): Move get_sections function...
253         (get_section): ...to top-level static function taking an
254         sections array and shnum.
255
256 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
257
258         * elfcompress.c (process_file): Move get_section function...
259         (get_section): ...to top-level static function taking an
260         sections array.
261
262 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
263
264         * elfcompress.c (process_file): Move set_section function...
265         (set_section): ...to top-level static function taking a
266         section array.
267
268 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
269
270         * unstrip.c (handle_implicit_modules): Inline the next function
271         in three places. This is simply dwfl_getmodules with match_module
272         callback providing mmi.
273
274 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
275
276         * unstrip.c (handle_explicit_files): Move warn function...
277         (warn): ...here as top-level static function taking stripped,
278         unstripped files and force flag as extra arguments.
279
280 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
281
282         * unstrip.c (copy_elided_sections): Inline find_unalloc_section
283         function into calling location. The sec pointer is set to NULL
284         before the if-else statement and only set when match is found.
285
286 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
287
288         * unstrip.c (find_alloc_sections_prelink): Move check_match to...
289         (check_match): Adjusted to return whether there was no match,
290         which indicates a failure. So callers are adjusted to or the
291         result into a local fail boolean.
292
293 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
294
295         * unstrip.c (adjust_relocs): Move adjust_reloc function to...
296         (adjust_reloc): ... here as static top-level function taking
297         a map array and size as extra arguments.
298
299 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
300
301         * elflint.c (check_attributes): Rename and move left function...
302         (buffer_left): ...as static toplevel function taking both an
303         Elf_Data pointer argument and the unsigned char pointer p.
304
305 2021-02-17  Timm Bäder  <tbaeder@redhat.com>
306
307         * elflint.c (check_attributes): Rename and move pos function...
308         (buffer_pos): ...as static toplevel function taking an extra
309         Elf_Data pointer argument.
310
311 2021-02-12  Mark Wielaard  <mark@klomp.org>
312
313         * readelf.c (print_debug_units): Type DIE offset is from start CU.
314
315 2021-02-12  Mark Wielaard  <mark@klomp.org>
316
317         * readelf.c (attr_callback): Don't handle blocks as expression
318         blocks for DWARF version 4 or higher.
319
320 2021-02-03 Timm Bäder <tbaeder@redhat.com>
321
322         * ar.c (do_oper_extract): Extract should_truncate_fname function
323         to...
324         (should_truncate_fname): ...here. New file scope function taking
325         size_t pointer to be read and/or set.
326
327 2021-02-02 Timm Bäder <tbaeder@redhat.com>
328
329         * readelf.c (print_debug_line_section): Remove unnecessary
330         show_op_index variable, replace with (op_index > 0).
331
332 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
333
334         * readelf.c (print_cfa_program): Lift regname function to...
335         (regname): ...here. New file scope function add ebl and regnamebuf
336         as arguments.
337
338 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
339
340         * readelf.c (print_attributes): Lift left function to...
341         (left): ...here. New file scope function taking Elf_Data and char
342         pointers.
343
344 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
345
346         * readelf.c (handle_core_registers): Lift same_set function to...
347         (same_set): ...here. New file scope function adding regs and
348         maxnreg arguments.
349
350 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
351
352         * readelf.c (parse_opt): Lift add_dump_section function to...
353         (add_dump_section): ...here. New top level function. Added key
354         argument.
355
356 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
357
358         * arlib-argp.c (help_filter): Lift text_for_default function to...
359         (text_for_default): ... here. New file scope function taking text
360         as argument.
361
362 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
363
364         * addr2line.c (handle_address): Move show_note and show_int up to
365         file scope.
366         (show_note: New static inline function.
367         (show_int): Likewise.
368
369 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
370
371         * strip.c (handle_elf): Remove no_symtab_updates function and
372         calls inside the switch statement. Add checks and (possibly)
373         continue, before switch statement is called.
374
375 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
376
377         * strip.c (handle_elf): Move inlined update_section_size function
378         to...
379         (update_section_size): ...here. New static function that takes as
380         extra arguments the Elf_Scn, debug_elf, section cnt and fname.
381
382 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
383
384         * strip.c (remove_debug_relocations): Rewrite inlined relocate
385         function to file static. Do R_*_NONE, reloc_simple_type and
386         ebl_debug_scn_p checks before calling new relocate function.
387         (relocate): New file static function from
388         remove_debug_relocate. Remove R_*_NONE, reloc_simple_type and
389         ebl_debugscn_p checks.
390
391 2021-01-08  Timm Bäder  <tbaeder@redhat.com>
392
393         * strip.c (handle_elf): Expand inlined function check_preserved.
394
395 2021-01-12  Mark Wielaard  <mark@klomp.org>
396
397         * elflint.c (EXTRA_SHFLAGS): New define.
398         (check_sections): Use EXTRA_SHFLAGS. Add SHF_GNU_RETAIN to
399         ALL_SH_FLAGS.
400
401 2020-12-31  Sergei Trofimovich  <slyfox@gentoo.org>
402
403         * elflint.c (section_flags_string): Add NEWFLAG for GNU_RETAIN,
404         ORDERED and EXCLUDE.
405
406 2020-12-31  Sergei Trofimovich  <slyfox@gentoo.org>
407
408         * elflint.c (section_flags_string): Update cp pointer after
409         snprintf for unknown flags.
410
411 2020-12-16  Érico Nogueira  <ericonr@disroot.org>
412
413         * readelf.c (qsort_r): Use qsort for improved portability.
414
415 2020-12-20  Dmitry V. Levin  <ldv@altlinux.org>
416
417         * .gitignore: New file.
418
419 2020-12-12  Mark Wielaard  <mark@klomp.org>
420
421         * elflint.c (check_sections): Handle SHF_GNU_RETAIN.
422         * readelf.c (print_shdr): Likewise.
423
424 2020-12-16  Dmitry V. Levin  <ldv@altlinux.org>
425
426         * *.c: Replace gettext(...) with _(...).
427
428         * unstrip.c (_): Remove.
429
430 2020-12-15  Mark Wielaard  <mark@klomp.org>
431
432         * elflint.c (check_symtab): Always print symbol name (if known)
433         in error messages.
434
435 2020-12-12  Dmitry V. Levin  <ldv@altlinux.org>
436
437         * ar.c (write_member, do_oper_insert): Fix spelling typo in comment.
438         * elfclassify.c (issue, elf_issue, is_unstripped): Likewise.
439         * elfcompress.c (process_file): Likewise.
440         * elflint.c (be_quiet, check_gnu_hash): Likewise.
441         * readelf.c (print_phdr, handle_gnu_hash,
442         dwarf_locexpr_opcode_string): Likewise.
443         * size.c (totals_class): Likewise.
444         * strings.c (read_elf): Likewise.
445         * strip.c (handle_elf): Likewise.
446
447         * readelf.c (print_debug_addr_section): Fix spelling typo in error
448         diagnostics.
449         * strip.c (options): Fix spelling typos in argp help text.
450         * strings.c (options): Likewise.
451         * stack.c (options): Likewise.
452
453 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
454
455         * unstrip.c (make_directories): Use ACCESSPERMS for mkdir.
456         (handle_file): Use DEFFILEMODE for open with O_CREAT for ET_REL
457         files, ACCESSPERMS otherwise.
458
459 2020-11-01  Érico N. Rolim  <erico.erc@gmail.com>
460
461         * Makefile.am (nm_LDADD): Add obstack_LIBS.
462         (ranlib_LDADD): Likewise.
463         (ar_LDADD): Likewise.
464
465 2020-10-27  Érico N. Rolim  <erico.erc@gmail.com>
466
467         * unstrip.c (make_directories): Use strndup, not strndupa.
468
469 2020-09-28  Mark Wielaard  <mark@klomp.org>
470
471         * readelf.c (next_listptr_offset): Take idx as pointer, to be updated
472         and use new Dwarf_Off as offset to match.
473         (listptr_attr): New function.
474         (print_debug_loclists_section): Check for DW_AT_GNU_locviews to show
475         view pairs.
476         (print_debug_loc_section): Adjust next_listptr_offset call.
477
478 2020-09-03  Mark Wielaard  <mark@klomp.org>
479
480         * readelf.c (print_cfa_program): Take ehdr as argument. Use it to
481         recognize DW_CFA_AARCH64_negate_ra_state.
482         (print_debug_frame_section): Pass ehdr to print_cfa_program.
483         (print_debug): Don't warn if we dump frames, but cannot get dbg.
484
485 2020-09-01  Mark Wielaard  <mark@klomp.org>
486
487         * readelf.c (print_debug_ranges_section): Base address entry can
488         be first.
489         (print_debug_loc_section): Likewise.
490
491 2020-09-04  Mark Wielaard  <mark@klomp.org>
492
493         * elflint.c (special_sections): Add .debug_line_str.
494
495 2020-08-26  Mark Wielaard  <mark@klomp.org>
496
497         * readelf.c (print_debug_line_section): It is not an error if there
498         are no line number statements at the end of a debug line section.
499
500 2020-07-19  Mark Wielaard  <mark@klomp.org>
501
502         * elfclassify.c (process_current_path): Handle fwrite failing.
503
504 2020-07-05  Mark Wielaard  <mark@klomp.org>
505
506         * stack.c (module_callback): Don't assert if dwfl_module_info fails.
507         * unstrip.c (adjust_relocs): Produce a proper error when HAS
508         section has inconsistent size or entsize.
509         (match_module): Don't assert if dwfl_module_info fails.
510
511 2020-06-16  Mark Wielaard  <mark@klomp.org>
512
513         * ar.c (do_oper_extract): Split large if statement. Call fchown
514         before fchmod and explicitly ignore the return value.
515         (do_oper_delete): Likewise.
516         (do_oper_insert): Likewise.
517         * ranlib.c (handle_file): Likewise.
518
519 2020-06-16  Mark Wielaard  <mark@klomp.org>
520
521         * elflint.c (check_elf_header): Explicitly check and ignore
522         any error from elf_compress.
523
524 2020-06-07  Mark Wielaard  <mark@klomp.org>
525
526         * nm.c (sort_by_name_strtab): Replace by...
527         (sort_by_name_elf): New static Elf pointer and ...
528         (sort_by_name_ndx): New static size_t index.
529         (sort_by_name): Use elf_strptr to get symbol string.
530         (show_symbols): Set sort_by_name_elf and sort_by_name_ndx.
531
532 2020-06-06  Mark Wielaard  <mark@klomp.org>
533
534         * nm.c (show_symbols_sysv): Skip no name and STT_FILE symbols.
535         When not printing address and size pad strings. Strip "GNU_"
536         prefix from binding name.
537         (class_type_char): Use 'V' for weak symbols, 'C' for common
538         symbols and 'T' for weak functions.
539         (show_symbols_posix): Skip STT_FILE symbols. Don't print value and
540         size when undefined.
541
542 2020-06-04  Mark Wielaard  <mark@klomp.org>
543
544         * elflint.c (check_program_header): Remove PT_GNU_PROPERTY define.
545
546 2020-05-14  Mark Wielaard  <mark@klomp.org>
547
548         * size.c (show_bsd): Set printf format based on radix.
549
550 2020-05-09  Mark Wielaard  <mark@klomp.org>
551
552         * elflint.c (process_elf_file): Error out if ebl_openbackend fails.
553         * objdump.c (handle_elf): Likewise.
554         * nm.c (handle_elf): Likewise. Move full name string construction
555         forward, so it can be used in the error message.
556
557 2020-04-17  Mark Wielaard  <mark@klomp.org>
558
559         * readelf.c (print_debug): Check .gnu.debuglto_ prefix.
560
561 2020-04-16  Mark Wielaard  <mark@klomp.org>
562
563         * elflint.c (check_sections): Mask out SHF_EXCLUDE from processor
564         specific section flags when --gnu is given.
565
566 2020-02-08  Mark Wielaard  <mark@klomp.org>
567
568         * elflint.c (check_program_header): Handle PT_GNU_PROPERTY.
569
570 2020-02-07  Mark Wielaard  <mark@klomp.org>
571
572         * elflint.c (check_symtab): Check st_info isn't too big.
573
574 2020-01-16  Mark Wielaard  <mark@klomp.org>
575
576         * nm.c (show_symbols_sysv): Iterate over all symbols starting
577         at index zero.
578
579 2019-11-26  Mark Wielaard  <mark@klomp.org>
580
581         * Makefile.am (BUILD_STATIC): Add libraries needed for libdw.
582
583 2019-10-26  Mark Wielaard  <mark@klomp.org>
584
585         * unstrip.c (collect_symbols): Check symbol strings are
586         terminated.
587
588 2019-10-18  Mark Wielaard  <mark@klomp.org>
589
590         * unstrip.c (adjust_relocs): Set versym data d_size to the actual
591         size allocated.
592
593 2019-10-20  Mark Wielaard  <mark@klomp.org>
594
595         * unstrip.c (copy_elided_sections): Set and check max_off.
596
597 2019-10-21  Mark Wielaard  <mark@klomp.org>
598
599         * unstrip.c (adjust_relocs): Add map_size argument and check ndx
600         against it.
601         (adjust_all_relocs): Add map_size argument and pass it to
602         adjust_relocs.
603         (add_new_section_symbols): Call adjust_all_relocs with symndx_map
604         size.
605         (collect)symbols): Check sym and string data can be found.
606         (compare_symbols_output): Call error when (different) symbols are
607         equal.
608         (new_shstrtab): Make unstripped_strent array one larger. Check
609         stripped_shnum isn't zero.
610         (copy_elided_sections): Add ndx_sec_num as size of ndx_section
611         array. Check sh_link and sh_info are not larger than ndx_sec_num.
612         Allocate symbols and symndx_map arrays on heap, not stack. Pass
613         map sizes to adjust_all_relocs.
614
615 2019-09-28  Dmitry V. Levin  <ldv@altlinux.org>
616
617         * elflint.c (main): When an input file cannot be opened,
618         include its name into the error diagnostics.
619         * readelf.c (main): Likewise.
620
621 2019-09-02  Mark Wielaard  <mark@klomp.org>
622
623         * readelf.c (PRINT_DYNSYM_TABLE): New argp key value.
624         (argp_opt): Add syn-sym.
625         (print_dynsym_table): New static bool.
626         (parse_opt): Handle PRINT_DYNSYM_TABLE.
627         (process_elf_file): Check print_dynsym_table.
628
629 2019-08-27  Mark Wielaard  <mark@klomp.org>
630
631         * readelf.c (for_each_section_argument): Call (*dump) also for
632         section numbers.
633
634 2019-08-26  Mark Wielaard  <mark@klomp.org>
635
636         * nm.c (show_symbols): Remember nentries_orig and check before
637         freeing sym_mem.
638
639 2019-07-05  Omar Sandoval  <osandov@fb.com>
640
641         * Makefile.am: Remove -ldl.
642         (elflint_LDADD): Add $(libdw).
643         (elfcmp_LDADD): Add $(libdw).
644         (objdump_LDADD): Add $(libdw).
645
646 2019-08-26  Mark Wielaard  <mark@klomp.org>
647
648         * readelf (options): Add OPTION_ARG_OPTIONAL "SECTION" for notes.
649         (notes_section): New global variable.
650         (parse_opt): Set notes_section.
651         (handle_notes): Check if notes_section is set.
652
653 2019-07-26  Florian Weimer  <fweimer@redhat.com>
654             Mark Wielaard  <mark@klomp.org>
655
656         * Makefile.am (bin_PROGRAMS): Add elfclassify.
657         (elfclassify_LDADD): New variable.
658         * elfclassify.c: New tool.
659
660 2019-07-13  Mao Han  <han_mao@c-sky.com>
661
662         * elflint.c: Add C-SKY.
663
664 2019-06-28  Mark Wielaard  <mark@klomp.org>
665
666         * readelf.c (print_ehdr): Use dwelf_elf_e_machine_string instead of
667         ebl->name. If unknown print hex value.
668
669 2019-06-25  Mark Wielaard  <mark@klomp.org>
670
671         * stack.c (parse_opt): Fix dwfl_core_file_attach error message.
672
673 2019-06-18  Mark Wielaard  <mark@klomp.org>
674
675         * strip.c (handle_elf): Use elf_begin ELF_C_WRITE, instead of
676         ELF_C_WRITE_MMAP.
677
678 2019-05-10  Mark Wielaard  <mark@klomp.org>
679
680         * readelf.c (struct attrcb_args): Rename die to dies.
681         (attr_callback): Get current current die using dies[level].
682         Handle DW_AT_discr_list as block, not as constant.
683         (print_debug_units): pass dies, not dies[level] as args.
684
685 2019-05-09  Mark Wielaard  <mark@klomp.org>
686
687         * readelf.c (cleanup_list): New function.
688         (main): Call cleanup_list for dump_data_sections and string_sections.
689
690 2019-04-28  Mark Wielaard  <mark@klomp.org>
691
692         * unstrip.c (add_new_section_symbols): Call ELF_CHECK after
693         gelf_getsymshndx.
694         (new_shstrtab): Call ELF_CHECK after gelf_getshdr.
695
696 2019-04-28  Mark Wielaard  <mark@klomp.org>
697
698         * size.c (show_sysv): Call INTERNAL_ERROR if gelf_getshdr
699         returns NULL.
700         (show_sysv_one_line): Call error with EXIT_FAILURE if
701         gelf_getshdr returns NULL.
702
703 2019-04-28  Mark Wielaard  <mark@klomp.org>
704
705         * nm.c (show_symbols_sysv): Check gelf_getshdr doesn't return
706         NULL. Simplify naming of invalid sections, don't use alloca.
707
708 2019-04-28  Mark Wielaard  <mark@klomp.org>
709
710         * elfcmp.c (main): Check shdr1 and shdr2 are not NULL.
711
712 2019-04-03  Mark Wielaard  <mark@klomp.org>
713
714         * readelf.c (attr_callback): Print DW_AT_data_member_location as
715         decimal offset, not hex number.
716
717 2019-03-29  Mark Wielaard  <mark@klomp.org>
718
719         * readelf.c (print_debug_macinfo_section): Check cus[0] is not the
720         sentinel.
721
722 2019-03-27  Mark Wielaard  <mark@klomp.org>
723
724         * strip.c (handle_elf): Assert that symbol section number exists.
725
726 2019-01-24  Mark Wielaard  <mark@klomp.org>
727
728         * strip.c (handle_elf): Fix check test for SHN_XINDEX symbol.
729
730 2019-01-22  Mark Wielaard  <mark@klomp.org>
731
732         * readelf.c (print_debug_line_section): Check we are not at end of
733         line data when reading parameters for unknown opcodes.
734
735 2019-01-20  Mark Wielaard  <mark@klomp.org>
736
737         * readelf.c (print_debug_line_section): Check terminating NUL byte
738         for dir and file tables.
739
740 2019-01-16  Mark Wielaard  <mark@klomp.org>
741
742         * readelf (handle_core_note): Pass desc to ebl_core_note.
743
744 2018-11-10  Mark Wielaard  <mark@klomp.org>
745
746         * elflint.c (check_program_header): Allow PT_GNU_EH_FRAME segment
747         to be matched against SHT_X86_64_UNWIND section.
748
749 2018-11-09  Mark Wielaard  <mark@klomp.org>
750
751         * strip.c (remove_debug_relocations): Check if section is gnu
752         compressed and decompress and recompress it.
753
754 2018-11-12  Mark Wielaard  <mark@klomp.org>
755
756         * elflint.c (check_note_data): Recognize NT_GNU_BUILD_ATTRIBUTE_OPEN
757         and NT_GNU_BUILD_ATTRIBUTE_OPEN.
758         * readelf.c (handle_notes_data): Handle
759         ELF_NOTE_GNU_BUILD_ATTRIBUTE_PREFIX. Pass nhdr.n_namesz to
760         ebl_object_note.
761
762 2018-11-11  Mark Wielaard  <mark@klomp.org>
763
764         * readelf.c (handle_notes_data): Pass n_descsz to
765         ebl_object_note_type_name.
766         * elflint.c (check_note_data): Recognize NT_VERSION, add owner
767         name to unknown note error.
768
769 2018-10-20  Mark Wielaard  <mark@klomp.org>
770
771         * readelf.c (process_elf_file): Use dwelf_elf_begin to open pure_elf.
772
773 2018-10-26  Mark Wielaard  <mark@klomp.org>
774
775         * strip.c (OPT_RELOC_DEBUG_ONLY): New define.
776         (options): Add reloc-debug-sections-only.
777         (reloc_debug_only): New static bool.
778         (main): Check reloc_debug_only is the only strip option used.
779         (parse_opt): Handle OPT_RELOC_DEBUG_ONLY.
780         (handle_debug_relocs): New function.
781         (handle_elf): Add local variables lastsec_offset and lastsec_size.
782         Handle reloc_debug_only.
783
784 2018-10-24  Mark Wielaard  <mark@klomp.org>
785
786         * strip.c (handle_elf): Extract code to update shdrstrndx into...
787         (update_shdrstrndx): ... this new function.
788
789 2018-10-24  Mark Wielaard  <mark@klomp.org>
790
791         * strip.c (handle_elf): Extract code into separate functions...
792         (secndx_name): ... new function.
793         (get_xndxdata): Likewise.
794         (remove_debug_relocations): Likewise.
795
796 2018-10-24  Mark Wielaard  <mark@klomp.org>
797
798         * strip.c (handle_elf): Always copy over phdrs if there are any
799         and check phnum instead of e_type to determine whether to move
800         allocated sections.
801
802 2018-11-02  Mark Wielaard  <mark@klomp.org>
803
804         * unstrip.c (copy_elf): Add ELF_CHECK to make sure gelf_getehdr ()
805         doesn't return NULL.
806
807 2018-10-18  Mark Wielaard  <mark@klomp.org>
808
809         * elflint.c (check_note_data): Recognize NT_GNU_PROPERTY_TYPE_0.
810         (check_note): Use p_align to pass either ELF_T_NHDR or ELF_T_NHDR8 to
811         elf_getdata_rawchunk.
812         * readelf (handle_notes): Likewise.
813
814 2018-10-24  Mark Wielaard  <mark@klomp.org>
815
816         * addr2line.c (print_addrsym): Use elf_getshdrstrndx instead of
817         Ehdr field.
818
819 2018-10-24  Mark Wielaard  <mark@klomp.org>
820
821         * readelf.c (section_name): Remove ehdr argument, lookup shstrndx.
822         (print_debug_abbrev_section): Don't pass ehdr.
823         (print_debug_addr_section): Likewise.
824         (print_decoded_aranges_section): Likewise.
825         (print_debug_aranges_section): Likewise.
826         (print_debug_rnglists_section): Likewise.
827         (print_debug_ranges_section): Likewise.
828         (print_debug_units): Likewise.
829         (print_decoded_line_section): Likewise.
830         (print_debug_line_section): Likewise.
831         (print_debug_loclists_section): Likewise.
832         (print_debug_loc_section): Likewise.
833         (print_debug_macinfo_section): Likewise.
834         (print_debug_macro_section): Likewise.
835         (print_debug_pubnames_section): Likewise.
836         (print_debug_str_section): Liekwise.
837         (print_debug_str_offsets_section): Likewise.
838         (print_gdb_index_section): Likewise.
839
840 2018-10-16  Mark Wielaard  <mark@klomp.org>
841
842         * readelf.c (print_debug_frame_section): Make sure readp is never
843         greater than cieend.
844
845 2018-10-19  Mark Wielaard  <mark@klomp.org>
846
847         * dwfl_module_getdwarf.c (adjust_relocs): Check sh_entsize is not
848         zero.
849         (add_new_section_symbols): Likewise.
850         (copy_elided_sections): Likewise.
851
852 2018-10-18  Mark Wielaard  <mark@klomp.org>
853
854         * size.c (handle_ar): Only close elf if prefix was NULL.
855
856 2018-10-18  Mark Wielaard  <mark@klomp.org>
857
858         * arlib.c (arlib_add_symbols): Check that sh_entsize is not zero.
859
860 2018-10-14  Mark Wielaard  <mark@klomp.org>
861
862         * ar.c (do_oper_extract): Assume epoch if ar_date is bogus.
863
864 2018-10-14  Mark Wielaard  <mark@klomp.org>
865
866         * findtextrel.c (process_file): Check that sh_entsize is not zero.
867
868 2018-10-13  Mark Wielaard  <mark@klomp.org>
869
870         * readelf.c (print_debug_macro_section): Use elf_getdata. Print
871         decoded flag string.
872
873 2018-10-19  Mark Wielaard  <mark@klomp.org>
874
875         * unstrip.c (copy_elided_sections): Renumber group section indexes.
876
877 2018-10-12  Mark Wielaard  <mark@klomp.org>
878
879         * strip.c (handle_elf): Don't remove SHF_GROUP flag from sections.
880         Skip group section flag when renumbering section indexes.
881         * unstrip.c (struct section): Add sig field.
882         (compare_unalloc_sections): Take and use sig1 and sig2 as arguments.
883         (compare_sections): Pass signatures to compare_unalloc_sections.
884         (get_group_sig): New function.
885         (find_alloc_sections_prelink): Set signature.
886         (copy_elided_sections): Likewise and pass them on.
887         (find_unalloc_section): Take and pass signatures.
888
889 2018-10-02  Andreas Schwab  <schwab@suse.de>
890
891         * strip.c (handle_elf): Handle ADD/SUB relocation.
892
893 2018-09-13  Mark Wielaard  <mark@klomp.org>
894
895         * readelf.c (print_shdr): Get number of section with elf_getshdrnum.
896         (print_phdr): Likewise.
897
898 2018-09-13  Mark Wielaard  <mark@klomp.org>
899
900         * strip.c (handle_elf): Check against shstrndx, not e_shstrndx.
901         Explicitly set shdrstrndx for debug file.
902         * unstrip.c (copy_elf): Explicitly copy shstrndx.
903         (find_alloc_sections_prelink): Document shnum usage.
904
905 2018-09-13  Mark Wielaard  <mark@klomp.org>
906
907         * elflint.c (check_elf_header): Use shnum instead of e_shnum for all
908         checks.
909         (check_symtab): Use shstrndx instead of e_shstrndx to get section
910         names.
911
912 2018-09-13  Mark Wielaard  <mark@klomp.org>
913
914         * elfcmp.c (main): Get, check and shdrstrndx for section names.
915
916 2018-09-12  Mark Wielaard  <mark@klomp.org>
917
918         * elfcmp.c (main): Call ebl_section_strip_p without ehdr.
919         * strip.c (handle_elf): Likewise.
920
921 2018-09-12  Mark Wielaard  <mark@klomp.org>
922
923         * elflint.c (check_symtab): Call ebl_check_special_symbol without
924         ehdr.
925
926 2018-07-30  Mark Wielaard  <mark@klomp.org>
927
928         * strip.c (handle_elf): Track allocated/unallocated sections seen. Set
929         section offset of unallocated sections after handling all allocated
930         sections.
931
932 2018-08-18  Mark Wielaard  <mark@klomp.org>
933
934         * readelf.c (print_debug_aranges_section): Make sure there is enough
935         data to read the header segment size.
936
937 2018-08-18  Mark Wielaard  <mark@klomp.org>
938
939         * elflint.c (check_sysv_hash): Calculate needed size using unsigned
940         long long int to prevent overflow.
941         (check_sysv_hash64): Calculate maxwords used separately before
942         comparison to prevent overflow.
943
944 2018-07-24  Mark Wielaard  <mark@klomp.org>
945
946         * unstrip.c (compare_unalloc_sections): Also compare sh_size.
947
948 2018-07-21  Mark Wielaard  <mark@klomp.org>
949
950         * unstrip.c (adjust_all_relocs): Skip SHT_GROUP sections.
951
952 2018-07-21  Mark Wielaard  <mark@klomp.org>
953
954         * elfcompress.c (get_sections): New function.
955         (process_file): Check whether section needs to change. Don't rewrite
956         file if no section data needs changing.
957         (main): Update 'force' help text.
958
959 2018-07-21  Mark Wielaard  <mark@klomp.org>
960
961         * elfcompress.c (process_file): Swap fchmod and fchown calls.
962
963 2018-07-04  Mark Wielaard  <mark@klomp.org>
964
965         * readelf.c (print_debug_addr_section): Rename index var to uidx.
966         (attr_callback): Rename index var to word.
967         (print_debug_str_offsets_section): Rename index var to uidx.
968
969 2018-07-04  Ross Burton <ross.burton@intel.com>
970
971         * addr2line.c: Remove error.h include.
972         * ar.c: Likewise.
973         * arlib.c: Likewise and add system.h include.
974         * arlib2.c: Likewise.
975         * elfcmp.c: Likewise.
976         * elfcompress.c: Likewise.
977         * elflint.c: Likewise.
978         * findtextrel.c: Likewise.
979         * nm.c: Likewise.
980         * objdump.c: Likewise.
981         * ranlib.c: Likewise.
982         * readelf.c: Likewise.
983         * stack.c: Likewise.
984         * strings.c: Likewise.
985         * strip.c: Likewise.
986         * unstrip.c: Likewise.
987
988 2018-06-25  Mark Wielaard  <mark@klomp.org>
989
990         * readelf.c (print_decoded_line_section): Use dwarf_next_lines
991         instead of dwarf_nextcu.
992         (print_debug_line_section): Don't explicitly lookup CU.
993
994 2018-06-15  Mark Wielaard  <mark@klomp.org>
995
996         * readelf.c (attr_callback): Only print block as expressions if it
997         isn't DW_FORM_data16.
998
999 2018-06-12  Mark Wielaard  <mark@klomp.org>
1000
1001         * readelf.c (print_form_data): Check we have 4, not 2, bytes
1002         available for DW_FORM_block4.
1003
1004 2018-06-12  Mark Wielaard  <mark@klomp.org>
1005
1006         * readelf.c (print_form_data): Don't increase strreadp after use.
1007         Do increase readp for DW_FORM_strx[1234].
1008
1009 2018-06-16  Mark Wielaard  <mark@klomp.org>
1010
1011         * readelf.c (print_debug_loc_section): Make sure next_off doesn't
1012         overflow d_buf.
1013
1014 2018-06-13  Mark Wielaard  <mark@klomp.org>
1015
1016         * readelf.c (die_type_sign_bytes): New function.
1017         (attr_callback): Recognized DW_FORM_implicit_cost as signed. Use
1018         die_type_sign_bytes to lookup the signedness and size of const
1019         values.
1020
1021 2018-06-11  Mark Wielaard  <mark@klomp.org>
1022
1023         * readelf.c (print_form_data): Don't reuse readp and readendp when
1024         reading str_offsets section.
1025
1026 2018-06-10  Mark Wielaard  <mark@klomp.org>
1027
1028         * readelf.c (print_form_data): Don't cast value to ptrdiff_t, cast
1029         ptrdiff_t to size_t.
1030
1031 2018-06-08  Mark Wielaard  <mark@klomp.org>
1032
1033         * readelf.c (print_debug_rnglists_section): Calculate max_entries
1034         instead of needed bytes to prevent overflowing. Always print
1035         max_entries (but not more).
1036         (print_debug_loclists_section): Likewise.
1037
1038 2018-06-08  Mark Wielaard  <mark@klomp.org>
1039
1040         * readelf.c (print_debug_line_section): Stop printing directories
1041         and files when we are at the end of the unit data.
1042
1043 2018-06-07  Mark Wielaard  <mark@klomp.org>
1044
1045         * readelf.c (format_result): Removed.
1046         (format_result_size): Removed.
1047         (format_dwarf_addr): Renamed to...
1048         (print_dwarf_addr): ...this. Simply call printf, don't setup buffer,
1049         don't call sprintf.
1050         (print_ops): Use print_dwarf_addr instead of format_dwarf_addr.
1051         (print_debug_addr_section): Likewise.
1052         (print_debug_aranges_section): Likewise.
1053         (print_debug_rnglists_section): Likewise.
1054         (print_debug_ranges_section): Likewise.
1055         (print_debug_frame_section): Likewise.
1056         (attr_callback): Likewise.
1057         (print_decoded_line_section): Likewise.
1058         (print_debug_line_section): Likewise.
1059         (print_debug_loclists_section): Likewise.
1060         (print_debug_loc_section): Likewise.
1061         (print_gdb_index_section): Likewsie.
1062
1063 2018-06-05  Mark Wielaard  <mark@klomp.org>
1064
1065         * readelf.c (print_debug_addr_section): Set unit_length always to
1066         (next_unitp - readp) in case we don't have a real header.
1067
1068 2018-06-05  Mark Wielaard  <mark@klomp.org>
1069
1070         * readelf.c (print_debug_loc_section): Set begin to idx when failing
1071         to read the start address if DW_LLE_GNU_start_end_entry.
1072
1073 2018-06-05  Mark Wielaard  <mark@klomp.org>
1074
1075         * readelf.c (handle_sysv_hash): Don't leak lengths array when
1076         detecting an invalid chain.
1077         (handle_sysv_hash64): Likewise.
1078
1079 2018-06-05  Mark Wielaard  <mark@klomp.org>
1080
1081         * readelf.c (print_debug_macro_section): Extend vendor array by one
1082         to include max DW_MACRO_hi_user opcode.
1083
1084 2018-06-07  Mark Wielaard  <mark@klomp.org>
1085
1086         * readelf.c (main): Lookup "no" for no_str.
1087         (print_debug_abbrev_section): Use yes_str and no_str.
1088         (print_form_data): Likewise.
1089
1090 2018-06-04  Mark Wielaard  <mark@klomp.org>
1091
1092         * readelf (format_result): New static char pointer.
1093         (format_result_size): New static size_t.
1094         (format_dwarf_addr): Calculate max string size, reuse format_result
1095         if possible, otherwise realloc. Use sprintf on result, not asprintf.
1096         (print_ops): Don't free format_dwarf_addr, make sure result is
1097         printed before calling format_dwarf_addr again.
1098         (print_debug_addr_section): Likewise.
1099         (print_debug_aranges_section): Likewise.
1100         (print_debug_rnglists_section): Likewise.
1101         (print_debug_ranges_section): Likewise.
1102         (print_debug_frame_section): Likewise.
1103         (attr_callback): Likewise.
1104         (print_decoded_line_section): Likewise.
1105         (print_debug_line_section): Likewise.
1106         (print_debug_loclists_section): Likewise.
1107         (print_debug_loc_section): Likewise.
1108         (print_gdb_index_section): Likewsie.
1109
1110 2018-06-04  Mark Wielaard  <mark@klomp.org>
1111
1112         * readelf.c (yes_str): New static char pointer.
1113         (no_str): Likewise.
1114         (main): Set yes_str and no_str using gettext.
1115         (attr_callback): Use yes_str and no_str instead of calling gettext.
1116
1117 2018-06-04  Mark Wielaard  <mark@klomp.org>
1118
1119         * readelf.c (main): Call __fsetlocking (stdout, FSETLOCKING_BYCALLER).
1120
1121 2018-05-31  Mark Wielaard  <mark@klomp.org>
1122
1123         * readelf.c (print_debug_units): Print the dwo name and id when
1124         unable to find a .dwo file.
1125
1126 2018-05-31  Mark Wielaard  <mark@klomp.org>
1127
1128         * readelf.c (enum section_e): Make section_types not an alias of
1129         section_info.
1130         (section_all): Add section_types.
1131         (parse_opt): Add both section_info and section_types for "info"
1132         and "info+".
1133         (print_debug_units): Don't be silent for debug_types.
1134
1135 2018-05-31  Mark Wielaard  <mark@klomp.org>
1136
1137         * readelf.c (attr_callback): Only register section_loc when not
1138         looking at a split dwarf from a skeleton.
1139
1140 2018-05-30  Mark Wielaard  <mark@klomp.org>
1141
1142         * readelf.c (print_debug_loc_section): Use correct listptr for
1143         locview attribute.
1144
1145 2018-05-31  Mark Wielaard  <mark@klomp.org>
1146
1147         * readelf.c (print_debug_units): Check offset against -1 not ~0ul.
1148
1149 2018-05-29  Mark Wielaard  <mark@klomp.org>
1150
1151         * readelf.c (print_debug_loc_section): Handle GNU DebugFission list
1152         entries.
1153
1154 2018-05-29  Mark Wielaard  <mark@klomp.org>
1155
1156         * readelf.c (print_debug): Record and reset section_info status in
1157         implicit_debug_sections and print_debug_sections.
1158
1159 2018-05-28  Mark Wielaard  <mark@klomp.org>
1160
1161         * readelf.c (print_debug_units): Turn "Could not find split compile
1162         unit" into an Warning instead of an error.
1163
1164 2018-04-29  Mark Wielaard  <mark@klomp.org>
1165
1166         * readelf.c (parse_opt): Request implicit section_info for "str".
1167         (known_stroffbases): New static variable.
1168         (attr_callbackattr_callback): Handle DW_AT_str_offets_base.
1169         (print_debug_str_offsets_section): New function.
1170         (print_debug): Handle .debug_str_offsets as section_str. Reset
1171         known_stroffbases.
1172
1173 2018-04-27  Mark Wielaard  <mark@klomp.org>
1174
1175         * readelf.c (options): Add addr.
1176         (enum section_e): Add section_addr.
1177         (section_all): Add section_addr.
1178         (parse_opt): Parse "addr".
1179         (known_addrbases): New static variable.
1180         (get_listptr): New function.
1181         (print_debug_addr_section): Likewise.
1182         (attr_callback): Handle DW_AT_addr_base and DW_AT_GNU_addr_base.
1183         (print_debug): Add NEW_SECTION (addr). Reset known_addrbases.
1184
1185 2018-04-07  Mark Wielaard  <mark@klomp.org>
1186
1187         * readelf.c (attr_callback): Handle DW_FORM_loclistx and
1188         DW_AT_segment.
1189
1190 2018-04-12  Mark Wielaard  <mark@klomp.org>
1191
1192         * readelf.c (dwarf_loc_list_encoding_string): New functions.
1193         (dwarf_loc_list_encoding_name): Likewise.
1194         (known_loclistptr): Renamed and split in two...
1195         (known_locsptr): this and ...
1196         (known_loclistsptr): this.
1197         (listptr_base): Split out...
1198         (cudie_base): ...this.
1199         (is_split_dwarf): New function.
1200         (attr_callback): Handle DW_AT_loclists_base and notice sec_offset
1201         in correct list.
1202         (print_debug_rnglists_section): Use spit_dwarf_cu_base.
1203         (print_debug_loclists_section): New function.
1204         (print_debug_loc_section): Use known_locsptr instead of
1205         known_loclistptr.
1206         (print_debug): Recognize .debug_loclists. Reset known_locsptr and
1207         known_loclistsptr.
1208
1209 2018-05-25  Mark Wielaard  <mark@klomp.org>
1210
1211         * readelf.c (DWARF_SKELETON): New constant.
1212         (do_not_close_dwfl): New bool.
1213         (options): Add dwarf-skeleton.
1214         (dwarf_skeleton): New static variable.
1215         (parse_opt): Handle DWARF_SKELETON, set dwarf_skeleton.
1216         (create_dwfl): New function, with code extracted from...
1217         (process_file): ...here. Check do_not_close_dwfl.
1218         (is_split_darf): New function.
1219         (getone_dwflmod): Likewise.
1220         (print_debug): Use new functions to find skeleton DWARF file to use
1221         when inspecting .dwo split DWARF file.
1222
1223 2018-04-11  Mark Wielaard  <mark@klomp.org>
1224
1225         * readelf.c (dwarf_range_list_encoding_string): New function.
1226         (dwarf_range_list_encoding_name): Likewise.
1227         (known_rnglistptr): New static variable.
1228         (listptr_cu): New function.
1229         (print_debug_rnglists_section): Likewise.
1230         (attr_callback): Call notice_listptr for DW_AT_ranges. Handle
1231         DW_AT_rnglists_base. Handle DW_FORM_rnglistx. DW_AT_start_scope
1232         can also have a rnglist.
1233         (print_debug_units): Do (silently) scan split DWARF also for
1234         debug_ranges before DWARF5 to catch all rangelistptrs.
1235         (print_debug): Recognize .debug_rnglists. Reset known_rnglistptr.
1236
1237 2018-01-21  Mark Wielaard  <mark@klomp.org>
1238
1239         * readelf.c (get_indexed_addr): New function.
1240         (print_ops): Handle DW_OP_addrx, DW_OP_GNU_addr_index,
1241         DW_OP_constx, DW_OP_GNU_const_index separately and resolve
1242         address.
1243         (attr_callback): Print index and address for
1244         DW_FORM_GNU_addr_index and DW_FORM_addrx[1234].
1245
1246 2018-01-19  Mark Wielaard  <mark@klomp.org>
1247
1248         * readelf.c (options): Add info+.
1249         (show_split_units): New static boolean defaulting to false.
1250         (parse_opt): For all (no arg) --debug-dump set show_split_units
1251         to yes. For "info+" enable section_info and show_split_units.
1252         (attrcb_args): Add is_split field.
1253         (attr_callback): Use is_split to format DIE offsets differently.
1254         (print_debug_units): Likewise. Get subdie (type or split) only
1255         when needed. When not silent reiterate over split DIEs when
1256         found.
1257
1258 2018-05-15  Mark Wielaard  <mark@klomp.org>
1259
1260         * readelf.c (print_debug_units): Print unit type and id for any
1261         unit type that has it even when version < 5.
1262
1263 2018-05-14  Mark Wielaard  <mark@klomp.org>
1264
1265         * readelf.c (print_ops): Handle DW_OP_GNU_addr_index and
1266         DW_OP_GNU_const_index.
1267         (attr_callback): Handle DW_FORM_GNU_addr_index as DW_FORM_addrx.
1268         Handle DW_FORM_GNU_str_index as DW_FORM_constx. Add as_hex_id.
1269         Handle DW_AT_GNU_dwo_id as_hex_id.
1270         (print_form_data): Handle DW_FORM_GNU_str_index as DW_FORM_strx.
1271
1272 2018-05-12  Mark Wielaard  <mark@klomp.org>
1273
1274         * readelf.c (print_debug): Also recognize .dwo section name variants.
1275
1276 2018-05-15  Dmitry V. Levin  <ldv@altlinux.org>
1277
1278         * elflint.c (check_elf_header): Fix typo in error diagnostics.
1279
1280 2018-05-15  Mark Wielaard  <mark@klomp.org>
1281
1282         * readelf.c (print_form_data): Cast comparisons against offset_len to
1283         ptrdiff_t.
1284         (print_debug_line_section): Print uint64_t as PRIu64.
1285
1286 2018-05-11  Mark Wielaard  <mark@klomp.org>
1287
1288         * readelf.c (print_debug_macro_section): Use libdw_valid_user_form.
1289         Use print_form_data for strx and sup strings.
1290
1291 2018-05-09  Mark Wielaard  <mark@klomp.org>
1292
1293         * readelf.c (dwarf_line_content_description_string): New function.
1294         (dwarf_line_content_description_name): Likewise.
1295         (print_bytes): Likewise.
1296         (print_form_data): Likewise. Based on code taken from...
1297         (print_debug_macro_section): ...here. Now calls print_form_data
1298         and str_offsets_base_off.
1299         (print_debug_line_section): Parse DWARF5 header, directory and file
1300         name tables.
1301
1302 2018-05-12  Mark Wielaard  <mark@klomp.org>
1303
1304         * addr2line.c (main): Add fflush (stdout) after handle_address ()
1305         when reading from stdin.
1306
1307 2018-04-24  Mark Wielaard  <mark@klomp.org>
1308
1309         * readelf.c (print_debug_aranges_section): Try elf_rawdata if no
1310         sectiondata.
1311         (print_debug_ranges_section): Likewise.
1312         (print_debug_frame_section): Likewise.
1313         (print_debug_line_section): Likewise. Check for data == NULL.
1314         (print_debug_loc_section): Likewise.
1315         (print_debug_macinfo_section): Likewise.
1316         (print_debug_macro_section): Likewise.
1317
1318 2018-04-28  Mark Wielaard  <mark@klomp.org>
1319
1320         * readelf.c (print_debug): If .debug_info is needed implicitly by
1321         then handle it first before handling any other debug section.
1322         (parse_opt): Set implicit_debug_sections to section_info when
1323         showing all debug sections.
1324
1325 2018-05-05  Mark Wielaard  <mark@klomp.org>
1326
1327         * readelf.c (attr_callback): Handle DW_FORM_ref_sup4 and
1328         DW_FORM_ref_sup8 as references.
1329
1330 2018-04-24  Mark Wielaard  <mark@klomp.org>
1331
1332         * readelf.c (print_debug_str_section): Take raw section data. Don't
1333         use dwarf_getstring, but determine start and end of string from
1334         offset and section data directly.
1335         (print_debug): Handle ".debug_line_str" like ".debug_str".
1336
1337 2018-04-19  Andreas Schwab  <schwab@suse.de>
1338
1339         * elflint.c (valid_e_machine): Add EM_RISCV.
1340
1341 2018-04-16  Mark Wielaard  <mark@klomp.org>
1342
1343         * readelf.c (print_debug_line_section). In advance_pc, advance
1344         using op_addr_advance, not op_advance.
1345
1346 2018-04-14  Mark Wielaard  <mark@klomp.org>
1347
1348         * readelf.c (attr_callback): Only show errors when not silent.
1349
1350 2018-03-23  Mark Wielaard  <mark@klomp.org>
1351
1352         * readelf.c (attr_callback): Handle DW_FORM_strx[1234].
1353
1354 2018-03-22  Mark Wielaard  <mark@klomp.org>
1355
1356         * readelf.c (attr_callback): Handle DW_FORM_addrx[1234].
1357
1358 2018-03-28  Mark Wielaard  <mark@klomp.org>
1359
1360         * readelf.c (handle_sysv_hash): Break bucket chain after nchain
1361         entries are found.
1362         (handle_sysv_hash64): Likewise.
1363
1364 2018-03-27  Mark Wielaard  <mark@klomp.org>
1365
1366         * readelf.c (attr_callback): Print dwarf_dieoffset as %PRIx64,
1367         not %zx.
1368
1369 2018-03-20  Mark Wielaard  <mark@klomp.org>
1370
1371         * readelf.c (attr_callback): Report error when DW_AT_decl_file or
1372         DW_AT_call_file cannot be resolved.
1373
1374 2018-03-06  Mark Wielaard  <mark@klomp.org>
1375
1376         * readelf.c (print_ops): Handle DW_OP_addrx, DW_OP_constx,
1377         DW_OP_implicit_pointer, DW_OP_entry_value, DW_OP_const_type,
1378         DW_OP_regval_type, DW_OP_deref_type, DW_OP_xderef_type,
1379         DW_OP_convert, DW_OP_reinterpret.
1380
1381 2018-03-01  Mark Wielaard  <mark@klomp.org>
1382
1383         * readelf.c (struct listptr): Add attr field.
1384         (compare_listptr): Warn when two listptrs for the same offset have
1385         different attributes.
1386         (notice_listptr): Take attr as argument and add it to listptr.
1387         (skip_listptr_hole): New attr argument.
1388         (next_listptr_offset): New function.
1389         (print_debug_ranges_section): Pass NULL attr to skip_listptr_hole.
1390         (attr_callback): Handle DW_AT_GNU_locviews. Call notice_listptr with
1391         attr.
1392         (print_debug_loc_section): Keep track of which attr is associated with
1393         a listptr. If the attr is DW_AT_GNU_locview print view pairs till the
1394         next listptr offset.
1395
1396 2018-02-09  Mark Wielaard  <mark@klomp.org>
1397
1398         * elflint.c (check_group): Make sure we can read a complete
1399         element when iterating over the group.
1400
1401 2018-02-09  Mark Wielaard  <mark@klomp.org>
1402
1403         * readelf.c (attr_callback): Handle DW_FORM_data16 as Dwarf_Block.
1404
1405 2018-02-09  Mark Wielaard  <mark@klomp.org>
1406
1407         * readelf.c (print_debug_abbrev_section): Print the value of a
1408         DW_FORM_implicit_const using dwarf_getabbrevattr_data.
1409         (attr_callback): Handle DW_FORM_implicit_const.
1410
1411 2018-01-30  Mark Wielaard  <mark@klomp.org>
1412
1413         * readelf.c (dwarf_unit_string): New function.
1414         (dwarf_unit_name): Likewise.
1415         (print_debug_units): Use dwarf_get_units and dwarf_cu_die instead
1416         of dwarf_next_unit. Print unit type, id and subdie if available.
1417
1418 2018-02-09  Joshua Watt  <JPEWhacker@gmail.com>
1419
1420         * addr2line.c (handle_address): Use FALLTHROUGH macro instead of
1421         comment.
1422         * elfcompress.c (parse_opt): Likewise.
1423         * elflint.c (check_dynamic): Likewise.
1424         (check_sections): Likewise.
1425         (check_note_data): Likewise.
1426         * objdump.c (parse_opt): Likewise.
1427         * readelf.c (parse_opt): Likewise.
1428         (attr_callback): Likewise.
1429         (handle_auxv_note): Likewise.
1430         * strings.c (parse_opt): Likewise.
1431         * backtrace.c (callback_verify): Likewise.
1432
1433 2018-01-25  Mark Wielaard  <mark@klomp.org>
1434
1435         * readelf.c (print_debug_ranges_section): Initialize cu to last_cu.
1436         (print_debug_loc_section): Likewise.
1437
1438 2018-01-01  Mark Wielaard  <mark@klomp.org>
1439
1440         * readelf.c (attr_callback): Use dwarf_form_name for unknown forms.
1441         (print_debug_macro_section): Print form using dwarf_form_name.
1442
1443 2017-12-28  Mark Wielaard  <mark@klomp.org>
1444
1445         * readelf.c (print_debug_units): Print DIE offset in error message
1446         as hex.
1447
1448 2017-12-18  Mark Wielaard  <mark@klomp.org>
1449
1450         * readelf.c (handle_notes_data): Don't use EXIT_FAILURE in error.
1451         Adjust error message depending on whether or not we got data.
1452
1453 2017-12-07  Mark Wielaard  <mark@klomp.org>
1454
1455         * readelf.c (print_ops): Update data pointer and print arguments
1456         to DW_OP_call2 and DW_OP_call4 as DIE offsets.
1457
1458 2017-11-29  Mark Wielaard  <mark@klomp.org>
1459
1460         * readelf.c (argp_options): Add "section-groups", 'g'.
1461
1462 2017-11-29  Mark Wielaard  <mark@klomp.org>
1463
1464         * readelf.c (print_debug_loc_section): Print CU base and unresolved
1465         addresses. Adjust formatting.
1466
1467 2017-11-29  Mark Wielaard  <mark@klomp.org>
1468
1469         * readelf.c (print_debug_ranges_section): Print CU base and unresolved
1470         addresses. Adjust formatting.
1471
1472 2017-11-29  Mark Wielaard  <mark@klomp.org>
1473
1474         * readelf.c (attr_callback): Set valuestr to resolved file name
1475         for DW_AT_decl_file and DW_AT_call_file.
1476
1477 2017-11-29  Mark Wielaard  <mark@klomp.org>
1478
1479         * readelf.c (print_debug_units): Print abbrev code after DIE tag.
1480
1481 2017-11-29  Mark Wielaard  <mark@klomp.org>
1482
1483         * readelf.c (print_ops): Use only2 space for index. re-indent +5
1484         for DW_OP_GNU_entry_value.
1485
1486 2017-11-21  Mark Wielaard  <mark@klomp.org>
1487
1488         * readelf.c (attr_callback): Print attribute name and form in error
1489         message. If only the value cannot be retrieved/resolved don't abort.
1490
1491 2017-10-03  Mark Wielaard  <mark@klomp.org>
1492
1493         * readelf.c (attr_callback): Print DIE offset in error messages.
1494
1495 2017-11-03  Mark Wielaard  <mark@klomp.org>
1496
1497         * readelf.c (print_ops): Handle DW_OP_GNU_variable_value. Print
1498         referenced DIE as offset.
1499
1500 2017-09-10  Mark Wielaard  <mark@klomp.org>
1501
1502         * ar.c (do_oper_delete): Remove DEBUG conditional check.
1503         (no0print): Return bool. Check snprintf return value.
1504         (do_oper_insert): Initialize elf. Remove DEBUG conditional check.
1505         Check no0print calls succeed. Explicitly elf_end found elfs.
1506         (do_oper_extract): Make sure we don't create an empty variable
1507         length array.
1508
1509 2017-09-01  Mark Wielaard  <mark@klomp.org>
1510
1511         * stack.c (main): Replace \v in doc string with \n\n.
1512         * unstrip.c (main): Likewise.
1513
1514 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
1515
1516         * stack.c: Print pid_t using %lld.
1517
1518 2017-08-18  Ulf Hermann  <ulf.hermann@qt.io>
1519
1520         * readelf.c: Hardcode the signal numbers for non-linux systems.
1521
1522 2017-07-26  Mark Wielaard  <mark@klomp.org>
1523
1524         * readelf.c (print_debug_macro_section): Accept either version 4 or
1525         version 5. Use DW_MACRO names instead of DW_MACRO_GNU names. Add
1526         minimal support for DW_MACRO_define_sup, DW_MACRO_undef_sup,
1527         DW_MACRO_import_sup, DW_MACRO_define_strx and DW_MACRO_undef_strx.
1528
1529 2017-07-26  Mark Wielaard  <mark@klomp.org>
1530
1531         * readelf.c (dwarf_defaulted_string): New function.
1532         (dwarf_defaulted_name): Likewise.
1533         (attr_callback): Use dwarf_defaulted_name to get value of
1534         DW_AT_defaulted.
1535
1536 2017-07-20  Mark Wielaard  <mark@klomp.org>
1537
1538         * strip.c (handle_elf): Deal with data marker symbols pointing to
1539         debug sections (they can be removed).
1540
1541 2017-07-14  Mark Wielaard  <mark@klomp.org>
1542
1543         * strip (OPT_KEEP_SECTION): New define.
1544         (options): Add documentation for remove-section. Add keep-section.
1545         (struct section_pattern): New data type.
1546         (keep_secs, remove_secs): New globals.
1547         (add_pattern, free_sec_patterns, free_patterns, section_name_matches):
1548         New functions.
1549         (main): Call free_patterns.
1550         (parse_opt): Handle 'R' and OPT_KEEP_SECTION. Check remove_comment
1551         on ARGP_KEY_SUCCESS.
1552         (handle_elf): Handle and sanity check keep_secs and remove_secs.
1553
1554 2017-06-07  Mark Wielaard  <mark@klomp.org>
1555
1556         * strip.c (handle_elf): Introduce new handle_elf boolean. Use it to
1557         determine whether to create an output and/or debug file. Remove new
1558         output file on error.
1559
1560 2017-06-06  Mark Wielaard  <mark@klomp.org>
1561
1562         * strip.c (handle_elf): Assume e_shstrndx section can be removed.
1563
1564 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
1565
1566         * readelf.c: Include strings.h.
1567
1568 2017-04-20  Ulf Hermann  <ulf.hermann@qt.io>
1569
1570         * unstrip.c: Check shnum for 0 before subtracting from it.
1571
1572 2017-04-20  Ulf Hermann <ulf.hermann@qt.io>
1573
1574         * readelf.c: Replace YESSTR and NOSTR with gettext ("yes") and
1575         gettext ("no"), respectively.
1576
1577 2017-04-05  Mark Wielaard  <mark@klomp.org>
1578
1579         * elflint.c (check_elf_header): Decompress all sections.
1580
1581 2017-03-28  Mark Wielaard  <mark@klomp.org>
1582
1583         * elflint (check_group): Don't check if there is no flag word.
1584
1585 2017-03-27  Mark Wielaard  <mark@klomp.org>
1586
1587         * elflint.c (check_elf_header): Sanity check phnum and shnum.
1588
1589 2017-03-27  Mark Wielaard  <mark@klomp.org>
1590
1591         * elflint.c (check_sysv_hash): Return early if section size is
1592         too small.
1593         (check_sysv_hash64): Likewise.
1594         (check_hash): Calculate expect_entsize to check section size.
1595
1596 2017-03-27  Mark Wielaard  <mark@klomp.org>
1597
1598         * elflint.c (check_symtab_shndx): Check data->d_size.
1599
1600 2017-03-24  Mark Wielaard  <mjw@redhat.com>
1601
1602         * elfcmp.c (main): If n_namesz == 0 then the note name data is the
1603         empty string.
1604         * readelf.c (handle_notes_data): Likewise.
1605
1606 2017-03-24  Mark Wielaard  <mjw@redhat.com>
1607
1608         * readelf.c (handle_gnu_hash): Check inner < max_nsyms before
1609         indexing into chain array.
1610
1611 2017-02-16  Ulf Hermann  <ulf.hermann@qt.io>
1612
1613         * addr2line.c: Include printversion.h
1614         * ar.c: Likewise.
1615         * elflint.c: Likewise.
1616         * nm.c: Likewise.
1617         * objdump.c: Likewise.
1618         * ranlib.c: Likewise.
1619         * readelf.c: Likewise.
1620         * size.c: Likewise.
1621         * stack.c: Likewise.
1622         * strings.c: Likewise.
1623         * strip.c: Likewise.
1624         * elfcmp.c: Include printversion.h, remove system.h include.
1625         * elfcompress.c: Likewise.
1626         * findtextrel.c: Likewise.
1627         * unstrip.c: Likewise.
1628
1629 2017-02-14  Ulf Hermann  <ulf.hermann@qt.io>
1630
1631         * nm.c: Include color.h.
1632         * objdump.c: Likewise.
1633
1634 2016-12-24  Mark Wielaard  <mark@klomp.org>
1635
1636         * Makefile.am (findtextrel_LDADD): Add $(libeu).
1637         (addr2line_LDADD): Likewise.
1638         (elfcmp_LDADD): Likewise.
1639         * addr2line.c (print_version): Removed.
1640         * ar.c (print_version): Likewise.
1641         * elfcmp.c (print_version): Likewise.
1642         * elfcompress.c (print_version): Likewise.
1643         * elflint.c (print_version): Likewise.
1644         * findtextrel.c (print_version): Likewise.
1645         * nm.c (print_version): Likewise.
1646         * objdump.c: Likewise.
1647         * ranlib.c: Likewise.
1648         * readelf.c: Likewise.
1649         * size.c: Likewise.
1650         * stack.c: Likewise.
1651         * strings.c: Likewise.
1652         * strip.c: Likewise.
1653         * unstrip.c: Likewise.
1654
1655 2016-11-17  Mark Wielaard  <mjw@redhat.com>
1656
1657         * readelf.c (options): Add optional arg SECTION for symbols.
1658         (symbol_table_section): New static variable.
1659         (parse_opt): Set symbol_table_section on 's'.
1660         (print_symtab): Filter on symbol_table_section name is set.
1661
1662 2016-11-10  Mark Wielaard  <mjw@redhat.com>
1663
1664         * ar.c (write_member): Make sure tmpbuf is large enough to contain
1665         a starting '/' and ending '\0' char.
1666         (do_oper_insert): Likewise.
1667         * arlib.c (arlib_finalize): Format tmpbuf as PRId32 decimal.
1668
1669 2016-11-02  Mark Wielaard  <mjw@redhat.com>
1670
1671         * addr2line.c (handle_address): Add fallthrough comment.
1672         * elfcompress.c (parse_opt): Adjust fallthrough comment.
1673         * elflint.c (parse_opt): Add missing break after 'd' case.
1674         (check_sections): Add fallthrough comments.
1675         * objdump.c (parse_opt): Add explantion for fallthrough comment.
1676
1677 2016-10-22  Kevin Cernekee  <cernekee@chromium.org>
1678
1679         * unstrip.c: Fix "invalid string offset" error caused by using the
1680           unstripped .symtab with the stripped .strtab.
1681
1682 2016-10-11  Akihiko Odaki  <akihiko.odaki.4i@stu.hosei.ac.jp>
1683
1684         * arlib.c: Remove system.h include, add libeu.h include.
1685         * arlib2.c: Remove sys/param.h include.
1686         * elfcompress.c: Add libeu.h include.
1687         * elflint.c: Remove sys/param.h include, add libeu.h include.
1688         * nm.c: Likewise.
1689         * objdump.c: Likewise.
1690         * ranlib.c: Likewise.
1691         * readelf.c: Likewise.
1692         * size.c: Remove sys/param.h include.
1693         * strings.c: Likewise, add libeu.h include.
1694         * strip.c: Likewise.
1695         * unstrip.c: Likewise.
1696
1697 2016-10-06  Mark Wielaard  <mjw@redhat.com>
1698
1699         * strip.c (handle_elf): Don't remove real symbols from allocated
1700         symbol tables.
1701
1702 2016-08-25  Mark Wielaard  <mjw@redhat.com>
1703
1704         * strip.c (handle_elf): Recompress with ELF_CHF_FORCE.
1705
1706 2016-08-06  Mark Wielaard  <mjw@redhat.com>
1707
1708         * strip.c (handle_elf): Uncompress and recompress relocation target
1709         section if necessary.
1710
1711 2016-07-08  Mark Wielaard  <mjw@redhat.com>
1712
1713         * Makefile.am (strip_LDADD): Add libdw.
1714         * elfcompress.c (process_file): Use dwelf_strtab functions instead of
1715         ebl_strtab.
1716         * strip.c (handle_elf): Likewise.
1717         * unstrip.c (new_shstrtab): Likewise.
1718
1719 2016-07-06  Mark Wielaard  <mjw@redhat.com>
1720
1721         * elf32-i386.script, i386_ld.c, ld.c, ld.h, ldgeneric.c, ldlex.l,
1722         ldscript.y, libld_elf_i386.map, none_ld.c, sectionhash.c,
1723         sectionhash.h, symbolhash.c, symbolhash.h, unaligned.h,
1724         versionhash.c, versionhash.h, xelf.h: Removed.
1725         * Makefile.am (YACC): Removed.
1726         (AM_YFLAGS): Removed.
1727         (AM_LFLAGS): Removed.
1728         (native_ld): Removed.
1729         (base_cpu): Removed.
1730         (bin_PROGRAMS): Removed ld.
1731         (ld_dsos): Removed.
1732         (ld_SOURCES): Removed.
1733         (noinst_LIBRARIES): Only libar.a.
1734         (EXTRA_DIST): Just arlib.h and debugpred.h.
1735         (ld_LDADD): Removed.
1736         (ld_LDFLAGS): Removed.
1737         (ldlex.o): Removed.
1738         (ldscript.h): Removed.
1739         (libld*): Removed.
1740         (CLEANFILES): Just *.gconv.
1741         (MAINTAINERCLEANFILES): Removed.
1742
1743 2016-07-06  Mark Wielaard  <mjw@redhat.com>
1744
1745         * unstrip.c (copy_elided_sections): Use unstripped_strent[] from
1746         index zero, instead of one.
1747
1748 2016-06-28  Richard Henderson <rth@redhat.com>
1749
1750         * elflint.c (valid_e_machine): Add EM_BPF.
1751
1752 2016-04-11  David Abdurachmanov  <davidlt@cern.ch>
1753
1754         * elfcmp.c (main): Fix self-comparison error with GCC 6.
1755
1756 2016-03-21  Mark Wielaard  <mjw@redhat.com>
1757
1758         * nm.c (show_symbols): Check for malloc size argument overflow.
1759
1760 2016-02-13  Mark Wielaard  <mjw@redhat.com>
1761
1762         * readelf.c (print_scngrp): Call error when gelf_getshdr fails.
1763         (print_symtab): Likewise.
1764         (handle_hash): Likewise.
1765         (dump_data_section): Print a warning if decompressing fails.
1766         (print_string_section): Likewise.
1767
1768 2016-02-13  Mark Wielaard  <mjw@redhat.com>
1769
1770         * elfcompress.c (parse_opt): Don't fallthrough after processing -q.
1771
1772 2016-02-12  Mark Wielaard  <mjw@redhat.com>
1773
1774         * strip.c (handle_elf): Correct elf_assert shndxdata check.
1775
1776 2016-02-09  Mark Wielaard  <mjw@redhat.com>
1777
1778         * readelf.c (read_encoded): Move up.
1779         (print_cfa_program): Add encoding argument. Use it for read_encoded
1780         when reading DW_CFA_set_loc op.
1781         (print_debug_frame_section): Pass fde_encoding to print_cfa_program.
1782
1783 2016-02-09  Mark Wielaard  <mjw@redhat.com>
1784
1785         * elflint.c (compare_hash_gnu_hash): Check hash sh_entsize against
1786         sizeof (Elf64_Xword). Correct invalid sh_entsize error message
1787         section idx and name.
1788
1789 2016-01-13  Mark Wielaard  <mjw@redhat.com>
1790
1791         * elflint.c (check_elf_header): Recognize ELFOSABI_FREEBSD.
1792
1793 2016-01-08  Mark Wielaard  <mjw@redhat.com>
1794
1795         * elfcompress.c (compress_section): Use %zu to print size_t.
1796         * readelf.c (print_shdr): Use %zx to print size_t.
1797
1798 2015-12-16  Mark Wielaard  <mjw@redhat.com>
1799
1800         * elfcompress.c: New file.
1801         * Makefile.am (bin_PROGRAMS): Add elfcompress.
1802         (elfcompress_LDADD): New variable.
1803
1804 2015-12-18  Mark Wielaard  <mjw@redhat.com>
1805
1806         * elflint.c (section_flags_string): Add NEWFLAG COMPRESSED.
1807         (check_sections): SHF_COMPRESSED can be on any special section.
1808         SHF_COMPRESSED is a valid section flag. SHF_COMPRESSED cannot
1809         be used together with SHF_ALLOC or with SHT_NOBITS. Should have
1810         a valid Chdr.
1811
1812 2015-10-20  Mark Wielaard  <mjw@redhat.com>
1813
1814         * readelf.c (options): Expand -z help text.
1815         (dump_data_section): Check whether we need and can decompress section
1816         data and call elf_rawzdata if so,
1817         (print_string_section): Likewise.
1818         (elf_contains_chdrs): New function.
1819         (process_elf_file): Rename print_unrelocated to print_unchanged,
1820         use elf_contains_chdrs.
1821         (print_scngrp): Check whether section is compressed before use.
1822         (print_symtab): Likewise.
1823         (handle_hash): Likewise.
1824
1825 2015-10-16  Mark Wielaard  <mjw@redhat.com>
1826
1827         * readelf.c (argp_option): Describe --decompress,-z.
1828         (print_decompress): New bool.
1829         (parse_opt): Handle -z.
1830         (elf_ch_type_name): New function.
1831         (print_shdr): Print section compress information.
1832
1833 2015-12-31  Mark Wielaard  <mjw@redhat.com>
1834
1835         * elflint.c (check_symtab): Add _edata and _end (plus extra underscore
1836         variants) to to the list of possibly dangling symbols.
1837
1838 2015-12-02  Mark Wielaard  <mjw@redhat.com>
1839
1840         * nm.c (process_file): Accept fd and pass it on.
1841         (handle_elf): Likewise.
1842         (find_no_debuginfo): New.
1843         (struct getdbg): Likewise.
1844         (getdbg_dwflmod): Likewise.
1845         (show_symbols): Take fd. If the file is ET_REL use libdwfl to get
1846         the relocated Dwarf.
1847
1848 2015-12-02  Mark Wielaard  <mjw@redhat.com>
1849
1850         * nm.c (get_local_names): Check for duplicates in local_root tree.
1851
1852 2015-12-02  Mark Wielaard  <mjw@redhat.com>
1853
1854         * unstrip.c (struct data_list): New.
1855         (new_data_list): Likewise.
1856         (record_new_data): Likewise.
1857         (free_new_data): Likewise.
1858         (adjust_relocs): Call record_new_data.
1859         (add_new_section_symbols): Likewise.
1860         (copy_elided_sections): Call free_new_data.
1861
1862 2015-12-01  Mark Wielaard  <mjw@redhat.com>
1863
1864         * elfcmp.c (main): Close ebl1 and ebl2 backends.
1865
1866 2015-10-16  Mark Wielaard  <mjw@redhat.com>
1867
1868         * Makefile.am [BUILD_STATIC](libdw): Add -lz.
1869         [BUILD_STATIC](libelf): Likewise.
1870
1871 2015-10-16  Mark Wielaard  <mjw@redhat.com>
1872
1873         * elflint.c (check_symtab): Don't check TLS symbol value against TLS
1874         phdr offset in debuginfo files.
1875         (check_sections): Don't try to match section offsets to phdrs offsets
1876         in debuginfo files.
1877
1878 2015-10-16  Mark Wielaard  <mjw@redhat.com>
1879
1880         * elflint.c (check_reloc_shdr): Reject only desthdrs if they have both
1881         SHF_MERGE and SHF_STRINGS set.
1882
1883 2015-10-13  Jose E. Marchesi  <jose.marchesi@oracle.com>
1884
1885         * elflint.c (check_sections): Do not rely on
1886         ebl_check_special_section when checking debuginfo files.  Also
1887         check that the type of WE sections in debuginfo files is NOBITS.
1888
1889 2015-10-13  Mark Wielaard  <mjw@redhat.com>
1890
1891         * elflint.c (check_program_header): Check relro flags are a subset
1892         of the load segment if they don't fully overlap.
1893
1894 2015-10-07  Mark Wielaard  <mjw@redhat.com>
1895
1896         * Makefile.am (ldlex_no_Wstack_usage): New.
1897         * ldlex.l ([RWX]): Make cnt unsigned.
1898
1899 2015-10-09  Josh Stone  <jistone@redhat.com>
1900
1901         * elflint.c (main): Replace stat64 and fstat64 with stat and fstat.
1902         * readelf.c (process_file): Likewise.
1903         (process_elf_file): Replace off64_t with off_t.
1904         * findtextrel.c (process_file): Replace open64 with open.
1905         * ld.c (main): Replace sizeof (off64_t) with 8.
1906         * strings.c: Replace off64_t with off_t throughout.
1907         (main): Replace stat64 and fstat64 with stat and fstat.
1908         (map_file): Replace mmap64 with mmap.
1909         (read_block): Likewise, and replace lseek64 with lseek.
1910         * strip.c (handle_elf): Replace ftruncate64 with ftruncate.
1911         (process_file): Replace stat64 and fstat64 with stat and fstat.
1912         * unstrip.c (parse_opt): Replace stat64 with stat.
1913         (handle_file): Replace open64 with open.
1914         (open_file): Likewise.
1915
1916 2015-10-08  Chih-Hung Hsieh  <chh@google.com>
1917
1918         * ld.c (determine_output_format): Move recursive nested
1919         function "try" to file scope.
1920
1921 2015-10-04  Mark Wielaard  <mjw@redhat.com>
1922
1923         * strip.c (handle_elf): Only sanity check section symbols to not
1924         kept discarded sections if we are creating a debug file.
1925
1926 2015-10-07  Mark Wielaard  <mjw@redhat.com>
1927
1928         * unstrip.c (MAX): Removed.
1929         (find_alloc_sections_prelink): Allocate exact amount of bytes for
1930         shdrs.
1931
1932 2015-10-05  Chih-Hung Hsieh <chh@google.com>
1933
1934         * unstrip.c (find_alloc_sections_prelink): Do not allocate
1935         on stack union types with variable length arrays; use xmalloc
1936         for such dynamic sized objects.
1937         * readelf.c (handle_core_item): Likewise, but use alloca
1938         for small variable size data object and add assert(count < 128).
1939
1940 2015-10-05  Josh Stone  <jistone@redhat.com>
1941
1942         * Makefile.am (libld_elf_i386.so): Add AM_V_CCLD silencer.
1943         (.deps/none_ld.Po): Always silence the dummy command.
1944         (make-debug-archive): Add AM_V_GEN and AM_V_at silencers.
1945
1946 2015-10-02  Mark Wielaard  <mjw@redhat.com>
1947
1948         * unstrip.c (copy_elided_sections): Use SH_INFO_LINK_P, not just
1949         SHF_INFO_LINK.
1950
1951 2015-10-02  Mark Wielaard  <mjw@redhat.com>
1952
1953         * strip.c (handle_elf): Don't move around allocated NOBITS sections.
1954         Don't just mark the section header string table as unused.
1955         * unstrip.c (copy_elided_sections): Add header names to strtab if
1956         shstrndx equals the symtab strtabndx.
1957
1958 2015-09-22  Mark Wielaard  <mjw@redhat.com>
1959
1960         * strip.c (cleanup_debug): Remove old-style function definitions.
1961
1962 2015-09-09  Chih-Hung Hsieh  <chh@google.com>
1963
1964         * readelf.c (print_debug_exception_table): Initialize variable before
1965         it is used, because compiler does not know that error never returns.
1966         (dump_arhive_index): Likewise.
1967
1968 2015-09-04  Chih-Hung Hsieh  <chh@google.com>
1969
1970         * elflint.c (check_group): Replace %Z length modifier with %z.
1971         (check_note_data): Likewise.
1972         * findtextrel.c (process_file): Likewise.
1973         * readelf.c (handle_dynamic): Likewise.
1974         (handle_symtab): Likewise.
1975         (handle_verneed): Likewise.
1976         (handle_verdef): Likewise.
1977         (handle_versym): Likewise.
1978         (print_hash_info): Likewise.
1979         (print_decoded_aranges_section): Likewise.
1980         (print_debug_aranges_section): Likewise.
1981         (print_debug_line_section): Likewise.
1982         (hex_dump): Likewise.
1983         (dump_data_section): Likewise.
1984         (print_string_section): Likewise.
1985         (dump_archive_index): Likewise.
1986         * unstrip.c (adjust_relocs): Likewise.
1987         (collect_symbols): likewise.
1988         (get_section_name): Likewise.
1989         (find_alloc_sections_prelink): Likewise.
1990         (copy_elided_sections): Likewise.
1991         * ldscript.y (add_id_list): Add missing '%s'.
1992
1993 2015-09-03  Mark Wielaard  <mjw@redhat.com>
1994
1995         * readelf.c (handle_core_item): Handle right shift >= 32 bits.
1996
1997 2015-08-11  Mark Wielaard  <mjw@redhat.com>
1998
1999         * elflint.c (check_sections): When gnuld and a NOBITS section falls
2000         inside a segment make sure any ELF file contents is zero.
2001
2002 2015-07-29  Mark Wielaard  <mjw@redhat.com>
2003
2004         * unstrip.c (sections_flags_match): New function.
2005         (sections_match): Use sections_flags_match.
2006         (find_alloc_sections_prelink): Only clear matched sections if there
2007         is an undo section.
2008         (copy_elided_sections): Add SHF_INFO_LINK to shdr_mem.sh_flags if
2009         necessary.
2010
2011 2015-06-27  Pino Toscano  <toscano.pino@tiscali.it>
2012
2013         * src/strings.c: Define MAP_POPULATE if not defined already.
2014
2015 2015-06-27  Mark Wielaard  <mjw@redhat.com>
2016
2017         * nm.c (show_symbols): First call elf_getdata, then allocate memory.
2018
2019 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2020
2021         * findtextrel.c (process_file): Free segments after use.
2022
2023 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2024
2025         * readelf.c (print_phdr): Make sure phdr2_mem lifetime/scope equals
2026         phdr2 pointer.
2027
2028 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2029
2030         * readelf.c (handle_gnu_hash): Free lengths on invalid_data.
2031
2032 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2033
2034         * elflint.c (check_symtab): Only check the PT_TLS phdr if it actually
2035         exists. Warn otherwise.
2036
2037 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2038
2039         * nm.c (show_symbols): Check sizeof (sym_mem[0]), not GElf_Sym to
2040         known whether or not we stack allocated memory.
2041
2042 2015-06-18  Mark Wielaard  <mjw@redhat.com>
2043
2044         * strings.c (readelf): Use "<unknown>" if we cannot retrieve section
2045         name.
2046
2047 2015-06-09  Mark Wielaard  <mjw@redhat.com>
2048
2049         * addr2line.c (print_dwarf_function): Always free scopes before
2050         returning.
2051
2052 2015-06-09  Mark Wielaard  <mjw@redhat.com>
2053
2054         * strip.c (handle_ar): Mark as unused.
2055         (process_file): Produce an error when trying to handle an ar.
2056
2057 2015-05-30  Mark Wielaard  <mjw@redhat.com>
2058
2059         * elfcmp.c (main): Only call memcmp when d_size != 0.
2060
2061 2015-05-23  Mark Wielaard  <mjw@redhat.com>
2062
2063         * Makefile.am: Define ldgeneric, readelf, nm, size, strip, elflint,
2064         findtextrel, elfcmp objdump, ranlib, ar and unstrip no_Wstack_usage.
2065
2066 2015-05-21  Mark Wielaard  <mjw@redhat.com>
2067
2068         * addr2line.c (handle_address): Set scopes to NULL after free.
2069
2070 2015-05-20  Mark Wielaard  <mjw@redhat.com>
2071
2072         * addr2line.c (OPT_PRETTY): New constant define.
2073         (argp_option): Add "pretty-print".
2074         (pretty): New static bool.
2075         (parse_opt): Set pretty.
2076         (print_dwarf_function): Adjust output when pretty is set.
2077         (print_addrsym): Likewise.
2078         (handle_address): Likewise.
2079
2080 2015-05-20  Mark Wielaard  <mjw@redhat.com>
2081
2082         * Makefile.am (addr2line_LDADD): Add demanglelib.
2083         * addr2line.c (argp_option): Move demangle under output format.
2084         (demangle): New static bool.
2085         (demangle_buffer_len): New static size_t.
2086         (demangle_buffer): New static char *.
2087         (main): free demangle_buffer.
2088         (parse_opt): Set demangle.
2089         (symname): New static function.
2090         (get_diename): Use symname.
2091         (print_dwarf_function): Likewise.
2092         (print_addrsym): Likewise.
2093         (handle_address): Likewise.
2094
2095 2015-05-20  Mark Wielaard  <mjw@redhat.com>
2096
2097         * addr2line.c (argp_option): Add "addresses", 'a'.
2098         (print_addresses): New static bool.
2099         (parse_opt): Set print_addresses.
2100         (get_addr_width): New static function.
2101         (handle_address): Print address if print_addresses is true.
2102
2103 2015-05-20  Mark Wielaard  <mjw@redhat.com>
2104
2105         * addr2line.c (handle_address): Call strtoumax with base 16. Make
2106         sure all input has been processed.
2107
2108 2015-05-20  Mark Wielaard  <mjw@redhat.com>
2109
2110         * addr2line (argp_option): Group 'section' under "Input format
2111         options".
2112
2113 2015-05-12  Mark Wielaard  <mjw@redhat.com>
2114
2115         * strip.c (debug_fd): New static variable.
2116         (tmp_debug_fname): Likewise.
2117         (cleanup_debug): New function using the above to clean up temporary
2118         debug file.
2119         (INTERNAL_ERROR): Call cleanup_debug.
2120         (handle_elf): Use debug_fd and tmp_debug_fname statics and call
2121         cleanup_debug before any error. Use output_fname instead of fname in
2122         error messages when it exists (-o was given). SHT_NOBITS sections
2123         can also be moved freely even if SHF_ALLOC is set. Add various
2124         sanity checks. Use elf_assert instead of plain assert.
2125
2126 2015-05-08  Mark Wielaard  <mjw@redhat.com>
2127
2128         * nm.c (show_symbols): Call gelf_fsize with EV_CURRENT.
2129         * strip.c (handle_elf): Likewise.
2130
2131 2015-05-06  Mark Wielaard  <mjw@redhat.com>
2132
2133         * elflint.c (check_gnu_hash): Return early when 2nd hash function
2134         shift too big. Check there is enough data available. Make sure
2135         bitmask_words is not zero.
2136         (check_verdef): Use Elf64_Word for shdr->sh_info cnt.
2137         (check_verneed): Likewise.
2138         (check_attributes): Break when vendor name isn't terminated.
2139         Add overflow check for subsection_len.
2140
2141 2015-05-05  Mark Wielaard  <mjw@redhat.com>
2142
2143         * nm.c (show_symbols): Handle dwarf_linesrc returning NULL.
2144
2145 2015-05-04  Max Filippov  <jcmvbkbc@gmail.com>
2146
2147         * ar.c (do_oper_extract): Replace struct timeval with struct timespec
2148         and futimes with futimens.
2149         * strip.c (process_file): Replace struct timeval with struct timespec.
2150         (handle_elf, handle_ar): Replace struct timeval with struct timespec
2151         in prototype. Replace futimes with futimens.
2152
2153 2015-05-04  Max Filippov  <jcmvbkbc@gmail.com>
2154
2155         * addr2line.c (main): Drop mtrace() call and #include <mcheck.h>.
2156         * ar.c: Likewise.
2157         * ld.c: Likewise.
2158         * nm.c: Likewise.
2159         * objdump.c: Likewise.
2160         * ranlib.c: Likewise.
2161         * size.c: Likewise.
2162         * strip.c: Likewise.
2163         * unstrip.c: Likewise.
2164
2165 2015-05-04  Anthony G. Basile  <blueness@gentoo.org>
2166
2167         * Makefile.am (readelf_LDADD, nm_LDADD, size_LDADD, strip_LDADD)
2168         (ld_LDADD, elflint_LDADD, findtextrel_LDADD, addr2line_LDADD)
2169         (elfcmp_LDADD, objdump_LDADD, ranlib_LDADD, strings_LDADD)
2170         (ar_LDADD, unstrip_LDADD, stack_LDADD): Append $(argp_LDADD).
2171
2172 2015-03-22  Mark Wielaard  <mjw@redhat.com>
2173
2174         * readelf.c (print_debug_frame_section): Cast start to Dwarf_Off
2175         before subtracting cie_id. And cast cie_offset to Dwarf_Off before
2176         comparison.
2177
2178 2015-03-22  Mark Wielaard  <mjw@redhat.com>
2179
2180         * readelf.c (print_gdb_index_section): Check all offsets used
2181         against section d_size.
2182
2183 2015-03-17  Mark Wielaard  <mjw@redhat.com>
2184
2185         * readelf.c (print_debug): Don't return, but always use dummy_dbg.
2186
2187 2015-03-17  Mark Wielaard  <mjw@redhat.com>
2188
2189         * readelf.c (print_gdb_index_section): Add overflow checking for
2190         dataend checks.
2191
2192 2015-03-14  Mark Wielaard  <mjw@redhat.com>
2193
2194         * nm.c (INTERNAL_ERROR): Remove __DATE__.
2195         * objdump.c (INTERNAL_ERROR): Likewise.
2196         * size.c (INTERNAL_ERROR): Likewise.
2197         * strip.c (INTERNAL_ERROR): Likewise.
2198
2199 2015-03-18  Petr Machata  <pmachata@redhat.com>
2200
2201         * readelf.c (dwarf_tag_string, dwarf_attr_string)
2202         (dwarf_form_string, dwarf_lang_string, dwarf_inline_string)
2203         (dwarf_encoding_string, dwarf_access_string)
2204         (dwarf_visibility_string, dwarf_virtuality_string)
2205         (dwarf_identifier_case_string, dwarf_calling_convention_string)
2206         (dwarf_ordering_string, dwarf_discr_list_string)
2207         (dwarf_locexpr_opcode_string): Adjust uses of know-dwarf.h macros
2208         to match the API changes.
2209
2210 2015-03-09  Mark Wielaard  <mjw@redhat.com>
2211
2212         * elflint.c (compare_hash_gnu_hash): Correct gnu_symbias usage.
2213
2214 2015-01-03  Mark Wielaard  <mjw@redhat.com>
2215
2216         * elfcmp (main): Check section name is not NULL. Check sh_entsize
2217         is not zero for symbol tables. Check phdrs are not NULL.
2218         (search_for_copy_reloc): Check sh_entsize is not zero.
2219
2220 2014-12-30  Mark Wielaard  <mjw@redhat.com>
2221
2222         * elflint.c (check_scn_group): Check d_buf and name are not NULL.
2223         (is_rel_dyn): Check d is not NULL. Check shdr->sh_entsize is not
2224         zero.
2225         (check_dynamic): Check strshdr is not NULL. Check d_tag is positive.
2226         (check_symtab_shndx): Check symshdr and data->d_buf are not NULL.
2227         Check shdr and symshdr sh_entsize are not zero.
2228         (check_gnu_hash): Make sure maskidx is smaller than bitmask_words.
2229         Check symshdr->sh_entsize is not zero. Check data->d_buf is not
2230         NULL.
2231         (compare_hash_gnu_hash): Check sections d_buf are not NULL.
2232         Check section data is large enough. Use gnu_symbias.
2233         (check_group): Check section val is valid.
2234         (has_copy_reloc): Check sh_entsize is not zero.
2235         (check_versym): Likewise.
2236         (unknown_dependency_p): Likewise.
2237         (check_verneed): Break on invalid ref or offset. Don't assert.
2238         Report error when next offset is zero, but more vers expected.
2239         (check_verdef): Likewise.
2240         (check_attributes): Make sure d_buf is not NULL.
2241         (check_note): Likewise.
2242         (check_note_section): Likewise.
2243         (check_program_header): Make sure section name is not NULL.
2244
2245 2014-12-26  Mark Wielaard  <mjw@redhat.com>
2246
2247         * strings.c (read_elf): Produce error when section data falls outside
2248         file.
2249
2250 2014-12-26  Mark Wielaard  <mjw@redhat.com>
2251
2252         * nm.c (show_symbols): Guard against divide by zero in error check.
2253         Add section index number in error message.
2254
2255 2014-12-26  Mark Wielaard  <mjw@redhat.com>
2256
2257         * nm.c (handle_ar): Skip over /SYM64/ entries.
2258
2259 2014-12-26  Mark Wielaard  <mjw@redhat.com>
2260
2261         * nm.c (handle_ar): Break on arsym with invalid offset.
2262
2263 2014-12-20  Mark Wielaard  <mjw@redhat.com>
2264
2265         * readelf.c (print_debug_macinfo_section): Mark cus sentinel files
2266         as -1 non-existent. Check macoff against sentinel cus.
2267
2268 2014-12-20  Mark Wielaard  <mjw@redhat.com>
2269
2270         * readelf.c (print_debug_exception_table): Add max_action overflow
2271         check. Check action_table_end before reading slib128. Check
2272         max_ar_filter underflow.
2273
2274 2014-12-18  Ulrich Drepper  <drepper@gmail.com>
2275
2276         * Makefile.am: Suppress output of textrel_check command.
2277
2278 2014-12-17  Mark Wielaard  <mjw@redhat.com>
2279
2280         * readelf.c (print_cfa_program): Add bounds check before each op that
2281         takes at least one argument.
2282
2283 2014-12-16  Mark Wielaard  <mjw@redhat.com>
2284
2285         * readelf.c (print_decoded_line_section): Print dwarf_errmsg if
2286         dwarf_onesrcline or dwarf_linesrc fails.
2287
2288 2014-12-16  Mark Wielaard  <mjw@redhat.com>
2289
2290         * readelf.c (print_debug_line_section): Correct overflow check for
2291         unit_length.
2292         (print_debug_aranges_section): Correct overflow check for length.
2293
2294 2014-12-15  Mark Wielaard  <mjw@redhat.com>
2295
2296         * readelf.c (notice_listptr): Return false if offset doesn't fit
2297         in 61-bits.
2298         (attr_callback): Warn if loclist or rangelist offset doesn't fit.
2299
2300 2014-12-15  Mark Wielaard  <mjw@redhat.com>
2301
2302         * readelf.c (print_ops): Don't assert when addr_size or ref_size
2303         is not 4 or 8, just report invalid data.
2304
2305 2014-12-15  Mark Wielaard  <mjw@redhat.com>
2306
2307         * readelf.c (print_gdb_index_section): Add more bounds checks.
2308
2309 2014-12-15  Mark Wielaard  <mjw@redhat.com>
2310
2311         * readelf.c (print_debug_line_section): Check there is enough room
2312         for DW_LNE_set_address argument. Make sure there is enough room
2313         for the the initial unit_length.
2314
2315 2014-12-14  Mark Wielaard  <mjw@redhat.com>
2316
2317         * elflint.c (check_attributes): Call get_uleb128 with end pointer.
2318         * readelf.c (print_attributes): Likewise.
2319         (print_ops): Likewise and also for get_sleb128.
2320         (print_cfa_program): Likewise and add more readp bounds checks.
2321         (read_encoded): Likewise.
2322         (print_debug_frame_section): Likewise.
2323         (print_debug_line_section): Likewise.
2324         (print_debug_macinfo_section): Likewise.
2325         (print_debug_macro_section): Likewise.
2326         (print_debug_exception_table): Likewise.
2327
2328 2014-12-16  Mark Wielaard  <mjw@redhat.com>
2329
2330         * elfcmp.c (compare_Elf32_Word): Make sure (unsigned) Elf32_Word
2331         difference doesn't wrap around before returning as int.
2332
2333 2014-12-11  Mark Wielaard  <mjw@redhat.com>
2334
2335         * readelf.c (print_debug_exception_table): Check TType base offset
2336         and Action table are sane.
2337
2338 2014-12-11  Mark Wielaard  <mjw@redhat.com>
2339
2340         * readelf.c (print_debug_frame_section): Check number of augmentation
2341         chars to print.
2342
2343 2014-12-09  Mark Wielaard  <mjw@redhat.com>
2344
2345         * readelf.c (handle_file_note): Check count fits data section and
2346         doesn't overflow fptr.
2347
2348 2014-12-08  Mark Wielaard  <mjw@redhat.com>
2349
2350         * readelf.c (print_debug_exception_table): Report invalid data if
2351         action table doesn't immediately follow call site table.
2352
2353 2014-12-10  Josh Stone  <jistone@redhat.com>
2354
2355         * addr2line.c (get_diename): New, get linkage_name or name.
2356         * addr2line.c (print_dwarf_function): Use get_diename.
2357         * addr2line.c (handle_address): Likewise.
2358         * addr2line.c (print_diesym): Removed.
2359
2360 2014-12-10  Josh Stone  <jistone@redhat.com>
2361
2362         * addr2line.c (handle_address): Find the proper inline parents.
2363
2364 2014-12-07  Mark Wielaard  <mjw@redhat.com>
2365
2366         * readelf.c (print_debug_line_section): max_ops_per_instr cannot
2367         be zero.
2368
2369 2014-12-07  Mark Wielaard  <mjw@redhat.com>
2370
2371         * readelf.c (print_ops): Handle zero ref_size for DW_OP_call_ref
2372         and DW_OP_GNU_implicit_pointer.
2373
2374 2014-12-04  Mark Wielaard  <mjw@redhat.com>
2375
2376         * objdump.c (show_relocs_x): Make sure destshdr exists.
2377         (show_relocs_rel): Don't rely on shdr->sh_entsize, use gelf_fsize.
2378         (show_relocs_rela): Likewise.
2379         (show_relocs): Make sure destshdr, symshdr and symdata exists.
2380
2381 2014-11-30  Mark Wielaard  <mjw@redhat.com>
2382
2383         * readelf.c (handle_sysv_hash64): Fix overflow check.
2384
2385 2014-11-28  Mark Wielaard  <mjw@redhat.com>
2386
2387         * readelf.c (handle_relocs_rel): Don't reuse destshdr to store
2388         section header of a relocation against a STT_SECTION symbol. Use
2389         a new local variable secshdr.
2390         (handle_relocs_rela): Likewise.
2391
2392 2014-11-26  Mark Wielaard  <mjw@redhat.com>
2393
2394         * readelf.c (print_debug_aranges_section): Cast Dwarf_Word length
2395         to ptrdiff_t for comparison.
2396
2397 2014-11-24  Mark Wielaard  <mjw@redhat.com>
2398
2399         * readelf.c (print_debug_line_section): Check line_range is not zero
2400         before usage.
2401
2402 2014-11-23  Mark Wielaard  <mjw@redhat.com>
2403
2404         * readelf.c (print_debug_aranges_section): Check length to catch
2405         nexthdr overflow.
2406
2407 2014-11-21  Mark Wielaard  <mjw@redhat.com>
2408
2409         * readelf.c (print_attributes): Guard against empty section.
2410         Document attribute format. Break when vendor name isn't terminated.
2411         Add overflow check for subsection_len. Handle both gnu and non-gnu
2412         attribute tags.
2413
2414 2014-11-22  Mark Wielaard  <mjw@redhat.com>
2415
2416         * elflint.c (check_sections): Call ebl_bss_plt_p without ehdr.
2417         * findtextrel.c (process_file): Use elf_getphdrnum.
2418         * readelf.c (process_elf_file): Remove redundant ehdr->e_phoff check.
2419         (print_phdr): Check phnum.
2420         * size.c (show_segments): Use elf_getphdrnum.
2421         * strip.c (handle_elf): Likewise.
2422         * unstrip.c (copy_elf): Likewise.
2423         (copy_elided_sections): Likewise.
2424         (handle_file): Likewise.
2425
2426 2014-11-18  Mark Wielaard  <mjw@redhat.com>
2427
2428         * readelf.c (print_cfa_program): Fix sanity check of DW_FORM_block
2429         length.
2430
2431 2014-11-17  Mark Wielaard  <mjw@redhat.com>
2432
2433         * readelf.c (handle_verneed): Check vna_next and vn_next exist.
2434         (handle_verdef): Check vda_next and vd_next exist.
2435         (handle_versym): Check vd_next, vna_next and vn_next exist.
2436         Check vername and filename are not NULL before use.
2437
2438 2014-11-17  Mark Wielaard  <mjw@redhat.com>
2439
2440         * elfcmp.c (main): Check section names are NULL before use.
2441         * objdump.c (section_match): Likewise.
2442         * size.c (show_sysv): Likewise.
2443
2444 2014-11-17  Mark Wielaard  <mjw@redhat.com>
2445
2446         * readelf.c (print_debug_frame_section): Warn if ptr_size is not 4
2447         or 8 instead of just calling print_cfa_program.
2448
2449 2014-11-16  Mark Wielaard  <mjw@redhat.com>
2450
2451         * readelf (process_elf_file): Set phnum to zero if there aren't
2452         actually any pheaders.
2453         (print_phdr): Check there actually is a phdr.
2454
2455 2014-11-16  Mark Wielaard  <mjw@redhat.com>
2456
2457         * readelf.c (print_cfa_program): Check block len before calling
2458         print_ops.
2459
2460 2014-11-14  Mark Wielaard  <mjw@redhat.com>
2461
2462         * readelf.c (print_debug_frame_section): Sanity Check CIE
2463         unit_length and augmentationlen.
2464
2465 2014-11-14  Mark Wielaard  <mjw@redhat.com>
2466
2467         * readelf.c (handle_versym): Check def == NULL before use.
2468
2469 2014-11-08  Mark Wielaard  <mjw@redhat.com>
2470
2471         * readelf.c (handle_versym): Initialize vername and filename array
2472         elements.
2473
2474 2014-11-07  Mark Wielaard  <mjw@redhat.com>
2475
2476         * readelf.c (handle_sysv_hash): Sanity check section contents.
2477         (handle_sysv_hash64): Likewise.
2478         (handle_gnu_hash): Likewise.
2479
2480 2014-09-14  Petr Machata  <pmachata@redhat.com>
2481
2482         * readelf.c (handle_relocs_rela): Typo fix, test DESTSHDR properly.
2483
2484 2014-09-12  Petr Machata  <pmachata@redhat.com>
2485
2486         * readelf.c (encoded_ptr_size): In the switch statement, change
2487         magic constants 3 and 4 to DW_EH_PE_* counterparts.  Still accept
2488         0.  Print diagnostic for anything else.
2489
2490 2014-08-25  Josh Stone  <jistone@redhat.com>
2491
2492         * Makefile.am: Prevent premature @AR@ replacement in a sed expression.
2493
2494 2014-07-04  Menanteau Guy  <menantea@linux.vnet.ibm.com>
2495             Mark Wielaard  <mjw@redhat.com>
2496
2497         * elflint (check_symtab): Add ".TOC." to the list of possibly
2498         dangling symbols because of sourceware PR13621.
2499
2500 2014-06-14  Mark Wielaard  <mjw@redhat.com>
2501
2502         * elflint (check_symtab): Use ebl_func_addr_mask on st_value.
2503
2504 2014-05-27  Mark Wielaard  <mjw@redhat.com>
2505
2506         * readelf.c (print_debug): Skip section if name is NULL.
2507
2508 2014-05-26  Mark Wielaard  <mjw@redhat.com>
2509
2510         * readelf.c (handle_relocs_rela): Print header like handle_relocs_rel
2511         does, when sh_info == 0.
2512
2513 2014-05-26  Mark Wielaard  <mjw@redhat.com>
2514
2515         * unstrip.c (find_alloc_sections_prelink): Allow non-split .bss
2516         section when sh_size of the original and undo .bss section are equal.
2517
2518 2014-05-26  Mark Wielaard  <mjw@redhat.com>
2519
2520         * unstrip.c (options): Add --force, -F.
2521         (struct arg_info): Add bool force.
2522         (parse_opt): Handle 'F', set force.
2523         (handle_explicit_files): Add force argument, add warn function,
2524         separate check ehdr field checks, use warn.
2525         (handle_dwfl_module): Add force argument, pass on to
2526         handle_explicit_files.
2527         (handle_output_dir_module): Add force argument, pass on to
2528         handle_dwfl_module.
2529         (handle_implicit_modules): Pass info->force to handle_dwfl_module and
2530         handle_output_dir_module.
2531         (main): Pass info.force to handle_explicit_files.
2532
2533 2014-05-19  Mark Wielaard  <mjw@redhat.com>
2534
2535         * elflint.c (check_reloc_shdr): Check ebl_check_reloc_target_type.
2536
2537 2014-05-01  Mark Wielaard  <mjw@redhat.com>
2538
2539         * readelf.c (find_no_debuginfo): Call dwfl_standard_find_debuginfo
2540         if looking for alternate debug file.
2541
2542 2014-04-11  Mark Wielaard  <mjw@redhat.com>
2543
2544         * Makefile.am (AM_CPPFLAGS): Add -I libdwelf.
2545
2546 2014-04-22  Mark Wielaard  <mjw@redhat.com>
2547
2548         * readelf.c (handle_core_item): Make sure variable length array
2549         contains at least enough space for terminating zero char.
2550
2551 2014-04-22  Mark Wielaard  <mjw@redhat.com>
2552
2553         * readelf.c (print_gdb_index_section): Use unsigned int for 31 bits
2554         left shift.
2555
2556 2014-03-13  Mark Wielaard  <mjw@redhat.com>
2557
2558         * Makefile.am: Remove no_mudflap.os. Remove libmudflap from all
2559         LDADD lines.
2560         * strings.c (process_chunk): Remove _MUDFLAP condition.
2561
2562 2014-04-09  Mark Wielaard  <mjw@redhat.com>
2563
2564         * readelf.c (print_debug_aranges_section): Don't get the raw section
2565         data, use the possibly decompressed .[z]debug sectiondata.
2566         (print_debug_ranges_section): Likewise.
2567         (print_debug_frame_section): Likewise.
2568         (print_debug_line_section): Likewise.
2569         (print_debug_loc_section): Likewise.
2570         (print_debug_macinfo_section): Likewise.
2571         (print_debug_macro_section): Likewise.
2572
2573 2014-04-10  Mark Wielaard  <mjw@redhat.com>
2574
2575         * readelf.c (buf_read_ulong): Pass actual long size to convert.
2576
2577 2014-03-05  Mark Wielaard  <mjw@redhat.com>
2578
2579         * readelf.c (attr_callback): Print DW_FORM_sdata values as signed
2580         numbers.
2581
2582 2014-02-24  Mark Wielaard  <mjw@redhat.com>
2583
2584         * readelf (print_phdr): Check there is a SHT_PROGBITS section at the
2585         offset given by p_offsets for a PT_INTERP segment before trying to
2586         display the interpreter string.
2587
2588 2014-02-07  Mark Wielaard  <mjw@redhat.com>
2589
2590         * readelf.c (print_phdr): Check phdr->p_filesz and make sure
2591         interpreter string is zero terminated before calling printf.
2592
2593 2014-01-22  Mark Wielaard  <mjw@redhat.com>
2594
2595         * Makefile.am (nm_no_Wformat): Removed.
2596         (size_no_Wformat): Likewise.
2597         (strings_no_Wformat): Likewise.
2598         (addr2line_no_Wformat): Likewise.
2599         * size.c (show_sysv): Use fmtstr directly as literal in printf.
2600         (show_sysv_one_line): Likewise.
2601         * strings.c (locfmt): Removed.
2602         (radix): New static enum.
2603         (parse_opt): Set radix, not locfmt.
2604         (process_chunk_mb): Use fmtstr directly as literal in printf based
2605         on radix.
2606         (process_chunk): Likewise.
2607         * nm.c (show_symbols_sysv): Use fmtstr directly as literal in printf.
2608         (show_symbols_bsd): Likewise.
2609         (show_symbols_posix): Likewise.
2610
2611 2014-01-21  Mark Wielaard  <mjw@redhat.com>
2612
2613         * stack.c (show_inlines): New static boolean.
2614         (print_frame): New function split out from...
2615         (print_frames): ..here. If show_inlines is true and we found a
2616         DIE for the frame address, call print_inline_frames otherwise
2617         call print_frame. Keep track of and track frame_nr.
2618         (print_inline_frames): New function.
2619         (parse_opt): Handle '-i'.
2620         (main): Add 'i' to options.
2621
2622 2014-01-27  Mark Wielaard  <mjw@redhat.com>
2623
2624         * stack.c (maxframes): Initialize to 256.
2625         (main): Document new default in options. Document magic number
2626         used in frames.allocated initialization.
2627
2628 2014-01-20  Mark Wielaard  <mjw@redhat.com>
2629
2630         * stack.c (show_debugname): New static boolean.
2631         (die_name): New function.
2632         (print_frames): If show_debugname is true set symname to the
2633         first function-like DIE with a name in scope for the address in
2634         the debuginfo.
2635         (parse_opt): Handle '-d'.
2636         (main): Add 'd' to options.
2637
2638 2014-01-20  Mark Wielaard  <mjw@redhat.com>
2639
2640         * addr2line.c (handle_address): Initialize scopes to NULL.
2641
2642 2014-01-17  Roland McGrath  <roland@redhat.com>
2643
2644         * strip.c (handle_elf): Check for bogus values in sh_link, sh_info,
2645         st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data.
2646         Don't use assert on input values, instead bail with "illformed" error.
2647
2648 2014-01-17  Roland McGrath  <roland@redhat.com>
2649
2650         * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link.
2651         (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise.
2652         (handle_scngrp): Check for bogus sh_info.
2653
2654 2014-01-17  Jakub Jelinek  <jakub@redhat.com>
2655
2656         * elflint.c (section_name): Return "<invalid>" instead of
2657         crashing on invalid section name.
2658         (check_symtab, is_rel_dyn, check_rela, check_rel, check_dynamic,
2659         check_symtab_shndx, check_hash, check_versym): Robustify.
2660         (check_hash): Don't check entries beyond end of section.
2661         (check_note): Don't crash if gelf_rawchunk fails.
2662
2663 2014-01-17  Petr Machata  <pmachata@redhat.com>
2664
2665         * readelf.c (handle_dynamic, handle_relocs_rel)
2666         (handle_relocs_rela, handle_versym, print_liblist):
2667         Use gelf_fsize instead of relying on shdr->sh_entsize.
2668
2669 2014-01-14  Mark Wielaard  <mjw@redhat.com>
2670
2671         * readelf.c (print_debug_macro_section): Clear vendor array before
2672         use.
2673
2674 2014-01-15  Jan Kratochvil  <jan.kratochvil@redhat.com>
2675
2676         Fix corruption of non-C++ symbols by the demangler.
2677         * nm.c (show_symbols_sysv, show_symbols_bsd, show_symbols_posix)
2678         (show_symbols): Check for _Z.
2679         * stack.c (print_frames) <USE_DEMANGLE>: Check for _Z.
2680
2681 2014-01-02  Mark Wielaard  <mjw@redhat.com>
2682
2683         * stack.c (show_raw): Declare unconditionally.
2684         (parse_opt): Handle '-r' unconditionally.
2685         (main): Show "raw" option even without USE_DEMANGLE.
2686
2687 2014-01-02  Mark Wielaard  <mjw@redhat.com>
2688
2689         * stack.c (print_frames): Print 0x before build-id hex-offset.
2690
2691 2014-01-02  Mark Wielaard  <mjw@redhat.com>
2692
2693         * stack.c (maxframes): Increase to 2048.
2694         (struct frames): Add allocated field.
2695         (frame_callback): If frames used is frames allocated, realloc.
2696         (print_frames): Show an error if maxframes has been reached.
2697         (parse_opt): Allow -n 0 for unlimited frames.
2698         (main): Document -n 0 and new default 2048 frames. Allocate initial
2699         number of frames with malloc.
2700
2701 2013-12-30  Mark Wielaard  <mjw@redhat.com>
2702
2703         * stack.c (parse_opt): Explicitly call dwfl_linux_proc_attach
2704         or dwfl_core_file_attach and check for errors.
2705
2706 2013-12-28  Mark Wielaard  <mjw@redhat.com>
2707
2708         * stack.c (print_frames): Remove address width code and use...
2709         (get_addr_width): ...this new function.
2710         (show_modules): New static boolean.
2711         (module_callback): New static function.
2712         (parse_opt): Handle '-l'.
2713         (main): Add 'l' to options. If show_modules then use dwfl_getmodules
2714         with module_callback to show all detected modules and possible
2715         build_id, elf and dwarf files.
2716
2717 2013-12-27  Mark Wielaard  <mjw@redhat.com>
2718
2719         * stack.c (frames_shown): New static boolean.
2720         (EXIT_OK,EXIT_ERROR,EXIT_BAD,EXIT_USAGES): New defines.
2721         (frame_callback): Return -1 on error. Don't print error.
2722         (print_frames): Add arguments, tid, dwflerr and what. Print tid.
2723         If there was an error report it with address and module if possible.
2724         Record whether any frames were actually printed.
2725         (thread_callback): Collect tid and err, pass it to print_frames.
2726         (parse_opt): Use EXIT_BAD for errors. On ARGP_KEY_END print errno
2727         if dwfl_linux_proc_report returned it. Check whether we are properly
2728         attached with dwfl_pid.
2729         (main): Document exit status. Don't report DWARF_CB_ABORT from
2730         callbacks as error. Pass real errors to print_frames. Return
2731         EXIT_BAD if no frames could be shown. Return EXIT_ERROR if there
2732         were any non-fatal errors.
2733
2734 2013-12-23  Mark Wielaard  <mjw@redhat.com>
2735
2736         * Makefile.am (stack_LDADD): Add demanglelib.
2737         * stack.c (show_quiet): New static boolean, default false.
2738         (show_raw): Likewise.
2739         (demangle_buffer_len): New static size_t.
2740         (demangle_buffer): New static char *.
2741         (print_frames): Don't resolve pc name if show_quiet. Demangle name
2742         unless show_raw.
2743         (parse_opt): Handle '-q' and '-r'.
2744         (main): Add 'q' and 'r' to options. Free demangle_buffer.
2745
2746 2013-12-23  Mark Wielaard  <mjw@redhat.com>
2747
2748         * stack.c (OPT_DEBUGINFO): New define.
2749         (OPT_COREFILE): Likewise.
2750         (pid): New static.
2751         (core_fd): Likewise.
2752         (core): Likewise.
2753         (exec): Likewise.
2754         (debuginfo_path): Likewise.
2755         (parse_opt): Handle '-p', '--core', '-e' and '--debuginfo-path'.
2756         Do argument sanity checking. Setup Dwfl.
2757         (main): Add 'p', 'core', 'e' and 'debuginfo-path' to options.
2758         Remove argp_child children, simplify argp doc, remove custom
2759         usage message and construction of dwfl with dwfl_standard_argp.
2760         Use pid directly as tid. close core and core_fd if opened. Print
2761         pid of process or core.
2762
2763 2013-12-23  Mark Wielaard  <mjw@redhat.com>
2764
2765         * stack.c (show_build_id): New static boolean.
2766         (print_frames): Print module build-id, load address and pc offset
2767         if show_build_id is true.
2768         (parse_opt): Handle '-b'.
2769         (main): Add -b to options.
2770
2771 2013-12-22  Mark Wielaard  <mjw@redhat.com>
2772
2773         * stack.c (maxframes): New static unsigned. Initialize to 64.
2774         (struct frame): New struct.
2775         (struct frames): Likewise.
2776         (dwfl): New static Dwfl pointer.
2777         (frame_callback): Use arg as struct frames and fill it next frame.
2778         Return DWARF_CB_ABORT when maxframes has been reached. Move
2779         printing of frame to...
2780         (print_frames): ...here. New function.
2781         (thread_callback): Use arg as struct frames and set frames to zero.
2782         Call print_frames.
2783         (parse_opt): Handle '-n'.
2784         (main): Add -n to options. Allocate frames using maxframes. Pass
2785         frames to frame_callback and thread_callback.
2786
2787 2013-12-20  Mark Wielaard  <mjw@redhat.com>
2788
2789         * stack.c (show_one_tid): New static boolean.
2790         (parse_opt): Handle '-1'.
2791         (main): Add -1 to options. Call dwfl_getthread_frames when
2792         show_one_tid is true.
2793
2794 2013-12-18  Mark Wielaard  <mjw@redhat.com>
2795
2796         * addr2line.c (options): Add symbol-sections, 'x'.
2797         (show_symbol_sections): New static bool.
2798         (parse_opt): Handle 'x'.
2799         (print_addrsym): Use dwfl_module_addrinfo value.r
2800         Also show section of address with show_symbol_sections.
2801         (find_symbol): Use dwfl_module_getsym_info and set value.
2802         (handle_address): Request value and use it instead of sym.st_value.
2803         * readelf.c (format_dwarf_addr): Use dwfl_module_addrinfo to get
2804         name and offset.
2805
2806 2013-12-17  Masatake YAMATO  <yamato@redhat.com>
2807             Mark Wielaard  <mjw@redhat.com>
2808
2809         * stack.c (show_activation, show_module, show_source): New variables.
2810         (parse_opt): Set show_activation if -a option is given.
2811         Set show_module if -m option is given. Set show_source if -s option
2812         is given. Set all show booleans when -v option is given.
2813         (main): Added `-a', `-m', `-s', and `-v' to the help message.
2814         (frame_callback): Print module and source file information.
2815
2816 2013-11-25  Petr Machata  <pmachata@redhat.com>
2817
2818         * elflint.c (valid_e_machine): Add EM_AARCH64.
2819
2820 2013-11-14  Petr Machata  <pmachata@redhat.com>
2821
2822         * readelf.c (handle_core_item) <'h'>: New branch for handling
2823         fields that shouldn't be displayed.
2824
2825 2013-11-10  Mark Wielaard  <mjw@redhat.com>
2826
2827         * stack.c: Use ARGP_PROGRAM_VERSION_HOOK_DEF and
2828         ARGP_PROGRAM_BUG_ADDRESS_DEF.
2829         (print_version): New function.
2830
2831 2013-11-09  Mark Wielaard  <mjw@redhat.com>
2832
2833         * arlib.c (arlib_init): Call snprintf before using the result
2834         with memcpy.
2835         (arlib_finalize): Likewise.
2836         * nm.c (show_symbols_sysv): Don't modify cnt inside assert.
2837
2838 2013-11-07  Jan Kratochvil  <jan.kratochvil@redhat.com>
2839
2840         * Makefile.am (bin_PROGRAMS): Add stack.
2841         (stack_LDADD): New.
2842         * stack.c: New file.
2843
2844 2013-11-05  Mark Wielaard  <mjw@redhat.com>
2845
2846         * readelf.c (print_debug_ranges_section): Cast address to size_t
2847         before comparison.
2848         (print_debug_loc_section): Likewise.
2849
2850 2013-10-18  Mark Wielaard  <mjw@redhat.com>
2851
2852         * ar.c (main): Correct operation check when instance_specifed is set.
2853
2854 2013-09-26  Petr Machata  <pmachata@redhat.com>
2855
2856         * readelf.c (handle_file_note): New function.
2857         (handle_notes_data): Call it to handle NT_FILE notes.
2858
2859 2013-09-26  Petr Machata  <pmachata@redhat.com>
2860
2861         * readelf.c (handle_siginfo_note): New function.
2862         (handle_notes_data): Call it to handle NT_SIGINFO notes.
2863         (buf_read_int, buf_read_ulong, buf_has_data): New functions.
2864
2865 2013-08-13  Mark Wielaard  <mjw@redhat.com>
2866
2867         * addr2line.c (options): Add "inlines", 'i'.
2868         (show_inlines): New bool.
2869         (parse_opt): Handle 'i'.
2870         (print_diesym): New static function.
2871         (print_src): New function taking code from...
2872         (handle_address): here. Call print_src. Print inlines.
2873
2874 2013-08-12  Mark Wielaard  <mjw@redhat.com>
2875
2876         * addr2line.c (main): If there is a newline char at end of buf,
2877         then remove it.
2878
2879 2013-07-05  Mark Wielaard  <mjw@redhat.com>
2880
2881         * readelf.c (print_ops): Take CU as argument, use it to print
2882         parameter_ref DIE offset.
2883         (struct listptr): Replace base field with cu.
2884         (listptr_base): New function.
2885         (compare_listptr): Use listptr_base.
2886         (notice_listptr): Take CU as argument.
2887         (skip_listptr_hole): Likewise.
2888         (print_debug_ranges_section): Pass NULL as CU to skip_listptr_hole.
2889         (print_cfa_program): Pass NULL as CU to print_ops.
2890         (struct attrcb_args): Replace cu_base field with cu.
2891         (attr_callback): Pass cu not cu_base to notice_listptr.
2892         (print_debug_units): Don't calculate base, just set cu.
2893         (print_debug_loc_section): Pass cu to skip_listptr_hole and
2894         print_ops.
2895
2896 2013-05-06  Mark Wielaard  <mjw@redhat.com>
2897
2898         * readelf.c (print_ops): Format first DW_OP_GNU_implicit_pointer
2899         argument as DIE offset.
2900
2901 2013-04-24  Mark Wielaard  <mjw@redhat.com>
2902
2903         * Makefile.am: Use AM_CPPFLAGS instead of INCLUDES.
2904
2905 2013-03-25  Mark Wielaard  <mjw@redhat.com>
2906
2907         * readelf.c (argp_options): Add decodedline.
2908         (decodedline): New boolean initialized to false.
2909         (parse_opt): Set decodedline when arg is decodedline.
2910         (print_decoded_line_section): New function.
2911         (print_debug_line_section): Call print_decoded_line_section when
2912         decodedline is true.
2913
2914 2013-03-25  Mark Wielaard  <mjw@redhat.com>
2915
2916         * readelf.c (argp_option): Add decodedaranges.
2917         (decodedaranges): New boolean initialized to false.
2918         (parse_opt): Set decodedaranges when arg is decodedaranges.
2919         (print_debug_aranges_section): Reimplemented and original
2920         implementation renamed to...
2921         (print_decoded_aranges_section): this.
2922
2923 2013-03-25  Mark Wielaard  <mjw@redhat.com>
2924
2925         * readelf.c (attrcb_args): Add Dwarf_Die.
2926         (attr_callback): When highpc is in constant form also print as
2927         address.
2928         (print_debug_units): Set args.die.
2929
2930 2013-03-19  Mark Wielaard  <mjw@redhat.com>
2931
2932         * readelf.c (print_gdb_index_section): Free format_dwarf_addr results.
2933
2934 2013-03-18  Mark Wielaard  <mjw@redhat.com>
2935
2936         * readelf.c (print_gdb_index_section): Accept version 8.
2937
2938 2013-03-01  Mark Wielaard  <mjw@redhat.com>
2939
2940         * findtextrel.c (process_file): Release ELF and close file when not
2941         text relocations are found.
2942         * strip.c (handle_elf): Track memory used for .debuglink section data
2943         and free when done.
2944
2945 2013-02-24  Mark Wielaard  <mjw@redhat.com>
2946
2947         * elflint.c (check_symtab): Add __bss_start__ to the list of symbols
2948         allowed to have out of section values because of GNU ld bugs.
2949
2950 2013-02-06  Mark Wielaard  <mjw@redhat.com>
2951
2952         * elflint.c (check_symtab): Add __bss_start and __TMC_END__ to the
2953         list of symbols allowed to have out of section values because of
2954         GNU ld bugs in either .symtab or .dynsym, but only when they are
2955         zero sized.
2956
2957 2013-01-24  Mark Wielaard  <mjw@redhat.com>
2958
2959         * readelf.c (argp_option): Add unresolved-address-offsets, U.
2960         (print_unresolved_addresses): New static.
2961         (parse_opt): Handle 'U', set print_unprocessed_values.
2962         (format_dwarf_addr): Take and handle new raw argument.
2963         (print_ops): Call format_dwarf_addr with raw offset values.
2964         (print_debug_ranges_section): Likewise.
2965         (print_debug_frame_section): Likewise.
2966         (attr_callback): Likewise.
2967         (print_debug_line_section): Likewise.
2968         (print_debug_loc_section): Likewise.
2969         (print_gdb_index_section): Likewise.
2970
2971 2013-01-18  Mark Wielaard  <mjw@redhat.com>
2972
2973         * readelf.c (struct listptr): Add base Dwarf_Addr field.
2974         (compare_listptr): Warn for same offset with different base.
2975         (notice_listptr): Take base argument and set it.
2976         (skip_listptr_hole): Likewise.
2977         (struct attrcb_args): Removed unused cu_offset field.
2978         Add cu_base Dwarf_Addr field.
2979         (attr_callback): Call notice_listptr with cbargs->cu_base.
2980         (print_debug_units): Set args.cu_base.
2981         (print_debug_ranges_section): Get base and use for format_dwarf_addr.
2982         (print_debug_loc_section): Likewise.
2983
2984 2013-01-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
2985
2986         * readelf.c (handle_core_items): Limit special repeated items handling
2987         to single-item formats '\n', 'b' and 'B', assert OFFSET 0 there.
2988
2989 2012-12-18  Mark Wielaard  <mark@bordewijk.wildebeest.org>
2990
2991         * readelf.c (ELF_INPUT_SECTION): New argp key value.
2992         (argp_option): Add elf-section.
2993         (elf_input_section): New static.
2994         (parse_opt): Handle ELF_INPUT_SECTION and set elf_input_section.
2995         (open_input_section): New function.
2996         (process_file): Call open_input_section if elf_input_section set.
2997
2998 2013-01-13  David Abdurachmanov  <David.Abdurachmanov@cern.ch>
2999
3000         ar.c (do_oper_delete): Fix num passed to memset.
3001
3002 2012-12-21  Mark Wielaard  <mjw@redhat.com>
3003
3004         * readelf.c (print_debug_frame_section): Adjust FDE start address
3005         if pcrel before feeding it to format_dwarf_addr.
3006
3007 2012-12-21  Mark Wielaard  <mjw@redhat.com>
3008
3009         * addr2line.c (main): Call dwfl_end.
3010
3011 2012-12-11  Roland McGrath  <roland@hack.frob.com>
3012
3013         * nm.c (show_symbols_sysv): Fix size passed to snprintf for invalid
3014         sh_name case.
3015         Reported by David Abdurachmanov <David.Abdurachmanov@cern.ch>.
3016
3017 2012-10-16  Mark Wielaard  <mjw@redhat.com>
3018
3019         * readelf.c (print_ops): DW_OP_skip and DW_OP_bra targets are
3020         calculated beginning after the operand and 2-byte constant.
3021
3022 2012-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>
3023
3024         * readelf.c (ITEM_WRAP_COLUMN, REGISTER_WRAP_COLUMN): Merge to ...
3025         (WRAP_COLUMN): ... here.
3026         (print_core_item): Remove parameter format_max.  Update function
3027         comment.  Replace FORMAT_MAX by the real output width.
3028         (handle_core_item): Remove the FORMAT_MAX values in TYPES, DO_TYPE,
3029         calls of print_core_item, remove variable maxfmt, change
3030         ITEM_WRAP_COLUMN to WRAP_COLUMN.
3031         (handle_core_register): Remove the FORMAT_MAX values in TYPES, BITS,
3032         calls of print_core_item, change REGISTER_WRAP_COLUMN to WRAP_COLUMN.
3033
3034 2012-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
3035
3036         * readelf.c (handle_core_item) <b>: Make run an outer block variable.
3037         Increase run only if LASTBIT != 0.  Print last element only if RUN > 0.
3038
3039 2012-08-27  Mark Wielaard  <mjw@redhat.com>
3040
3041         * readelf.c (print_debug_macro_section): Print offset as PRIx64.
3042
3043 2012-08-27  Mark Wielaard  <mjw@redhat.com>
3044
3045         * readelf.c (register_info): Handle loc == NULL.
3046
3047 2012-08-22  Jeff Kenton  <jkenton@tilera.com>
3048
3049         * elflint.c (valid_e_machine): Add EM_TILEGX and EM_TILEPRO.
3050
3051 2012-08-16  Mark Wielaard  <mjw@redhat.com>
3052
3053         * readelf.c (dwarf_tag_name): Renamed from dwarf_tag_string.
3054         Uses new dwarf_tag_string or adds ??? or lo_user+%#x when
3055         appropriate.
3056         (dwarf_attr_name): Likewise.
3057         (dwarf_form_name): Likewise.
3058         (dwarf_lang_name): Likewise.
3059         (dwarf_inline_name): Likewise.
3060         (dwarf_encoding_name): Likewise.
3061         (dwarf_access_name): Likewise.
3062         (dwarf_visibility_name): Likewise.
3063         (dwarf_virtuality_name): Likewise.
3064         (dwarf_identifier_case_name): Likewise.
3065         (dwarf_calling_convention_name): Likewise.
3066         (dwarf_ordering_name): Likewise.
3067         (dwarf_discr_list_name): Likewise.
3068         (print_ops): Remove KNOWN.  Use dwarf_locexpr_opcode_string.
3069         (attr_callback): Call new dwarf_foobar_name instead of old
3070         dwarf_foobar_string functions.
3071         (dwarf_tag_string): New function using known-dwarf.h macros.
3072         (dwarf_attr_string): Likewise.
3073         (dwarf_form_string): Likewise.
3074         (dwarf_lang_string): Likewise.
3075         (dwarf_inline_string): Likewise.
3076         (dwarf_encoding_string): Likewise.
3077         (dwarf_access_string): Likewise.
3078         (dwarf_visibility_string): Likewise.
3079         (dwarf_virtuality_string): Likewise.
3080         (dwarf_identifier_case_string): Likewise.
3081         (dwarf_calling_convention_string): Likewise.
3082         (dwarf_ordering_string): Likewise.
3083         (dwarf_discr_list_string): Likewise.
3084         (dwarf_locexpr_opcode_string): Likewise.
3085
3086 2012-06-27  Mark Wielaard  <mjw@redhat.com>
3087
3088         * readelf.c (dwarf_form_string): Handle DW_FORM_GNU_ref_alt and
3089         DW_FORM_GNU_strp_alt.
3090         (attr_callback): Likewise.
3091
3092 2012-07-30  Petr Machata  <pmachata@redhat.com>
3093
3094         * nm.c (show_symbols_bsd): Reorder arguments in {S,}FMTSTRS (and
3095         corresponding printf) so that those that are referenced by only
3096         one of the formatting strings are at the end.
3097
3098 2012-07-29  Mark Wielaard  <mjw@redhat.com>
3099
3100         * readelf.c (dwarf_lang_string): Use DW_LANG_ObjC, not DW_LANG_Objc.
3101         (print_ops): Use known[op], not op_name, for DW_OP_GNU_parameter_ref.
3102
3103 2012-07-19  Mark Wielaard  <mjw@redhat.com>
3104
3105         * readelf.c (print_ops): Handle DW_OP_GNU_parameter_ref.
3106
3107 2012-07-11  Mark Wielaard  <mjw@redhat.com>
3108
3109         * readelf.c (options): Add macro to help of debug-dump.
3110         (section_e): Add section_macro.
3111         (section_all): Add section_macro.
3112         (parse_opt): Handle macro.
3113         (print_debug_macro_section): New function.
3114         (print_debug): Add NEW_SECTION (macro).
3115
3116 2012-07-10  Mark Wielaard  <mjw@redhat.com>
3117
3118         * readelf.c (print_gdb_index_section): Add version 7 support.
3119         Keep track of cu_nr. Print kind and static/global flag for each
3120         symbol. When a symbol is in the TU list add 'T'.
3121
3122 2012-06-26  Mark Wielaard  <mjw@redhat.com>
3123
3124         * readelf.c (dwarf_attr_string): Add DW_AT_GNU_macros.
3125
3126 2012-06-22  Mark Wielaard  <mjw@redhat.com>
3127
3128         * readelf.c (print_ops): Cast printf PRIu/x64 arguments to uint64_t
3129         for gcc 4.7 -Wformat.
3130
3131 2012-05-09  Roland McGrath  <roland@hack.frob.com>
3132
3133         * elflint (check_sections): Allow zero sized sections at (filesz) end
3134         of segment. And make check overflow-proofed.
3135
3136 2012-04-24  Mark Wielaard  <mjw@redhat.com>
3137
3138         * readelf.c (print_ops): Add DW_OP_GNU_push_tls_address,
3139         DW_OP_GNU_uinit and DW_OP_GNU_encoded_addr.
3140
3141 2012-03-28  Roland McGrath  <roland@hack.frob.com>
3142
3143         * elflint.c (special_sections): Accept SHF_INFO_LINK for reloc sections.
3144
3145 2012-03-28  Mark Wielaard  <mjw@redhat.com>
3146
3147         * readelf.c (print_debug_abbrev_section): Check there is Dwarf
3148         section data.
3149         (print_debug_str_section): Likewise.
3150
3151 2012-03-21  Mark Wielaard  <mjw@redhat.com>
3152
3153         * readelf.c (print_gdb_index_section): Accept version 6.
3154
3155 2012-01-31  Mark Wielaard  <mjw@redhat.com>
3156
3157         * readelf.c (attr_callback): Don't special case DW_FORM_sec_offset.
3158
3159 2012-01-21  Ulrich Drepper  <drepper@gmail.com>
3160
3161         * addr2line.c: Update copyright year.
3162         * ar.c: Likewise.
3163         * elfcmp.c: Likewise.
3164         * elflint.c: Likewise.
3165         * findtextrel.c: Likewise.
3166         * ld.c: Likewise.
3167         * nm.c: Likewise.
3168         * objdump.c: Likewise.
3169         * ranlib.c: Likewise.
3170         * readelf.c: Likewise.
3171         * size.c: Likewise.
3172         * strings.c: Likewise.
3173         * strip.c: Likewise.
3174         * unstrip.c: Likewise.
3175
3176         * nm.c (argp_children): Define.
3177         (argp): Hook up argp_children.
3178         (handle_ar): Optimize puts call.
3179         (show_symbols_bsd): Use positional parameters to also print color
3180         codes.  Don't print STT_FILE symbols.
3181         * objdump.c (options): Improve help text.
3182         (argp_children): Define.
3183         (argp): Hook up argp_children.
3184         (disasm_info): Add elements for color codes.
3185         (disasm_output): Print color codes as well.
3186         (show_disasm): Set up disasm_info data for callback.
3187
3188 2012-01-20  Roland McGrath  <roland@hack.frob.com>
3189
3190         * arlib-argp.c (arlib_deterministic_output): Initialize from
3191         configured value.
3192         (help_filter): New function.
3193         (argp): Use it.
3194
3195         * ar.c (main): Handle oper_none as usage error.
3196
3197         * arlib-argp.c (options, parse_opt): Grok -U as inverse of -D.
3198
3199         * ranlib.c (argp): Use arlib_argp_children.
3200
3201         * arlib.c (arlib_init): Obey arlib_deterministic_output.
3202
3203         * arlib-argp.c: New file.
3204         * Makefile.am (libar_a_SOURCES): Add it.
3205         * arlib.h (arlib_deterministic_output, arlib_argp_children):
3206         Declare new variables.
3207         * ar.c (deterministic_output): Variable removed.
3208         (do_oper_insert): Use arlib_deterministic_output instead.
3209         (options, parse_opt): Don't handle -D here.  Add group numbers.
3210         (argp): Use arlib_argp_children.
3211
3212 2011-12-20  Roland McGrath  <roland@hack.frob.com>
3213
3214         * readelf.c (print_debug): Initialize DUMMY_DBG.elf.
3215         Reported by Karel Klic <kklic@redhat.com>.
3216
3217 2011-11-05  Roland McGrath  <roland@hack.frob.com>
3218
3219         * ar.c (deterministic_output): New flag variable.
3220         (options, parse_opt): Grok -D to set it.
3221         (do_oper_insert): When set, use zero from mtime, uid, and gid.
3222
3223         * ar.c (do_oper_insert): Fix check on elf_rawfile return value.
3224
3225 2011-10-04  Marek Polacek  <mpolacek@redhat.com>
3226
3227         * readelf.c (register_info): Assume the right size of an array.
3228
3229 2011-10-03  Ulrich Drepper  <drepper@gmail.com>
3230
3231         * nm.c: Recognize option --mark-special.  Still recognize --mark-weak
3232         but don't show it in help anymore.
3233         (mark_special): Renamed from mark_weak.
3234         (parse_opt): Adjust.
3235         (class_type_char): Take additional parameters for ELF file and ELF
3236         header.  Treat TLS symbols like objects.
3237         In case of D symbols, show u for unique symbols, R for symbols in
3238         read-only sections, B for symbols in BSS sections.
3239         (show_symbols_bsd): Take additional parameters for ELF file and ELF
3240         header.  Adjust for class_type_char change.  Show TLS symbols with
3241         @ after them in case --mark-special is selected.
3242         (show_symbols_posix): Likewise.
3243         (show_symbols): Adjust calls to show_symbols_bsd and
3244         show_symbols_posix.
3245         (show_symbols_sysv): Avoid printing address and size for undefined
3246         symbols.  Don't print initial special entry and section entries.
3247
3248 2011-10-02  Ulrich Drepper  <drepper@gmail.com>
3249
3250         * Makefile.am (demanglelib): Define.
3251         (nm_LDADD): Add demanglelib.
3252         * nm.c (options): Add -C option.
3253         (demangle): Define as global variable.
3254         (parse_opt): Recognize -C.
3255         (show_symbols_sysv): Handle demangling.
3256         (show_symbols_bad): Likewise.
3257         (show_symbols_posix): Likewise.
3258         (show_symbols): Likewise.
3259
3260 2011-07-09  Roland McGrath  <roland@hack.frob.com>
3261
3262         * readelf.c (options, parse_opt): Grok -W/--wide and ignore it.
3263
3264         * ar.c (parse_opt): Grok -u.
3265
3266 2011-05-30  Mark Wielaard  <mjw@redhat.com>
3267
3268         * strip.c (relocate): Make offset check overflow-proof.
3269
3270 2011-05-23  Mark Wielaard  <mjw@redhat.com>
3271
3272         * strip.c (relocate): Take new arguments is_rela to indicate
3273         whether the relocation is from a SHT_REL or SHT_RELA section.
3274         Relocate against any debug section symbol, not just STT_SECTION
3275         symbols. For SHT_REL relocations, fetch addend from offset and
3276         add it to symbol value if not zero.
3277
3278 2011-05-23  Mark Wielaard  <mjw@redhat.com>
3279
3280         * strip.c (OPT_RELOC_DEBUG): New option.
3281         (argp_option): Add new --reloc-debug-sections option.
3282         (main): Check new option.
3283         (parse_opt): Likewise.
3284         (handle_elf): Remove any relocations between debug sections
3285         in ET_REL for the debug file when requested.
3286
3287 2011-05-18  Mark Wielaard  <mjw@redhat.com>
3288
3289         * strip.c (handle_elf): Make sure all sections of a removed group
3290         section are removed too. Don't discard SHT_GROUP sections, copy
3291         section table before it gets modified. Section group signature
3292         symbols don't have to be retained.
3293
3294 2011-05-16  Jakub Jelinek  <jakub@redhat.com>
3295
3296         * readelf.c (print_ops): Handle DW_OP_GNU_const_type,
3297         DW_OP_GNU_regval_type, DW_OP_GNU_deref_type, DW_OP_GNU_convert
3298         and DW_OP_GNU_reinterpret.
3299
3300 2011-05-17  Mark Wielaard  <mjw@redhat.com>
3301
3302         * readelf.c (dwarf_tag_string): Fixup DW_TAG_GNU_call_site and
3303         DW_TAG_GNU_call_site_parameter return strings.
3304
3305 2011-05-11  Marek Polacek  <mpolacek@redhat.com>
3306
3307         * nm.c (show_symbols_sysv): Remove unused if/else, remove
3308         unused `prefix' and `fname' parameters.
3309
3310 2011-05-07  Marek Polacek  <mpolacek@redhat.com>
3311
3312         * unstrip.c (compare_sections_nonrel): Mark this function as static.
3313
3314 2011-04-26  Mark Wielaard  <mjw@redhat.com>
3315
3316         * readelf.c (handle_notes_data): Call ebl_object_note_type_name
3317         with note name.
3318
3319 2011-04-14  Mark Wielaard  <mjw@redhat.com>
3320
3321         * readelf.c (options): Add gdb_index.
3322         (section_e): Define section_gdb_index.
3323         (parse_opt): Recognize gdb_index debug-dump argument.
3324         (print_gdb_index_section): New function.
3325         (print_debug): Add gdb_index to debug_sections.
3326
3327 2011-03-24  Petr Machata  <pmachata@redhat.com>
3328
3329         * readelf.c (print_debug_line_section): Emit initial space for all
3330         opcode lines.  Print offset in front of each opcode.
3331
3332 2011-03-22  Marek Polacek  <mpolacek@redhat.com>
3333
3334         * readelf.c (handle_dynamic): Don't segfault at DT_PLTREL case.
3335
3336 2011-03-22  Mark Wielaard  <mjw@redhat.com>
3337
3338         * readelf.c (dwarf_tag_string): Support DW_TAG_GNU_call_site
3339         and DW_TAG_GNU_call_site_parameter.
3340         (dwarf_attr_string): Support DW_AT_GNU_call_site_value,
3341         DW_AT_GNU_call_site_data_value,
3342         DW_AT_GNU_call_site_target,
3343         DW_AT_GNU_call_site_target_clobbered,
3344         DW_AT_GNU_tail_call,
3345         DW_AT_GNU_all_tail_call_sites,
3346         DW_AT_GNU_all_call_sites,
3347         and DW_AT_GNU_all_source_call_sites.
3348         (print_ops): Handle DW_OP_GNU_entry_value.
3349         (attr_callback): Handle DW_AT_GNU_call_site_value,
3350         DW_AT_GNU_call_site_data_value,
3351         DW_AT_GNU_call_site_target,
3352         and DW_AT_GNU_call_site_target_clobbered.
3353
3354 2011-03-10  Mark Wielaard  <mjw@redhat.com>
3355
3356         * elflint.c (check_symtab): Use ebl_check_st_other_bits.
3357
3358 2011-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
3359
3360         * readelf.c (reset_listptr): Clear TABLE->TABLE.
3361
3362 2011-02-25  Mark Wielaard  <mjw@redhat.com>
3363
3364         * readelf.c (dwarf_attr_string): Add DW_AT_GNU_* handling.
3365         (dwarf_form_string): Properly format and return unknown form.
3366
3367 2011-02-23  Roland McGrath  <roland@redhat.com>
3368
3369         * readelf.c (section_name): New function.
3370         (print_debug_abbrev_section): Use it instead of constant.
3371         (print_debug_aranges_section): Likewise.
3372         (print_debug_ranges_section): Likewise.
3373         (print_debug_units): Likewise.
3374         (print_debug_line_section): Likewise.
3375         (print_debug_loc_section): Likewise.
3376         (print_debug_macinfo_section): Likewise.
3377         (print_debug_pubnames_section): Likewise.
3378         (print_debug_str_section): Likewise.
3379         (print_debug) [USE_ZLIB]: Match .zdebug_* sections too.
3380         (print_debug_abbrev_section): Use decoded d_size, not sh_size.
3381         (print_debug_str_section): Likewise.
3382
3383         * readelf.c (dwarf_attr_string): Grok DW_AT_GNU_odr_signature.
3384
3385 2011-02-11  Roland McGrath  <roland@redhat.com>
3386
3387         * elfcmp.c (verbose): New variable.
3388         (options, parse_opt): Grok -l/--verbose to set it.
3389         (main): Under -l, keep going after first difference.
3390
3391         * elfcmp.c (ignore_build_id): New variable.
3392         (options, parse_opt): Grok --ignore-build-id to set it.
3393         (main): For SHT_NOTE sections, compare note details rather than raw
3394         bytes.  Under --ignore-build-id, don't complain about differing build
3395         ID contents if lengths match.
3396
3397 2011-02-08  Roland McGrath  <roland@redhat.com>
3398
3399         * ldscript.y (filename_id_star): Remove unused variable.
3400
3401         * unstrip.c (copy_elided_sections): Remove unused variable.
3402
3403         * elflint.c (check_dynamic): Remove unused variables.
3404
3405         * elflint.c (check_symtab): Warn about missing xndx section only once.
3406
3407         * ldgeneric.c (check_for_duplicate2): Remove unused variable.
3408
3409 2011-01-06  Roland McGrath  <roland@redhat.com>
3410
3411         * strip.c (handle_elf): Under --strip-sections, remove all
3412         non-allocated sections and never generate .gnu_debuglink.
3413
3414 2011-01-04  Roland McGrath  <roland@redhat.com>
3415
3416         * strip.c (remove_shdrs): New variable.
3417         (options, parse_opt): Grok --strip-sections to set it.
3418         (handle_elf): When that's set, truncate off .shstrtab and shdrs.
3419
3420 2010-11-10  Roland McGrath  <roland@redhat.com>
3421
3422         * findtextrel.c (process_file): Don't assume order of sections.
3423         Reported by Mike Hommey <mh@glandium.org>.
3424
3425 2010-07-26  Roland McGrath  <roland@redhat.com>
3426
3427         * readelf.c (print_ops): Handle DW_OP_GNU_implicit_pointer.
3428
3429 2010-08-30  Roland McGrath  <roland@redhat.com>
3430
3431         Print .debug_loc/.debug_ranges with cognizance of actual DIE uses.
3432         * readelf.c (parse_opt): Add section_info to implicit_debug_sections
3433         for ranges, loc.
3434         (struct listptr, struct listptr_table): New types.
3435         (compare_listptr, reset_listptr, sort_listptr): New functions.
3436         (notice_listptr, skip_listptr_hole): New functions.
3437         (struct attrcb_args): Add silent member.
3438         (attr_callback): Call notice_listptr for loclistptr and rangelistptr.
3439         Suppress output if silent, but still call notice_listptr.
3440         (print_debug_units): Suppress output if section_info not requested.
3441         (print_debug_loc_section): Call sort_listptr, skip_listptr_hole.
3442         (print_debug_ranges_section): Likewise.
3443         (print_debug): Call reset_listptr on both tables.
3444
3445         * readelf.c (print_debug_ranges_section): Print empty list.
3446         (print_debug_loc_section): Likewise.
3447
3448         * readelf.c (print_debug_loc_section): Check for bogus length
3449         before calling print_ops.
3450         (print_ops): Check harder for bogus data that would read off end.
3451
3452 2010-08-11  Roland McGrath  <roland@redhat.com>
3453
3454         * readelf.c (for_each_section_argument): Process all sections with
3455         matching name, not just the first.
3456
3457 2010-07-26  Roland McGrath  <roland@redhat.com>
3458
3459         * readelf.c (print_ops): Take new argument for CU version.
3460         Fix DW_OP_call_ref decoding to depend on it.
3461         (print_debug_loc_section): Update caller.
3462         (print_cfa_program): Take new argument, pass it down.
3463         (print_debug_frame_section): Update caller.
3464         (struct attrcb_args): New member version.
3465         (print_debug_units): Initialize it.
3466
3467 2010-07-02  Roland McGrath  <roland@redhat.com>
3468
3469         * readelf.c (print_debug_frame_section): Use format_dwarf_addr for
3470         initial_location.
3471
3472 2010-06-30  Roland McGrath  <roland@redhat.com>
3473
3474         * strings.c (main): Use STDIN_FILENO, not STDOUT_FILENO.
3475         Ignore st_size for a non-S_ISREG file descriptor.
3476         (read_block): Move assert after no-mmap bail-out.
3477         (read_block_no_mmap): Fix size calculations for moving buffer remnant.
3478
3479 2010-06-22  Roland McGrath  <roland@redhat.com>
3480
3481         * readelf.c (print_debug_line_section): Fix braino in DW_LNS_set_isa.
3482
3483 2010-06-21  Roland McGrath  <roland@redhat.com>
3484
3485         * readelf.c (dwarf_tag_string): Handle new v4 tags.
3486         (dwarf_attr_string): Add new attributes.
3487         (dwarf_tag_string): Handle DW_TAG_GNU_*.
3488
3489         * readelf.c (print_ops): Use 64-bit types for LEB128 operands.
3490         (print_cfa_program): Likewise.
3491
3492 2010-06-20  Roland McGrath  <roland@redhat.com>
3493
3494         * readelf.c (print_debug_units): New function, broken out of ...
3495         (print_debug_info_section): ... here.  Call it.
3496         (print_debug_types_section): New function.
3497         (enum section_e): Add section_types alias for section_info.
3498         (print_debug): Add types to the sections table.
3499
3500         * readelf.c (print_debug_frame_section): Handle version 4 format.
3501
3502         * readelf.c (print_debug_line_section): Handle version 4 format.
3503
3504 2010-06-14  Roland McGrath  <roland@redhat.com>
3505
3506         * unstrip.c (copy_elided_sections): Make sure all sections' data have
3507         been read in before we write anything out.
3508
3509 2010-06-04  Roland McGrath  <roland@redhat.com>
3510
3511         * unstrip.c (update_shdr): New function.
3512         (update_sh_size): Call it instead of gelf_update_shdr.
3513         (adjust_relocs, add_new_section_symbols): Likewise.
3514         (new_shstrtab, copy_elided_sections): Likewise.
3515
3516         * unstrip.c (copy_elided_sections): Bail if stripped file has more
3517         sections than unstripped file, rather than getting confused later.
3518
3519 2010-06-01  Roland McGrath  <roland@redhat.com>
3520
3521         * readelf.c (dwarf_form_string): Handle DWARF 4 forms.
3522         (attr_callback): Handle DW_FORM_flag_present, DW_FORM_exprloc,
3523         DW_FORM_sec_offset, DW_FORM_ref_sig8.
3524
3525         * readelf.c (print_debug): Don't bail if libdw setup fails.
3526         Suppress complaint if we only want .eh_frame anyway.
3527
3528 2010-05-28  Ulrich Drepper  <drepper@redhat.com>
3529
3530         * readelf.c (attr_callback): Also print form information.
3531
3532 2010-05-19  Roland McGrath  <roland@redhat.com>
3533
3534         * addr2line.c (find_symbol): Short-circuit on empty name.
3535         (handle_address): Handle SYMBOL with no +OFFSET.
3536
3537 2010-05-08  Roland McGrath  <roland@redhat.com>
3538
3539         * readelf.c (print_ops): Take new arg OFFSET_SIZE.
3540         Use that for DW_OP_call_ref, not ADDRSIZE.
3541         (print_cfa_program): Update caller.
3542         (struct attrcb_args): Add offset_size field.
3543         (attr_callback): Use it for print_ops call.
3544         (print_debug_info_section): Initialize it.
3545         (print_ops): Likewise.
3546
3547 2010-04-14  Roland McGrath  <roland@redhat.com>
3548
3549         * readelf.c (handle_core_item): Fix bitmask printing.
3550
3551 2010-04-06  Roland McGrath  <roland@redhat.com>
3552
3553         * ld.c (options): Fix some typos in messages.
3554         * elflint.c (check_scn_group, check_group): Likewise.
3555         * ldscript.y (add_id_list): Likewise.
3556         * readelf.c (print_hash_info): Add xgettext:no-c-format magic comment
3557         before translated string containing a literal %.
3558
3559 2010-02-26  Roland McGrath  <roland@redhat.com>
3560
3561         * readelf.c (process_file): Don't leak an fd in failure case.
3562
3563 2010-02-15  Roland McGrath  <roland@redhat.com>
3564
3565         * Makefile.am: Use config/eu.am for common stuff.
3566
3567         * readelf.c (print_debug_frame_section): Add a cast to avoid sign
3568         mismatch in comparison.
3569
3570 2010-02-02  Roland McGrath  <roland@redhat.com>
3571
3572         * readelf.c (print_encoding_base): Handle DW_EH_PE_absptr (zero).
3573         (read_encoded): Likewise.
3574         (print_debug_frame_section): Check for bogus augmentation length.
3575         For P augmentation, use read_encoded, print the encoding description,
3576         and use hex for unsigned values.
3577
3578 2010-01-15  Roland McGrath  <roland@redhat.com>
3579
3580         * ar.c: Include <sys/stat.h>.
3581         * elflint.c: Likewise.
3582         * readelf.c: Likewise.
3583         * strip.c: Likewise.
3584         * unstrip.c: Likewise
3585
3586 2010-01-07  Roland McGrath  <roland@redhat.com>
3587
3588         * readelf.c (print_ehdr): Handle PN_XNUM.
3589         (phnum): New static variable.
3590         (process_elf_file): Set it with elf_getphdrnum.
3591         (print_phdr): Use phnum instead of EHDR->e_phnum.
3592         (print_dynamic, handle_notes): Likewise.
3593         (handle_relocs_rel, handle_relocs_rela): Likewise.
3594
3595         * elfcmp.c (main): Use elf_getshdrnum and elf_getphdrnum.
3596
3597         * elflint.c (phnum): New static variable.
3598         (check_elf_header): Set it, handling PN_XNUM.
3599         Use that in place of EHDR->e_phnum throughout.
3600         (check_symtab, check_reloc_shdr, check_dynamic): Likewise.
3601         (unknown_dependency_p, check_sections, check_program_header): Likewise.
3602
3603 2010-01-05  Roland McGrath  <roland@redhat.com>
3604
3605         * readelf.c (dwarf_attr_string): Match DW_AT_GNU_vector and
3606         DW_AT_GNU_template_name.
3607
3608 2010-01-04  Roland McGrath  <roland@redhat.com>
3609
3610         * readelf.c (handle_notes_data): Grab NT_AUXV only for name "CORE".
3611         (handle_core_note): Pass NHDR and NAME to ebl_core_note.
3612         (handle_core_item): Handle .format of '\n' as \n-separated strings.
3613
3614         * readelf.c (implicit_debug_sections): New variable.
3615         (parse_opt): Set it instead of print_debug_sections for -a.
3616         OR them together for print_debug check.
3617         (print_debug): OR them together for section check.
3618
3619         * readelf.c (options): Repartition into set implied by -a and others.
3620         Correct -a text to match reality.
3621
3622         * readelf.c (struct section_argument): Add bool member 'implicit'.
3623         (parse_opt): Set it for -a cases, clear it for -x args.
3624         (for_each_section_argument): Don't complain about a missing section by
3625         name if it's implicit.
3626
3627 2009-11-16  Roland McGrath  <roland@redhat.com>
3628
3629         * readelf.c (print_string_section): Punt SHT_NOBITS like empty
3630         sections, just as dump_data_section already does.
3631
3632 2009-09-21  Ulrich Drepper  <drepper@redhat.com>
3633
3634         * elflint.c (special_sections): Allow MERGE and STRINGS flags to be
3635         set for .comment section.
3636         Patch by Mark Wielaard <mjw@redhat.com>.
3637
3638 2009-09-08  Roland McGrath  <roland@redhat.com>
3639
3640         * ar.c (main): Fix typo in message format.
3641
3642 2009-08-21  Roland McGrath  <roland@redhat.com>
3643
3644         * readelf.c (attr_callback): Use print_block only when we don't use
3645         print_ops.
3646
3647 2009-08-14  Roland McGrath  <roland@redhat.com>
3648
3649         * ar.c (do_oper_extract): Use pathconf instead of statfs.
3650
3651 2009-08-01  Ulrich Drepper  <drepper@redhat.com>
3652
3653         * debugpred.h: Add two most const.
3654
3655 2009-07-26  Mark Wielaard  <mjw@redhat.com>
3656
3657         * elflint.c (check_note_data): Recognize NT_GNU_GOLD_VERSION.
3658
3659 2009-07-25  Mark Wielaard  <mjw@redhat.com>
3660
3661         * Makefile.am (addr2line_LDADD): Add $(libelf).
3662
3663 2009-07-24  Roland McGrath  <roland@redhat.com>
3664
3665         * readelf.c (print_block): New function.
3666         (print_ops): Use it.
3667         (attr_callback): Use it for DW_FORM_block* forms.
3668
3669 2009-07-20  Mark Wielaard  <mjw@redhat.com>
3670
3671         * readelf.c (print_ops): Add handling of DW_OP_implicit_value
3672         and DW_OP_stack_value.
3673
3674 2009-07-14  Ulrich Drepper  <drepper@redhat.com>
3675
3676         * elflint.c (check_elf_header): Allow Linux ABI.
3677         (check_symtab): Handle STB_GNU_UNIQUE.
3678
3679 2009-07-08  Mark Wielaard  <mjw@redhat.com>
3680
3681         * readelf.c (attr_callback): Handle DW_Form constants for
3682         DW_AT_data_member_location.
3683
3684 2009-07-06  Roland McGrath  <roland@redhat.com>
3685
3686         * readelf.c (register_info): New function.  Handle unknown register #s.
3687         (print_cfa_program): Use it.
3688         (handle_core_register, handle_core_registers): Likewise.
3689
3690 2009-06-28  Roland McGrath  <roland@redhat.com>
3691
3692         * readelf.c (print_address_names): New static variable.
3693         (options, parse_opt): Grok -N/--numeric-addresses to clear it.
3694         (format_dwarf_addr): Don't look up name if !print_address_names.
3695
3696 2009-06-13  Ulrich Drepper  <drepper@redhat.com>
3697
3698         * ldgeneric.c: Don't use deprecated libelf functions.
3699         * nm.c: Likewise.
3700         * objdump.c: Likewise.
3701         * readelf.c: Likewise.
3702         * size.c: Likewise.
3703         * strip.c: Likewise.
3704         * unstrip.c: Likewise.
3705         * ld.h: Fix up comment.
3706
3707 2009-06-01  Ulrich Drepper  <drepper@redhat.com>
3708
3709         * readelf.c (print_relocs): Expect ELF header argument and pass on
3710         to handle_relocs_rel* functions. Adjust caller.
3711         (handle_relocs_rel): Add ELF header argument.  Add special case for
3712         the IRELATIVE relocations in statically linked executables.
3713         (handle_relocs_rela): Likewise.
3714
3715 2009-04-29  Ulrich Drepper  <drepper@redhat.com>
3716
3717         * elflint.c (check_symtab): Add tests of st_other field.
3718
3719 2009-04-23  Ulrich Drepper  <drepper@redhat.com>
3720
3721         * Makefile [BUILD_STATIC] (libdw): Add $(zip_LIBS).
3722
3723 2009-04-20  Roland McGrath  <roland@redhat.com>
3724
3725         * addr2line.c (print_dwarf_function): Honor -s and -A for file names
3726         of inline call sites.
3727
3728         * addr2line.c (just_section): New variable.
3729         (adjust_to_section): New function, broken out of ...
3730         (handle_address): ... here.
3731         (options, parse_opt): Add -j/--section=NAME to set it.
3732
3733 2009-04-15  Roland McGrath  <roland@redhat.com>
3734
3735         * readelf.c (print_debug_frame_section): Check for DW_CIE_ID_64 in
3736         64-bit format header, DW_CIE_ID_32 in 32-bit format header.
3737
3738 2009-04-14  Roland McGrath  <roland@redhat.com>
3739
3740         * readelf.c (print_attributes): Treat SHT_ARM_ATTRIBUTES on EM_ARM
3741         like SHT_GNU_ATTRIBUTES.
3742
3743         * readelf.c (handle_core_registers): Fix error message.
3744
3745         * strip.c (handle_elf: check_preserved): Don't note any change when
3746         .debug_data is already filled from a previous pass.
3747
3748 2009-02-05  Ulrich Drepper  <drepper@redhat.com>
3749
3750         * objdump.c (show_relocs_x): Minor cleanups.
3751
3752         * readelf.c (print_cfa_program): Correct a few labels.
3753         Print first DW_CFA_expression and DW_CFA_val_expression parameter
3754         as register.
3755
3756 2009-02-01  Ulrich Drepper  <drepper@redhat.com>
3757
3758         * objdump.c (show_relocs_rel, show_relocs_rela): Split common parts
3759         into ...
3760         (show_relocs_x): ...here.  New function.
3761         (show_relocs): Better spacing in output.
3762
3763         * objdump.c (show_relocs_rela): Show offsets as signed values.
3764
3765         * ar.c (main): Fix recognition of invalid modes for a, b, i modifiers.
3766         Improve some error messages.
3767         Use program_invocation_short_name instead of AR macro.
3768         * Makefile.am (CFLAGS_ar): Remove.
3769         * elflint.c (parse_opt): ARGP_HELP_EXIT_ERR does nothing for argp_help.
3770         * objdump.c (parse_opt): Likewise.
3771         * readelf.c (parse_opt): Likewise.
3772
3773 2009-01-27  Roland McGrath  <roland@redhat.com>
3774
3775         * readelf.c (print_ops): Notice short length, don't overrun buffer
3776         (still need to fix LEB128).
3777
3778         * readelf.c (print_ops): Fix DW_OP_call[24] decoding.
3779
3780         * readelf.c (print_ops): Print (empty)\n when LEN == 0.
3781
3782 2009-01-24  Ulrich Drepper  <drepper@redhat.com>
3783
3784         * readelf.c (print_debug_frame_section): Fix computation of vma_base
3785         for PC-relative mode.
3786
3787 2009-01-23  Ulrich Drepper  <drepper@redhat.com>
3788
3789         * size.c (process_file): When handling archive, close file descriptor
3790         here.  For unknown file format also close file descriptor.
3791         (handle_ar): Don't close file descriptor here.
3792
3793         * readelf.c (parse_opt): Move code to add to dump_data_sections and
3794         string_sections list in local function add_dump_section.  Adjust 'x'
3795         key handling.  For 'a' key add .strtab, .dynstr, and .comment section
3796         to string_sections list.
3797
3798 2009-01-22  Roland McGrath  <roland@redhat.com>
3799
3800         * readelf.c (print_phdr): Don't print section mapping when no sections.
3801
3802         * Makefile.am (AM_CFLAGS): Pass -Wno-format for *_no_Wformat.
3803
3804         * readelf.c (print_debug_frame_section): Initialize IS_SIGNED to false
3805         and reset it only for the 'true' cases.
3806
3807         * Makefile.am (addr2line_no_Wformat): New variable.
3808
3809         * readelf.c (print_debug_frame_section): Use t instead of j formats
3810         for ptrdiff_t OFFSET.
3811
3812 2009-01-21  Ulrich Drepper  <drepper@redhat.com>
3813
3814         * elflint.c (check_program_header): Fix typo in .eh_frame_hdr section
3815         test.  Handle debuginfo files.
3816         (check_exception_data): First sanity test.
3817
3818 2009-01-17  Ulrich Drepper  <drepper@redhat.com>
3819
3820         * readelf.c (print_debug_exception_table): Show target of ar_disp
3821         field.
3822
3823         * elflint.c (check_program_header): Add most consistency checks for
3824         PT_GNU_EH_FRAME entry.
3825
3826         * addr2line.c: Use ARGP_PROGRAM_VERSION_HOOK_DEF and
3827         ARGP_PROGRAM_BUG_ADDRESS_DEF.
3828         * ar.c: Likewise.
3829         * elfcmp.c: Likewise.
3830         * elflint.c: Likewise.
3831         * findtextrel.c: Likewise.
3832         * ld.c: Likewise.
3833         * nm.c: Likewise.
3834         * objdump.c: Likewise.
3835         * ranlib.c: Likewise.
3836         * readelf.c: Likewise.
3837
3838         * size.c: Likewise.
3839         * strings.c: Likewise.
3840         * strip.c: Likewise.
3841         * unstrip.c: Likewise.
3842
3843 2009-01-16  Ulrich Drepper  <drepper@redhat.com>
3844
3845         * elflint.c (check_program_header): Check that PT_GNU_EH_FRAME entry
3846         matches .eh_frame_hdr section, if it is available.  Also check that
3847         the segment is allocated, not writable, not executable.
3848
3849         * readelf.c: Add -e option.  Dump exception and unwind related
3850         sections.  Add -e to -a.
3851         (print_encoding_base): Handle DW_EH_PE_omit.
3852         (print_debug_exception_table): Beginning of support.
3853         (print_debug): Hook up print_debug_exception_table for
3854         .gcc_except_table sections.
3855
3856         * readelf.c (print_debug_frame_section): Some fixes for last change.
3857
3858 2009-01-15  Ulrich Drepper  <drepper@redhat.com>
3859
3860         * readelf.c (print_encoding): Now a toplevel function.
3861         (print_relinfo): Likewise.
3862         (print_encoding_base): Broken out of print_debug_frame_section.
3863         (print_debug_frame_section): Print different header for .eh_frame
3864         sections.  Fix recognition of matching CIEs in .debug_frame sections.
3865         Print absolute offset for PC-relative FDE locations.  Don't print
3866         table header for FDEs if the table is empty.
3867         (read_encoded): New function.
3868         (print_debug_frame_hdr_section): New function.
3869         (print_debug): Hook up print_debug_frame_hdr_section for .eh_frame_hdr
3870         sections.
3871
3872         * readelf.c (handle_relocs_rel): Print section number.
3873         (print_debug_abbrev_section): Likewise.
3874         (print_debug_aranges_section): Likewise.
3875         (print_debug_ranges_section): Likewise.
3876         (print_debug_info_section): Likewise.
3877         (print_debug_line_section): Likewise.
3878         (print_debug_loc_section): Likewise.
3879         (print_debug_macinfo_section): Likewise.
3880         (print_debug_pubnames_section): Likewise.
3881         (print_debug_str_section): Likewise.
3882
3883 2009-01-10  Ulrich Drepper  <drepper@redhat.com>
3884
3885         * strings.c (read_block): Fix typo in error message string.
3886
3887 2009-01-07  Ulrich Drepper  <drepper@redhat.com>
3888
3889         * ld.c (ld_new_searchdir): Fix adding to search path list.
3890
3891 2009-01-06  Ulrich Drepper  <drepper@redhat.com>
3892
3893         * readelf.c: Implement call frame debug section dumping.
3894
3895 2009-01-05  Roland McGrath  <roland@redhat.com>
3896
3897         * elfcmp.c: Exit with status 2 for errors (like cmp, diff, grep).
3898         Status 1 (aka EXIT_FAILURE) is only for completed OK but not equal.
3899
3900 2009-01-01  Ulrich Drepper  <drepper@redhat.com>
3901
3902         * addr2line.c: Update copyright year.
3903         * ar.c: Likewise.
3904         * elfcmp.c: Likewise.
3905         * elflint.c: Likewise.
3906         * findtextrel.c: Likewise.
3907         * ld.c: Likewise.
3908         * nm.c: Likewise.
3909         * objdump.c: Likewise.
3910         * ranlib.c: Likewise.
3911         * readelf.c: Likewise.
3912         * size.c: Likewise.
3913         * strings.c: Likewise.
3914         * strip.c: Likewise.
3915         * unstrip.c: Likewise.
3916
3917 2008-12-11  Roland McGrath  <roland@redhat.com>
3918
3919         * nm.c (sym_name): New function.
3920         (show_symbols_sysv): Use it in place of elf_strptr.
3921         (show_symbols_bsd, show_symbols_posix): Likewise.
3922         Fixes RHBZ#476136.
3923
3924         * nm.c (show_symbols_sysv): Use an alloca'd backup section name when
3925         elf_strptr fails.
3926
3927 2008-12-02  Roland McGrath  <roland@redhat.com>
3928
3929         * readelf.c (count_dwflmod, process_file): Don't presume encoding of
3930         nonzero OFFSET argument to dwfl_getmodules.
3931
3932 2008-08-07  Roland McGrath  <roland@redhat.com>
3933
3934         * addr2line.c (main): Pass string to handle_address.
3935         (see_one_module): New function, subroutine of handle_address.
3936         (find_symbol): Likewise.
3937         (handle_address): Take string argument rather than address.
3938         Convert plain number, or handle strings like "(section)+offset"
3939         or "symbol+offset".
3940
3941 2008-08-01  Roland McGrath  <roland@redhat.com>
3942
3943         * readelf.c (handle_core_item): Handle 'B' type for 1-origin bitset.
3944         For 'b' and 'B', print <x-y,z> or ~<x,y-z> rather than 1/0 string.
3945
3946         * readelf.c (convert): Take new argument SIZE.
3947         (handle_core_register, handle_core_item): Update callers.
3948         (handle_core_item): Take new arg REPEATED_SIZE.
3949         (handle_core_items): Special case for a singleton item,
3950         let handle_core_item handle repeats if it wants to.
3951
3952         * readelf.c (handle_core_items): Give abridged output
3953         for identical groups repeated more than twice.
3954
3955 2008-07-04  Roland McGrath  <roland@redhat.com>
3956
3957         * readelf.c (handle_core_items): Handle ELF_T_ADDR.
3958
3959 2008-04-10  Roland McGrath  <roland@redhat.com>
3960
3961         * strip.c (handle_elf): Don't keep sections that kept symbol tables
3962         refer to.  Instead, just be sure to preserve the original symbol
3963         table in the debug file so those symbols go with their sections and
3964         can be elided from the stripped version of the symbol table.
3965
3966         * strip.c (handle_elf): When a discarded section kept in the debug
3967         file refers to a nondiscard section via sh_link/sh_info, preserve
3968         that nondiscarded section unmodified in the debug file as well.
3969         Skip adjustment of discarded sections symbol table references when
3970         that symbol table is copied in this way.
3971
3972         * elflint.c (check_symtab): Don't crash from missing symbol names
3973         after diagnosing bogus strtab.
3974
3975         * strip.c (handle_elf): Cosmetic cleanup in special section contents
3976         adjustment for symtab changes.
3977
3978 2008-03-31  Roland McGrath  <roland@redhat.com>
3979
3980         * elflint.c (check_sections): Add checks on SHF_EXECINSTR sections:
3981         must be SHT_PROGBITS, must not be SHF_WRITE.  Let backend hook
3982         excuse a special section.
3983
3984 2008-03-27  Roland McGrath  <roland@redhat.com>
3985
3986         * elflint.c (check_sections): Check that executability and writability
3987         of sections is reflected in segment p_flags.
3988
3989 2008-03-26  Roland McGrath  <roland@redhat.com>
3990
3991         * elflint.c (check_program_header): Accept PT_GNU_RELRO p_flags
3992         that matches its PT_LOAD's p_flags &~ PF_W.  On sparc, PF_X really
3993         is valid in RELRO.
3994
3995 2008-02-29  Roland McGrath  <roland@redhat.com>
3996
3997         * readelf.c (print_attributes): Add a cast.
3998         * elflint.c (check_attributes): Likewise.
3999
4000         * unaligned.h (add_8ubyte_unaligned): Cast PTR argument for parity
4001         with [UNALIGNED_ACCESS_CLASS == BYTE_ORDER] definition.
4002         (add_4ubyte_unaligned, add_2ubyte_unaligned): Likewise.
4003
4004 2008-02-03  Ulrich Drepper  <drepper@redhat.com>
4005
4006         * i386_ld.c (elf_i386_count_relocations): Implement R_386_TLS_GD
4007         when linked into executable.
4008         (elf_i386_create_relocations): Likewise.
4009
4010 2008-02-20  Roland McGrath  <roland@redhat.com>
4011
4012         * readelf.c (print_attributes): New function.
4013         (process_elf_file): Call it under -A.
4014
4015         * elflint.c (check_attributes): Implement it for real.
4016
4017 2008-02-19  Roland McGrath  <roland@redhat.com>
4018
4019         * elflint.c (special_sections): Handle .gnu.attributes section.
4020         (check_sections): Likewise.
4021         (check_attributes): New function.
4022
4023 2008-02-10  Roland McGrath  <roland@redhat.com>
4024
4025         * elfcmp.c (main): Ignore sh_offset differences in non-SHF_ALLOC
4026         sections and ET_REL files.
4027
4028 2008-02-02  Ulrich Drepper  <drepper@redhat.com>
4029
4030         * elf32-i386.script: Add .eh_frame_hdr, .tdata, and .tbss sections.
4031         * i386_ld.c (elf_i386_count_relocations): Handle R_386_TLS_LDO_32
4032         and R_386_TLS_LE.
4033         (elf_i386_create_relocations): Likewise.
4034         * ld.h (struct ld_state): Add need_tls, tls_start, and tls_tcb
4035         elements.
4036         * ldgeneric.c (add_section): If TLS section is used, set need_tls flag.
4037         (ld_generic_create_outfile): Add PT_TLS entry to program  header.
4038         Fix generation of PT_GNU_STACK entry.
4039
4040 2008-02-01  Ulrich Drepper  <drepper@redhat.com>
4041
4042         * ld.c (replace_args): Prevent loop over replacements if the parameter
4043         is only two characters long.
4044
4045         * ld.c: Recognize sha1 argument for --build-id parameter.
4046         * ldgeneric.c (create_build_id_section): Handle sha1.
4047         (compute_hash_sum): New function.  Broken out of compute_build_id.
4048         Take hash function and context as parameters.
4049         (compute_build_id): Use compute_hash_sum for md5 and the new sha1
4050         implementation.
4051
4052 2008-01-31  Ulrich Drepper  <drepper@redhat.com>
4053
4054         * elf32-i386.script: Add .note.ABI-tag and .note.gnu.build-id sections.
4055         * ld.c: Recognize --build-id command line parameter.
4056         * ld.h: Define scn_dot_note_gnu_build_id.
4057         (struct ld_state): Add build_id and buildidscnidx elements.
4058         * ldgeneric.c: Implement --build-id command line parameter.
4059         * ldlex.l (ID): Recognize - as valid character after the first one.
4060
4061 2008-01-29  Ulrich Drepper  <drepper@redhat.com>
4062
4063         * ld.c (replace_args): New function.
4064         (main): Use it to rewrite old-style parameters.
4065
4066         * elf32-i386.script: Add .gnu.hash section.
4067         * ldgeneric.c (optimal_bucket_size): A tiny bit more efficient.
4068         (fillin_special_symbol): Initialize st_size.
4069         (sortfct_hashval): New function.
4070         (create_gnu_hash): New function.
4071         (create_hash): New function.
4072         (ld_generic_create_outfile): Use the new functions to create the
4073         hash tables.
4074
4075         * elflint.c (check_gnu_hash): Fix index value printed in error message.
4076
4077 2008-01-24  Ulrich Drepper  <drepper@redhat.com>
4078
4079         * elflint.c (check_group): Check that signature symbol for section
4080         group is not an empty string.
4081         * ldgeneric.c: Remove magic assignment of indices in the dynsym
4082         section.  Start implementation of --hash-style.
4083         * i386_ld.c: Likewise.
4084         * ld.c: Recognize --hash-style.
4085         * ld.h (struct scninfo): Add comdat_group.
4086         Add additional parameter to finalize_plt callback.
4087
4088 2008-01-22  Ulrich Drepper  <drepper@redhat.com>
4089
4090         * ld.h (struct callbacks): Add initialize_gotplt.
4091         (struct scnhead): Add scn_dot_gotplt.
4092         (struct ld_state): Add gotpltscnidx.
4093         * i386_ld.c (elf_i386_initialize_plt): Minor optimization.
4094         (elf_i386_initialize_pltrel): Likewise.
4095         (elf_i386_initialize_got): There is now a separate .got.plt, so
4096         don't do the PLT-related work here.  Initialize d_type.
4097         (elf_i386_initialize_gotplt): New function.
4098         (elf_i386_plt0): Use ud2a after indirect jump.
4099         (elf_i386_pic_plt0_entry): Likewise.
4100         (elf_i386_finalize_plt): Reference now .got.plt.
4101         (elf_i386_count_relocations): For GOT entries which need no relocation
4102         don't bump nrel_got.
4103         (elf_i386_create_relocations): Also get .got.plt.  Rewrite R-386_GOT32
4104         handling for split .got/.got.plt.
4105         (elf_i386_ld_init): Initialize callbacks.initialize_gotplt.
4106         * elf32-i386.script: Sort sections for security.  There are no .got
4107         input sections.  Add .got.plt.
4108         * ldgeneric.c (ld_generic_generate_sections): Add .got.plt section.
4109         (ld_generic_create_outfile): Initialize .got.plt section.
4110         Use .got.plt address for _GLOBAL_OFFSET_TABLE_ symbol and DT_PLTGOT.
4111
4112 2008-01-19  Ulrich Drepper  <drepper@redhat.com>
4113
4114         * i386_ld.c (elf_i386_count_relocations): PLT relocations for undefined
4115         symbols are not carried over into statically linked output files.
4116         Add dummy entries for more TLS relocations.
4117
4118         * ld.c (options): Add long names for -( and -).
4119
4120         * ldgeneric.c (check_definition): For newly found definitions don't
4121         mark section as used if symbol is absolute.
4122         (extract_from_archive): Only assign archive sequence number the first
4123         time the archive is handled.  Update ld_state.last_archive_used
4124         if any symbol was used.  Remove nround variable.
4125         (file_process2): When using symbol from an archive, update
4126         ld_state.group_start_archive, ld_state.archives, and
4127         ld_state.tailarchives.
4128         (ld_generic_file_process): If group is not handled anymore, after
4129         freeing ELF handles for the archives, clear ld_state.archives and
4130         *nextp.  Fix wrong logic in recognizing first iteration of group
4131         loop.  When clearing flags, also clear ld_state.group_start_archive.
4132
4133 2008-01-11  Ulrich Drepper  <drepper@redhat.com>
4134
4135         * objdump.c (show_disasm): Adjust disassembler format string for
4136         removal of %e.
4137
4138 2008-01-04  Roland McGrath  <roland@redhat.com>
4139
4140         * readelf.c (handle_core_items): Take new arg DESCSZ; if nonzero,
4141         a size greater than the items cover means multiple sets of items.
4142         (handle_core_note): Update caller.
4143
4144 2008-01-04  Roland McGrath  <roland@redhat.com>
4145
4146         * strip.c (handle_elf): Move SHDRIDX defn to silence gcc warning.
4147
4148 2008-01-03  Roland McGrath  <roland@redhat.com>
4149
4150         * ld.h (linked_from_dso_p): Use __attribute__ ((__gnu_inline__)).
4151
4152         * elflint.c (check_dynamic): Remove duplicate initializer.
4153
4154 2008-01-02  Ulrich Drepper  <drepper@redhat.com>
4155
4156         * addr2line.c: Update copyright year.
4157         * ar.c: Likewise.
4158         * elfcmp.c: Likewise.
4159         * elflint.c: Likewise.
4160         * findtextrel.c: Likewise.
4161         * ld.c: Likewise.
4162         * nm.c: Likewise.
4163         * objdump.c: Likewise.
4164         * ranlib.c: Likewise.
4165         * readelf.c: Likewise.
4166         * size.c: Likewise.
4167         * strings.c: Likewise.
4168         * strip.c: Likewise.
4169         * unstrip.c: Likewise.
4170
4171 2007-12-30  Ulrich Drepper  <drepper@redhat.com>
4172
4173         * objdump (show_disasm): Use %e after third parameter.
4174
4175 2007-12-21  Ulrich Drepper  <drepper@redhat.com>
4176
4177         * strip.c: Fix wrong parenthesis in a few branch predictions.
4178         * strings.c: Likewise.
4179
4180 2007-12-20  Ulrich Drepper  <drepper@redhat.com>
4181
4182         * Makefile.am (DEFS): Add DEBUGPRED.
4183         * addr2line.c: Include debugpred.h.
4184         * ar.c: Likewise.
4185         * elfcmp.c: Likewise.
4186         * elflint.c: Likewise.
4187         * findtextrel.c: Likewise.
4188         * nm.c: Likewise.
4189         * objdump.c: Likewise.
4190         * ranlib.c: Likewise.
4191         * readelf.c: Likewise.
4192         * size.c: Likewise.
4193         * strings.c: Likewise.
4194         * strip.c: Likewise.
4195         * unstrip.c: Likewise.
4196         * debugpred.h: New file.
4197
4198         * readelf.c (handle_relocs_rel): Use elf_scnshndx.
4199         (handle_relocs_rela): Likewise.
4200
4201         * readelf.c: Add lots of likely/unlikely.
4202
4203         * elflint.c: Minor cleanups.
4204
4205 2007-11-19  Roland McGrath  <roland@redhat.com>
4206
4207         * readelf.c (print_ops): Handle all bad op codes gracefully.
4208         Print their numbers instead of just ???.
4209
4210 2007-11-09  Roland McGrath  <roland@redhat.com>
4211
4212         * readelf.c (attr_callback): Handle DW_AT_data_location.
4213         Handle block forms to mean a DWARF expression for DW_AT_allocated,
4214         DW_AT_associated, DW_AT_bit_size, DW_AT_bit_offset, DW_AT_bit_stride,
4215         DW_AT_byte_size, DW_AT_byte_stride, DW_AT_count, DW_AT_lower_bound,
4216         DW_AT_upper_bound.
4217
4218 2007-10-20  Roland McGrath  <roland@redhat.com>
4219
4220         * unstrip.c (options): Update -R description.
4221         (struct symbol): Put symbol details a union with a size_t pointer
4222         `duplicate'.
4223         (compare_symbols_output): Use null ->name as marker for discard
4224         symbols, not zero *->map.
4225         (copy_elided_sections): Record forwarding pointers for discarded
4226         duplicates and fill SYMNDX_MAP elements through them.
4227
4228         * readelf.c (process_file): Set offline_next_address to 0 at start.
4229         (struct process_dwflmod_args): New type.
4230         (process_dwflmod): Take args in it, pass fd to process_elf_file.
4231         (process_file): Update caller; dup FD for passing to libdwfl.
4232         (process_elf_file): Take new arg FD.  For ET_REL file when
4233         displaying data affected by libdwfl relocation, open a new Elf handle.
4234
4235 2007-10-17  Roland McGrath  <roland@redhat.com>
4236
4237         * readelf.c (print_debug_line_section): For invalid data inside a
4238         unit with plausible length, keep printing at the next unit boundary.
4239
4240         * readelf.c (attr_callback): Use dwarf_formref_die, not dwarf_formref.
4241
4242 2007-10-16  Roland McGrath  <roland@redhat.com>
4243
4244         * readelf.c (hex_dump): Fix rounding error in whitespace calculation.
4245
4246 2007-10-15  Roland McGrath  <roland@redhat.com>
4247
4248         * make-debug-archive.in: New file.
4249         * Makefile.am (EXTRA_DIST): Add it.
4250         (make-debug-archive): New target.
4251         (bin_SCRIPTS, CLEANFILES): Add it.
4252
4253 2007-10-10  Roland McGrath  <roland@redhat.com>
4254
4255         * elflint.c (special_sections): Add new attrflag value exact_or_gnuld.
4256         Use it to check MERGE|STRINGS for .debug_str.
4257         (check_sections): Handle exact_or_gnuld.
4258
4259 2007-10-08  Roland McGrath  <roland@redhat.com>
4260
4261         * readelf.c (handle_core_item): Handle 'T'|0x80 to indicate
4262         64-bit struct timeval with 32-bit tv_usec.
4263
4264 2007-10-07  Roland McGrath  <roland@redhat.com>
4265
4266         * readelf.c (check_archive_index): New function.
4267         (process_file): Call it.  Change signature to take only fd and name.
4268         Use libdwfl to open the file, then iterate on its modules (multiple
4269         for an archive) to print file name and call process_elf_file.
4270         (main): Update caller.  Let process_file do elf_begin.
4271         (count_dwflmod, process_dwflmod, find_no_debuginfo): New functions.
4272         (process_elf_file): Take only Dwfl_Module * argument.
4273         Don't print the file name here.
4274         (print_debug_*_section): Take Dwfl_Module * argument.
4275         (print_debug): Likewise.  Update caller.
4276         (format_dwarf_addr): New function.
4277         (print_debug_ranges_section): Use it.
4278         (attr_callback): Likewise.
4279         (print_debug_line_section, print_debug_loc_section): Likewise.
4280
4281         * readelf.c (print_debug_ranges_section): Translate all strings.
4282         (print_debug_loc_section): Likewise.
4283
4284         * unstrip.c (copy_elided_sections): Initialize SEC.
4285
4286         * ar.c (do_oper_insert): Put trailing / on short names.
4287
4288         * arlib.h (MAX_AR_NAME_LEN): Decrease by one.
4289
4290         * arlib2.c (arlib_add_long_name): Adjust for header size.
4291
4292         * arlib.c (arlib_finalize): Pad long name table to keep size even.
4293
4294         * ar.c (do_oper_insert): Use write_retry for padding write.
4295
4296         * ar.c (do_oper_insert): Initialize CUR_OFF in no_old case.
4297         Unconditionally set FOUND[CNT]->elf when setting ->mem.
4298         (remember_long_name): New function.
4299         (do_oper_insert): Call it.  Correctly use length of basename,
4300         not original name.  Don't store long name twice for new member.
4301
4302 2007-10-06  Roland McGrath  <roland@redhat.com>
4303
4304         * elflint.c (check_note): Skip empty segment.
4305         (check_note_section): Skip empty section.
4306
4307         * unstrip.c (options, parse_opt, struct arg_info): Grok -R/--relocate.
4308         (handle_output_dir_module, handle_implicit_modules): Pass it down.
4309         (handle_dwfl_module): When set, use ET_REL already loaded by Dwfl.
4310         (compare_alloc_sections): Take new arg REL, ignore address if true.
4311         (compare_sections): Likewise, pass it down.
4312         (compare_sections_rel, compare_sections_nonrel): New functions.
4313         (find_alloc_sections_prelink, copy_elided_sections): Use them
4314         instead of compare_sections.
4315         (sections_match): New function, broken out of ...
4316         (find_alloc_section): ... here.
4317         (copy_elided_sections): Reorganize section match-up logic.
4318         Use sections_match for SHF_ALLOC in ET_REL.
4319         For ET_REL, let the nonzero sh_addr from the debug file dominate.
4320
4321         * unstrip.c (add_new_section_symbols): Take new arg REL.
4322         When true, do not update section symbol values.
4323         (collect_symbols): Likewise.  Update section symbols with address
4324         of chosen output section, not original section.
4325         (check_symtab_section_symbols, copy_elided_sections): Update callers.
4326
4327         * unstrip.c (compare_alloc_sections): At the same address, preserve
4328         original section order.
4329
4330         * elflint.c (special_sections): Don't require MERGE|STRINGS for
4331         .debug_str, it didn't always have them with older tools.
4332
4333         * elflint.c (check_symtab, check_one_reloc): Ignore sh_addr in ET_REL.
4334
4335 2007-10-05  Roland McGrath  <roland@redhat.com>
4336
4337         * elflint.c (check_symtab): Allow SHN_UNDEF _GLOBAL_OFFSET_TABLE_ in
4338         ET_REL file.
4339
4340         * elflint.c (check_symtab): For _GLOBAL_OFFSET_TABLE_, diagnose
4341         SHN_UNDEF as "bad section".  Use shndx value in messages.
4342
4343         * elflint.c (special_sections): Add ".debug_str".  Decrement namelen
4344         for ".debug" so it matches as a prefix.
4345         (IS_KNOWN_SPECIAL): New macro.
4346         (check_sections): Use it for ".plt" match.  Cite wrong SHT_NOBITS
4347         type even under -d, for a .debug* or .shstrtab section.
4348
4349         * readelf.c (print_ops): Use hex for address operand.
4350
4351 2007-10-04  Roland McGrath  <roland@redhat.com>
4352
4353         * unstrip.c (copy_elided_sections): Initialize NDX_SECTION element for
4354         .gnu_debuglink section to SHN_UNDEF.  Drop STT_SECTION symbols for
4355         sections mapped to SHN_UNDEF.
4356
4357 2007-10-04  Ulrich Drepper  <drepper@redhat.com>
4358
4359         * readelf.c (dump_archive_index): Avoid warning about uninitialized
4360         variable with older glibc versions.
4361         Add some branch prediction.
4362
4363 2007-10-04  Roland McGrath  <roland@redhat.com>
4364
4365         * readelf.c (print_archive_index): New variable.
4366         (options, parse_opt): Accept -c/--archive-index to set it.
4367         (dump_archive_index): New function.
4368         (process_file): Take new arg WILL_PRINT_ARCHIVE_INDEX.
4369         Call dump_archive_index on archives if set.
4370         (main): Update caller.
4371         (any_control_option): Give it file scope, moved out of ...
4372         (parse_opt): ... here.
4373
4374 2007-10-03  Roland McGrath  <roland@redhat.com>
4375
4376         * unstrip.c (struct arg_info): Add `list' flag.
4377         (options, parse_opt): Grok -n/--list to set it.
4378         (list_module): New function.
4379         (handle_implicit_modules): Call it under -n.
4380
4381         * elflint.c (check_note_section): New function.
4382         (check_sections): Call it for SHT_NOTE.
4383
4384         * readelf.c (handle_notes): Use sections when available.
4385
4386         * elflint.c (check_note_data): New function, broken out of ...
4387         (check_note): ... here.  Call it and elf_getdata_rawchunk.
4388
4389         * readelf.c (handle_auxv_note): Take offset as argument, not buffer.
4390         Use elf_getdata_rawchunk and gelf_getauxv.
4391         (handle_notes_data): New function, broken out of ...
4392         (handle_notes): ... here.  Call it and elf_getdata_rawchunk.
4393
4394 2007-10-01  Roland McGrath  <roland@redhat.com>
4395
4396         * readelf.c (hex_dump): Fix transposed subtraction generating spaces.
4397
4398         * readelf.c (hex_dump): Fix line header to be hex instead of decimal.
4399
4400 2007-09-10  Roland McGrath  <roland@redhat.com>
4401
4402         * readelf.c (options): Give -p optional argument, alias --string-dump.
4403         (string_sections, string_sections_tail): New static variables.
4404         (parse_opt): Set them when -p has an argument.
4405         (print_string_section): New function, broken out of ...
4406         (print_strings): ... here.  Call it.
4407         (dump_data_section): New function, broken out of ...
4408         (dump_data): ... here.  Call it.
4409         (for_each_section_argument): New function, broken out of ...
4410         (dump_data): ... here.  Call it.
4411         (dump_strings): New function.
4412
4413 2007-08-31  Roland McGrath  <roland@redhat.com>
4414
4415         * readelf.c (print_strings): Typo fix.
4416
4417 2007-08-23  Roland McGrath  <roland@redhat.com>
4418
4419         * readelf.c (printf_with_wrap): Function removed.
4420         (REGISTER_WRAP_COLUMN): New macro.
4421         (handle_core_register): Use print_core_item instead.
4422         (struct register_info): New type.
4423         (compare_registers, compare_register_sets): New functions.
4424         (register_bitpos, compare_sets_by_info): New functions.
4425         (handle_core_registers): Use those to segregate and sort registers
4426         for display.
4427
4428         * readelf.c (ITEM_WRAP_COLUMN): New macro.
4429         (print_core_item): New function.
4430         (handle_core_item): Use it instead of printf_with_wrap.
4431         (compare_core_items, compare_core_item_groups): New functions.
4432         (handle_core_items): Use them.  Sort by group and force line breaks
4433         between groups.
4434
4435         * readelf.c (handle_core_registers, handle_core_items): New functions,
4436         broken out of ...
4437         (handle_core_note): ... here.   Call them.
4438
4439 2007-08-22  Roland McGrath  <roland@redhat.com>
4440
4441         * unstrip.c (new_shstrtab): New function, broken out of ...
4442         (copy_elided_sections): ... here.
4443
4444 2007-08-20  Roland McGrath  <roland@redhat.com>
4445
4446         Avoid local function trampolines in nm binary.
4447         * nm.c (sort_by_address): Move to a static function instead of local
4448         inside show_symbols.
4449         (sort_by_name_strtab): New static variable.
4450         (sort_by_name): Use it.  Move to a static function instead of local
4451         inside show_symbols.
4452         (show_symbols): Set sort_by_name_strtab.
4453
4454 2007-08-19  Roland McGrath  <roland@redhat.com>
4455
4456         * readelf.c (handle_auxv_note): New function.
4457         (handle_notes): Call it.
4458
4459         * readelf.c (printf_with_wrap, convert): New functions.
4460         (handle_core_item, (handle_core_register): New functions.
4461         (handle_notes): Call those with details from ebl_core_note.
4462
4463 2007-08-12  Roland McGrath  <roland@redhat.com>
4464
4465         * elflint.c (check_note): Accept type 0 with name "Linux".
4466
4467         * elflint.c (special_sections): Accept SHF_ALLOC for ".note".
4468
4469         * elflint.c (section_flags_string): Return "none" for 0, not "".
4470
4471 2007-08-11  Roland McGrath  <roland@redhat.com>
4472
4473         * elflint.c (check_note): Accept NT_GNU_HWCAP, NT_GNU_BUILD_ID.
4474
4475 2007-08-04  Ulrich Drepper  <drepper@redhat.com>
4476
4477         * readelf.c (hex_dump): Use isprint to determine whether to print
4478         character itself or full stop character.
4479         (dump_data): No need to check endp for NULL after strtol call.
4480
4481 2007-08-03  Roland McGrath  <roland@redhat.com>
4482
4483         * readelf.c (print_string_sections): New variable.
4484         (options, parse_opt): Handle --strings/-p to set it.
4485         (print_strings): New function.
4486         (process_elf_file): Call it under -p.
4487
4488         * readelf.c (options): Add hidden aliases --segments, --sections,
4489         as taken by binutils readelf.
4490
4491 2007-08-01  Roland McGrath  <roland@redhat.com>
4492
4493         * readelf.c (dump_data_sections, dump_data_sections_tail):
4494         New variables.
4495         (options, parse_opt): Handle --hex-dump/-x, set them.
4496         (hex_dump): New function.
4497         (dump_data): New function, call it.
4498         (process_elf_file): Call it.
4499
4500 2007-07-25  Roland McGrath  <roland@redhat.com>
4501
4502         * addr2line.c (show_symbols): New variable.
4503         (print_addrsym): New function.
4504         (handle_address): Call it.
4505         (options, parse_opt): Handle -S/--symbols.
4506
4507 2007-06-05  Ulrich Drepper  <drepper@redhat.com>
4508
4509         * addr2line.c: Update for latest autoconf header.
4510         * ar.c: Likewise.
4511         * elfcmp.c: Likewise.
4512         * elflint.c: Likewise.
4513         * findtextrel.c: Likewise.
4514         * ld.c: Likewise.
4515         * ldgeneric.c: Likewise.
4516         * nm.c: Likewise.
4517         * objdump.c: Likewise.
4518         * ranlib.c: Likewise.
4519         * readelf.c: Likewise.
4520         * size.c: Likewise.
4521         * strings.c: Likewise.
4522         * strip.c: Likewise.
4523         * unstrip.c: Likewise.
4524
4525 2007-05-18  Roland McGrath  <roland@redhat.com>
4526
4527         * unstrip.c (copy_elided_sections): Match up non-NOBITS sections with
4528         stripped file, so as not to duplicate a section copied in both.
4529
4530         * strip.c (handle_elf): Keep SHT_NOTE section copies in the debug file.
4531
4532 2007-05-17  Roland McGrath  <roland@redhat.com>
4533
4534         * unstrip.c (copy_elided_sections): Don't call gelf_newphdr for 0.
4535
4536         * unstrip.c (handle_file): Tweak BIAS != 0 warning.
4537
4538         * unstrip.c (handle_file): Take new arg CREATE_DIRS.  If set,
4539         call make_directories here.
4540         (handle_explicit_files): Take new arg CREATE_DIRS, pass it down.
4541         (handle_dwfl_module): Likewise.
4542         (handle_implicit_modules): Update callers.
4543         (handle_output_dir_module): Likewise.  Don't do make_directories here.
4544
4545         * unstrip.c (get_section_name): New function, broken out of ...
4546         (copy_elided_sections): here.  Update callers.
4547         (find_alloc_section): Broken out of ...
4548         (copy_elided_sections): ... here.  Update caller.
4549         (symtab_count_leading_section_symbols): Take new arg NEWSYMDATA,
4550         update STT_SECTION symbols' st_value fields as a side effect.
4551         (check_symtab_section_symbols): Update caller.
4552         (add_new_section_symbols): Set st_value in symbols added.
4553         (collect_symbols): Reset S->value for STT_SECTION symbols recorded.
4554         Take new arg SPLIT_BSS.  Adjust S->shndx recorded for symbols moved
4555         from .bss to .dynbss.
4556         (find_alloc_sections_prelink): New function.  Associate debug file
4557         allocated SHT_NOBITS shdrs with stripped moved by prelink via
4558         .gnu.prelink_undo information.
4559         (copy_elided_sections): Call it when we couldn't find every allocated
4560         section.  Don't use a debug file non-NOBITS section if SHF_ALLOC.
4561         Take STRIPPED_EHDR arg instead of E_TYPE and PHNUM.
4562         (handle_file): Update callers.
4563
4564         * unstrip.c (copy_elided_sections): Ignore unfound unallocated section
4565         named ".comment".
4566
4567         * elflint.c (check_sections): Fix association of segments with
4568         sections when p_memsz > p_filesz.
4569
4570 2007-04-29  Roland McGrath  <roland@redhat.com>
4571
4572         * addr2line.c (options, main): Tweak argp group settings to fix
4573         usage output.
4574
4575 2007-04-28  Roland McGrath  <roland@redhat.com>
4576
4577         * strip.c (handle_elf): Update debug file's SHT_NOBITS sections'
4578         sizes to match sections adjusted in the stripped file.
4579
4580 2007-04-24  Roland McGrath  <roland@redhat.com>
4581
4582         * elfcmp.c (OPT_HASH_INEXACT): New macro.
4583         (hash_inexact): New variable.
4584         (options, parse_opt): Add --hash-inexact option to set it.
4585         (hash_content_equivalent): New function.
4586         (main): Call it for differing SHT_HASH sections under --hash-inexact.
4587
4588 2007-04-23  Roland McGrath  <roland@redhat.com>
4589
4590         * unstrip.c: New file.
4591         * Makefile.am (bin_PROGRAMS): Add it.
4592         (unstrip_LDADD): New variable.
4593
4594         * strip.c (options): Allow --output for -o.
4595
4596 2007-02-15  Ulrich Drepper  <drepper@redhat.com>
4597
4598         * readelf.c: Remove unused code.  Add a few consts.
4599
4600 2007-02-15  Roland McGrath  <roland@redhat.com>
4601
4602         * readelf.c (print_debug): Fix brainos in SHDR test.
4603
4604 2007-02-05  Roland McGrath  <roland@redhat.com>
4605
4606         * ar.c: Include <limits.h>, since we use LONG_MAX.
4607
4608 2007-02-05  Ulrich Drepper  <drepper@redhat.com>
4609
4610         * ar.c: Add ugly hack to work around gcc complaining that we
4611         ignore fchown's return value.
4612         (do_oper_insert): Handle error when writing padding.
4613         * ranlib.c: Add fchown complain work around.
4614
4615         * arlib.c: Make symtab a global variable.  Change all users.
4616         * arlib2.c: Likewise.
4617         * ranlib.c: Likewise.
4618         * ar.c: Likewise.
4619         * arlib.h: Declare it.
4620
4621 2007-01-11  Roland McGrath  <roland@redhat.com>
4622
4623         * elflint.c (check_sections): Use ebl_machine_section_flag_check on
4624         SHF_MASKPROC bits separately from generic sh_flags validation.
4625
4626 2007-02-04  Ulrich Drepper  <drepper@redhat.com>
4627
4628         * ar.c: New file.
4629         * arlib.c: New file.
4630         * arlib2.c: New file.
4631         * arlib.h: New file.
4632         * Makefile (noinst_LIBRARIES): Add libar.
4633         (libar_a_SOURCES): Define.
4634         (ar_LDADD): Define.
4635         (CFLAGS_ar): Define.
4636         * ranlib.c: Change to use arlib.
4637
4638         * elflint.c (check_symtab): Work around GNU ld bug which omits
4639         sections but not symbols in those sections.
4640
4641 2007-01-10  Ulrich Drepper  <drepper@redhat.com>
4642
4643         * addr2line.c: Update copyright year.
4644         * elfcmp.c: Likewise.
4645         * elflint.c: Likewise.
4646         * findtextrel.c: Likewise.
4647         * ld.c: Likewise.
4648         * nm.c: Likewise.
4649         * objdump.c: Likewise.
4650         * ranlib.c:  Likewise.
4651         * readelf.c: Likewise.
4652         * size.c: Likewise.
4653         * strings.c: Likewise.
4654         * strip.c: Likewise.
4655
4656 2006-12-09  Ulrich Drepper  <drepper@redhat.com>
4657
4658         * elflint.c (compare_hash_gnu_hash): New function.  Report if the
4659         two hash tables have different content (module expected omission
4660         of undefined symbols).
4661
4662 2006-10-31  Roland McGrath  <roland@redhat.com>
4663
4664         * elflint.c (check_program_header): Don't complain about
4665         p_filesz > p_memsz if p_memsz is zero and p_type is PT_NOTE.
4666
4667 2006-09-19  Jakub Jelinek  <jakub@redhat.com>
4668
4669         * strip.c (process_file): Disallow -f on archives.
4670
4671 2006-10-09  Roland McGrath  <roland@redhat.com>
4672
4673         * Makefile.am (libld_elf_i386.so): Use $(LINK), not $(CC).
4674
4675 2006-08-29  Roland McGrath  <roland@redhat.com>
4676
4677         * Makefile.am (MAINTAINERCLEANFILES): New variable.
4678
4679         * readelf.c (handle_relocs_rel): Typo fix, test DESTSHDR properly.
4680         Reported by Christian Aichinger <Greek0@gmx.net>.
4681
4682         * elflint.c (valid_e_machine): Add EM_ALPHA.
4683         Reported by Christian Aichinger <Greek0@gmx.net>.
4684
4685 2006-08-08  Ulrich Drepper  <drepper@redhat.com>
4686
4687         * elflint.c (check_dynamic): Don't require DT_HASH for DT_SYMTAB.
4688         Keep track of which "high DT" entries are present.
4689         Check that either old or GNU-style hash table is present.
4690         If GNU-style hash table is used a symbol table is mandatory.
4691         Check that if any prelink entry is present all of them are.
4692         (check_gnu_hash): Only fail for undefined symbols in GNU-style hash
4693         table if they don't refer to functions.
4694
4695 2006-07-17  Roland McGrath  <roland@redhat.com>
4696
4697         * elflint.c (struct version_namelist): Use GElf_Versym for `ndx' field.
4698         (add_version): Likewise for argument.
4699         (check_versym): Cast constant to GElf_Versym for comparison.
4700
4701 2006-07-12  Roland McGrath  <roland@redhat.com>
4702
4703         * readelf.c (handle_gnu_hash): Add casts for machines where
4704         Elf32_Word != unsigned int.
4705
4706 2006-07-12  Ulrich Drepper  <drepper@redhat.com>
4707
4708         * elflint.c (check_sysv_hash64): Fix printf format.
4709
4710 2006-07-11  Roland McGrath  <roland@redhat.com>
4711
4712         * addr2line.c (options): English fix in -f doc string.
4713
4714         * addr2line.c (use_comp_dir): New variable.
4715         (options, parse_opt): Grok -A/--absolute to set it.
4716         (handle_address): If set, prepend dwfl_line_comp_dir results to
4717         relative file names.
4718
4719 2006-07-06  Ulrich Drepper  <drepper@redhat.com>
4720
4721         * elflint.c: Adjust for latest new hash table format.
4722         * readelf.c: Likewise.
4723
4724         * elflint.c (check_versym): Ignore hidden bit when comparing version
4725         numbers.
4726
4727 2006-07-05  Ulrich Drepper  <drepper@redhat.com>
4728
4729         * ldgeneric.c (ld_generic_create_outfile): Correctly recognize
4730         discarded COMDAT symbols.
4731
4732         * i386_ld.c (elf_i386_count_relocations): Lot of corrections.
4733         (elf_i386_create_relocations): Likewise.
4734         * ld.h (struct symbol): Add local and hidden bits.
4735         * ld.c (create_special_section_symbol): These synthsized symbols
4736         are local and hidden.
4737         * ldgeneric.c (file_process2): Check whether input file matches
4738         the emulation.
4739         (fillin_special_symbol): Create symbols as local and/or hidden
4740         if requested.
4741         (ld_generic_create_outfile): Make local copy of symbol.
4742         Don't hide global, defined symbols in dynamic symbol table unless
4743         requested.  Synthetic symbols have no version information.
4744
4745         * elflint.c: Add support for checking 64-bit SysV-style hash tables.
4746         * readelf.c: Add support for printing 64-bit SysV-style hash tables.
4747
4748 2006-07-04  Ulrich Drepper  <drepper@redhat.com>
4749
4750         * elflint.c (is_rel_dyn): Fix and extend DT_RELCOUNT/DT_RELACOUNT
4751         testing.
4752
4753 2006-07-03  Ulrich Drepper  <drepper@redhat.com>
4754
4755         * elflint.c: Add testing of DT_GNU_HASH.
4756         * readelf.c: Implement showing histogram for DT_GNU_HASH section.
4757
4758         * Makefile.am: Add hacks to create dependency files for non-generic
4759         linker.
4760
4761 2006-06-12  Ulrich Drepper  <drepper@redhat.com>
4762
4763         * ldgeneric.c (ld_generic_generate_sections): Don't create .interp
4764         section if creating a DSO and no interpreter is given.
4765         (ld_generic_create_outfile): Don't store reference to symbols in
4766         discarded COMDAT groups.  Don't create PHDR and INTERP program header
4767         for DSO if no interpreter is specified.
4768         (create_verneed_data): Pretty printing.
4769
4770         * ldscript.y (content): If a DSO is created don't set default
4771         interpreter from linker script.
4772
4773         * i386_ld.c (elf_i386_count_relocations): Do not add relocations
4774         for symbols in discarded COMDAT groups.
4775         (elf_i386_create_relocations): Likewise.
4776         * ld.h (struct scninfo): Add unused_comdat.
4777         * ldgeneric.c (add_section): Also check group signature when
4778         matching COMDAT sections.
4779         (add_relocatable_file): Ignore symbols in COMDAT group which are
4780         discarded.
4781
4782         * elflint.c (check_one_reloc): For *_NONE relocs only check type
4783         and symbol reference.
4784
4785 2006-06-11  Ulrich Drepper  <drepper@redhat.com>
4786
4787         * elflint.c (check_dynamic): Fix checking value of tags which are
4788         offsets in the string section.  Make sure DT_STRTAB points to the
4789         section referenced in sh_link.
4790
4791         * ld.c (options): Add headers.  Add short option 'R' for '--rpath'.
4792
4793         * ld.c: Recognize --eh-frame-hdr option.
4794         * ld.h (struct ld_state): Add eh_frame_hdr field.
4795         * ldgeneric.c (struct unw_eh_frame_hdr): Define.
4796
4797         * ldgeneric.c (add_section): Use ebl_sh_flags_combine instead of
4798         SH_FLAGS_COMBINE.
4799         (add_relocatable_file): Minor optimization of last change.
4800         (match_section): Don't preserve SHF_GROUP flag any longer.
4801
4802 2006-06-10  Ulrich Drepper  <drepper@redhat.com>
4803
4804         * ld.c (parse_z_option): Recognize execstack and noexecstack.
4805         Handle record and ignore as position dependent options.
4806         (parse_z_option_2): Handle ignore and record here.
4807         * ld.h (struct ld_state): Add execstack field.
4808         * ldgeneric.c (add_relocatable_file): Recognize .note.GNU-stack
4809         sections.
4810         (ld_generic_create_outfile): Fix program header creation in native
4811         linker.  Add PT_GNU_STACK program header.
4812
4813 2006-06-09  Ulrich Drepper  <drepper@redhat.com>
4814
4815         * i386_ld.c (elf_i386_finalize_plt): Don't change symbol table entries
4816         for PLT entries if there is no local definition.
4817
4818         * ld.c (parse_option): Handle -z ignore like --as-needed and
4819         -z record like --no-as-needed.
4820         * ld.h (struct ld_state): Remove ignore_unused_dsos field.
4821         * ldgeneric.c (new_generated_scn): Always compute ndt_needed by
4822         looping over DSOs.  When deciding about adding DT_NEEDED entries
4823         use ->as_needed instead of ignore_unused_dsos.
4824
4825 2006-05-31  Ulrich Drepper  <drepper@redhat.com>
4826
4827         * ld.c: Recognize --as-needed and --no-as-needed options.
4828         * ld.h (struct usedfile): Add as_needed field.
4829         (struct ld_state): Likewise.
4830         * ldgeneric.c (ld_handle_filename_list): Copy as_needed flag from
4831         the list.
4832         * ldscript.y (filename_id_list): Split to correctly parse all
4833         combinations.
4834         (mark_as_needed): Fix loop.
4835
4836 2006-05-28  Ulrich Drepper  <drepper@redhat.com>
4837
4838         * addr2line.c (print_dwarf_function): Use unsigned type for lineno
4839         and colno.
4840
4841 2006-05-27  Ulrich Drepper  <drepper@redhat.com>
4842
4843         * readelf.c (handle_relocs_rela): Better notations for addon value.
4844         (print_ehdr): Distinguish e_ident[EI_VERSION] from e_version.
4845
4846 2006-04-04  Ulrich Drepper  <drepper@redhat.com>
4847
4848         * addr2line.c: Update copyright year.
4849         * elfcmp.c: Likewise.
4850         * elflint.c: Likewise.
4851         * findtextrel.c: Likewise.
4852         * ld.c: Likewise.
4853         * nm.c: Likewise.
4854         * objdump.c: Likewise.
4855         * ranlib.c: Likewise.
4856         * readelf.c: Likewise.
4857         * size.c: Likewise.
4858         * strings.c: Likewise.
4859         * strip.c: Likewise.
4860
4861 2006-03-09  Roland McGrath  <roland@redhat.com>
4862
4863         * Makefile.am (AM_LDFLAGS): New variable.
4864
4865 2006-03-01  Roland McGrath  <roland@redhat.com>
4866
4867         * readelf.c (dwarf_tag_string, dwarf_attr_string): Update name tables
4868         for dwarf.h changes matching 3.0 spec.
4869         (dwarf_encoding_string, dwarf_lang_string, print_ops): Likewise.
4870
4871 2005-12-04  Ulrich Drepper  <drepper@redhat.com>
4872
4873         * elflint.c (check_one_reloc): If relocation section is not loaded,
4874         don't check whether the relocations modify read-only sections or
4875         loaded and unloaded sections.
4876
4877 2005-11-28  Ulrich Drepper  <drepper@redhat.com>
4878
4879         * elflint.c (check_one_reloc): Take additional parameters.  Use
4880         them to determine whether relocation is valid in this type of
4881         file.  DSOs and executables can contain relocation sections in
4882         unloaded sections which just show the relocations the linker
4883         applied.  Adjust all callers.
4884         (check_program_header): Check that PT_PHDR is loaded and that offset
4885         matches the one in the ELF header.
4886
4887 2005-10-26  Roland McGrath  <roland@redhat.com>
4888
4889         * nm.c (get_var_range): dwarf_getloclist -> dwarf_getlocation.
4890
4891 2005-09-03  Ulrich Drepper  <drepper@redhat.com>
4892
4893         * strip.c (handle_elf): Unify some error messages.
4894         * ld.c (main): Likewise.
4895         * ldgeneric.c (open_elf): Likewise.
4896         * elfcmp.c (main): Likewise.
4897         * elflint.c (check_elf_header): Likewise.
4898
4899         * size.c (process_file): Fix typo in error message.
4900
4901         * readelf.c: Lots of little cleanups.  Use _unlocked functions.
4902
4903 2005-09-02  Ulrich Drepper  <drepper@redhat.com>
4904
4905         * strings.c (main): Reset elfmap variable after munmap call.
4906         [_MUDFLAP] (map_file): Simplify mudflap debugging by not using mmap.
4907
4908 2005-08-28  Ulrich Drepper  <drepper@redhat.com>
4909
4910         * ranlib.c: Don't define pread_retry and write_retry here.
4911
4912         * Makefile.an [BUILD_STATIC] (libdw): Add -ldl.
4913         (CLEANFILES): Add *.gcno *.gcda *.gconv.
4914
4915         * strings.c (process_chunk): Reorder expressions in conditional
4916         (process_chunk_mb): Likewise.
4917
4918         * strings.c: New file.
4919         * Makefile.am (bin_PROGRAMS): Add strings.
4920         (strings_no_Wstring): Define.
4921         (strings_LDADD): Define.
4922
4923 2005-08-27  Roland McGrath  <roland@redhat.com>
4924
4925         * addr2line.c (dwarf_diename_integrate): Function removed.
4926         (print_dwarf_function): Use plain dwarf_diename.
4927
4928 2005-08-24  Ulrich Drepper  <drepper@redhat.com>
4929
4930         * elflint.c (check_versym): Versioned symbols should not have
4931         local binding.
4932
4933 2005-08-15  Ulrich Drepper  <drepper@redhat.com>
4934
4935         * elflint.c (check_versym): Allow VER_NDX_LOCAL symbols to be
4936         undefined.
4937
4938         * Makefile.am: Add rules to build ranlib.
4939         * ranlib.c: New file.
4940
4941 2005-08-14  Roland McGrath  <roland@redhat.com>
4942
4943         * elflint.c (check_sections): Use ebl_section_type_name and allow any
4944         sh_type it recognizes.
4945
4946         * elflint.c (check_sections): Print unknown flags in hex, don't
4947         truncate high bits.  Print section number and name for unknown type.
4948
4949 2005-08-13  Roland McGrath  <roland@redhat.com>
4950
4951         * elflint.c (check_program_header): Use ebl_segment_type_name and
4952         allow any p_type it recognizes.  Include p_type value in error
4953         message for unknown type.
4954
4955 2005-08-13  Ulrich Drepper  <drepper@redhat.com>
4956
4957         * elflint.c (check_symtab): Simplify last change a bit.  Pass ehdr
4958         to ebl_check_special_symbol.
4959         (check_sections): Pass ehdr to ebl_bss_plt_p.
4960
4961 2005-08-12  Roland McGrath  <roland@redhat.com>
4962
4963         * elflint.c (check_symtab): Check that _GLOBAL_OFFSET_TABLE_ st_shndx
4964         refers to the right section if it's not SHN_ABS.
4965         Let ebl_check_special_symbol override _G_O_T_ value and size checks.
4966
4967         * elflint.c (check_sections): Don't complain about a non-NOBITS
4968         section taking no segment space, if it's sh_size is 0.
4969
4970         * elflint.c (check_sections): Use ebl_bss_plt_p to see if .plt should
4971         be PROGBITS or NOBITS.
4972
4973         * elflint.c (check_symtab): Use ebl_check_special_symbol to override
4974         standard st_value and st_size checks.
4975
4976 2005-07-28  Roland McGrath  <roland@redhat.com>
4977
4978         * addr2line.c (options, parse_opt): Don't handle -e here.
4979         (executable): Variable removed.
4980         (argp_children): New static variable.
4981         (argp): Use it.  Make const.
4982         (main): Fill in argp_children from dwfl_standard_argp ().
4983         Let libdwfl handle file selection, pass Dwfl handle to handle_address.
4984         (print_dwarf_function): New function.  Try to figure out inline chain.
4985         (elf_getname): Function removed, libdwfl does it for us.
4986         (handle_address): Take Dwfl handle instead of Elf, Dwarf handles.
4987         Use dwfl_module_addrname instead of elf_getname.
4988         Use dwfl_module_getsrc and dwfl_lineinfo instead of libdw calls.
4989         * Makefile.am (INCLUDES): Add libdwfl directory to path.
4990
4991 2005-08-10  Ulrich Drepper  <drepper@redhat.com>
4992
4993         * strip.c (parse_opt): STATE parameter is now used.
4994         Various little cleanups.
4995
4996         * readelf.c (print_debug_line_section): Correct fallout of renaming
4997         of DW_LNS_set_epilog_begin.
4998
4999 2005-08-08  Roland McGrath  <roland@redhat.com>
5000
5001         * strip.c (options, parse_opt): Grok -R .comment for compatibility
5002         with binutils strip.  Likewise -d, -S, as aliases for -g.
5003         Likewise ignore -s/--strip-all.
5004
5005 2005-08-07  Roland McGrath  <roland@redhat.com>
5006
5007         * strip.c (process_file): Open read-only when using a different output
5008         file.
5009
5010 2005-08-06  Ulrich Drepper  <drepper@redhat.com>
5011
5012         * elflint.c (in_nobits_scn): New function.
5013         (check_versym): Allow references for defined symbols against versions
5014         of other DSOs also for symbols in nobits sections.
5015         Move a few variables around.
5016
5017         * Makefile.am (AM_CFLAGS): Avoid duplication.
5018         Link with statis libs if BUILD_STATIC.
5019
5020 2005-08-05  Ulrich Drepper  <drepper@redhat.com>
5021
5022         * elflint.c: Many, many more tests.  Mostly related to symbol
5023         versioning.  Those sections should now be completely checked.
5024
5025         * readelf.c (print_dynamic): Use gelf_offscn.
5026
5027 2005-08-04  Ulrich Drepper  <drepper@redhat.com>
5028
5029         * elflint.c: Add lots more tests: more extension symbol table sanity,
5030         versioning section tests, hash table tests.  General cleanup.
5031
5032 2005-08-02  Ulrich Drepper  <drepper@redhat.com>
5033
5034         * objdump.c: New file.
5035         * Makefile.am (bin_PROGRAMS): Add objdump.
5036         (objdump_LDADD): Define.
5037
5038         * elflint.c (check_reloc_shdr): New function split out from check_rela
5039         and check_rel.
5040         (check_one_reloc): New function.  Likewise.
5041         (check_rela): Use check_reloc_shdr and check_one_reloc.
5042         (check_rel): Likewise.
5043         (check_program_header): Check that PT_DYNAMIC entry matches .dynamic
5044         section.
5045         Add checks that relocations against read-only segments are flagged,
5046         that the text relocation flag is not set unnecessarily, and that
5047         relocations in one section are either against loaded or not-loaded
5048         segments.
5049
5050 2005-08-01  Ulrich Drepper  <drepper@redhat.com>
5051
5052         * elfcmp.c (main): Ignore section count and section name string table
5053         section index.
5054
5055 2005-07-27  Roland McGrath  <roland@redhat.com>
5056
5057         * elfcmp.c: Include <locale.h>.
5058
5059 2005-07-27  Ulrich Drepper  <drepper@redhat.com>
5060
5061         * elfcmp.c: Print name and index of differing section.
5062
5063 2005-07-24  Ulrich Drepper  <drepper@redhat.com>
5064
5065         * elfcmp.c: Implement comparing gaps between sections.
5066
5067 2005-07-23  Ulrich Drepper  <drepper@redhat.com>
5068
5069         * elflint.c: Include libeblP.h instead of libebl.h.
5070         * nm.c: Likewise.
5071         * readelf.c: Likewise.
5072         * elfcmp.c: Likewise.
5073
5074         * elfcmp.c (main): Compare individual ELF header fields, excluding
5075         e_shoff instead of the whole struct at once.
5076         Use ebl_section_strip_p instead of SECTION_STRIP_P.
5077         * strip.c: Use ebl_section_strip_p instead of SECTION_STRIP_P.
5078
5079 2005-07-22  Ulrich Drepper  <drepper@redhat.com>
5080
5081         * elfcmp.c (main): Take empty section into account when comparing
5082         section content.
5083
5084         * elflint.c (check_dynamic): Check that d_tag value is >= 0 before
5085         using it.
5086
5087 2005-07-21  Ulrich Drepper  <drepper@redhat.com>
5088
5089         * elfcmp.c: New file.
5090         * Makefile.am (bin_PROGRAMS): Add elfcmp.
5091         (elfcmp_LDADD): Define.
5092
5093         * elflint.c (check_rela): Check that copy relocations only reference
5094         object symbols or symbols with unknown type.
5095         (check_rel): Likewise.
5096
5097 2005-06-08  Roland McGrath  <roland@redhat.com>
5098
5099         * readelf.c (print_ops): Add consts.
5100
5101 2005-05-31  Roland McGrath  <roland@redhat.com>
5102
5103         * readelf.c (print_debug_abbrev_section): Don't bail after first CU's
5104         abbreviations.  Print a header line before each CU section.
5105
5106         * readelf.c (print_debug_loc_section): Fix indentation for larger
5107         address size.
5108
5109 2005-05-30  Roland McGrath  <roland@redhat.com>
5110
5111         * readelf.c (print_debug_line_section): Print section offset of each
5112         CU's table, so they are easy to find from seeing the stmt_list value.
5113
5114         * readelf.c (dwarf_attr_string): Add all attributes in <dwarf.h>.
5115         (attr_callback): Grok DW_AT_ranges and print offset in hex.
5116
5117         * readelf.c (attr_callback): Add 2 to addrsize * 2 for %#0* format.
5118         (print_debug_ranges_section, print_debug_loc_section): Likewise.
5119
5120         * readelf.c (print_ops): Take different args for indentation control.
5121         (attr_callback): Caller updated.
5122         Grok several more block-form attributes as being location expressions.
5123         For those same attributes with udata forms, format output differently
5124         for location list offset.
5125         (print_debug_loc_section): Implement it for real.
5126
5127         * readelf.c (options): Mention ranges for --debug-dump.
5128         (enum section_e): Add section_ranges.
5129         (parse_opt): Grok "ranges" for -w/--debug-dump.
5130         (print_debug_ranges_section): New function.
5131         (print_debug): Handle .debug_ranges section.
5132
5133 2005-05-30  Ulrich Drepper  <drepper@redhat.com>
5134
5135         * readelf.c (handle_notes): At least x86-64 need not have the note
5136         section values aligned to 8 bytes.
5137
5138 2005-05-18  Ulrich Drepper  <drepper@redhat.com>
5139
5140         * readelf.c (dwarf_tag_string): Add new tags.
5141
5142 2005-05-08  Roland McGrath  <roland@redhat.com>
5143
5144         * strip.c (handle_elf): Don't translate hash and versym data formats,
5145         elf_getdata already did it for us.
5146
5147 2005-05-07  Ulrich Drepper  <drepper@redhat.com>
5148
5149         * Makefile.am (findtextrel_LDADD): Add $(libmudflap).
5150         (addr2line_LDADD): Likewise.
5151
5152 2005-05-03  Roland McGrath  <roland@redhat.com>
5153
5154         * strip.c (handle_elf): Apply symbol table fixups to discarded
5155         relocation sections when they are being saved in the debug file.
5156
5157         * strip.c (handle_elf): Pass EHDR->e_ident[EI_DATA] to gelf_xlatetom
5158         and gelf_xlatetof, not the native byte order.
5159
5160         * strip.c (parse_opt): Give error if -f or -o is repeated.
5161         (main): Exit if argp_parse returns nonzero.
5162
5163         * strip.c (debug_fname_embed): New variable.
5164         (options, parse_opt): New option -F to set it.
5165
5166 2005-05-07  Ulrich Drepper  <drepper@redhat.com>
5167
5168         * readelf.c (parse_opt): Make any_control_option variable
5169         local.  Simplify some tests.
5170
5171 2005-05-03  Roland McGrath  <roland@redhat.com>
5172
5173         * strip.c (crc32_file): Function removed (now in ../lib).
5174
5175 2005-05-03  Roland McGrath  <roland@redhat.com>
5176
5177         * elflint.c (is_debuginfo): New variable.
5178         (options, parse_opt): New option --debuginfo/-d to set it.
5179         (check_sections): If is_debuginfo, don't complain about SHT_NOBITS.
5180         (check_note): If is_debuginfo, don't try to get note contents.
5181
5182 2005-04-24  Ulrich Drepper  <drepper@redhat.com>
5183
5184         * readelf.c (print_debug_abbrev_section): Don't print error when end of
5185         section reached.
5186
5187 2005-04-14  Ulrich Drepper  <drepper@redhat.com>
5188
5189         * readelf.c (dwarf_encoding_string): New function.
5190         (dwarf_inline_string): New function.
5191         (dwarf_access_string): New function.
5192         (dwarf_visibility_string): New function.
5193         (dwarf_virtuality_string): New function.
5194         (dwarf_identifier_case_string): New function.
5195         (dwarf_calling_convention_string): New function.
5196         (dwarf_ordering_string): New function.
5197         (dwarf_discr_list_string): New function.
5198         (attr_callback): Decode man more attribute values.
5199
5200 2005-04-01  Ulrich Drepper  <drepper@redhat.com>
5201
5202         * addr2line.c: Finish implementation of -f option.
5203
5204 2005-03-29  Ulrich Drepper  <drepper@redhat.com>
5205
5206         * addr2line.c: New file.
5207         * Makefile.am (bin_PROGRAMS): Add addr2line.
5208         Define addr2line_LDADD.
5209
5210         * findtextrel.c: Use new dwarf_addrdie function.
5211
5212         * findtextrel.c: Fix usage message and re-add accidentally removed
5213         line.
5214
5215 2005-03-28  Ulrich Drepper  <drepper@redhat.com>
5216
5217         * findtextrel.c: New file.
5218         * Makefile: Add rules to build findtextrel.
5219
5220 2005-02-15  Ulrich Drepper  <drepper@redhat.com>
5221
5222         * ldlex.l: Provide ECHO definition to avoid warning.
5223
5224         * elflint.c (check_program_header): Fix typo in RELRO test.
5225
5226         * Makefile.am (AM_CFLAGS): Add more warning options.
5227         * elflint.c: Fix warnings introduced by the new warning options.
5228         * i386_ld.c: Likewise.
5229         * ld.c: Likewise.
5230         * ld.h: Likewise.
5231         * ldgeneric.c: Likewise.
5232         * nm.c: Likewise.
5233         * readelf.c: Likewise.
5234         * sectionhash.c: Likewise.
5235         * size.c: Likewise.
5236         * string.c: Likewise.
5237
5238 2005-02-05  Ulrich Drepper  <drepper@redhat.com>
5239
5240         * Makefile.am: Check for text relocations in constructed DSOs.
5241
5242         * Makefile.am [MUDFLAP] (AM_CFLAGS): Add -fmudflap.  Link all apps
5243         with -lmudflap.
5244
5245         * ldscript.y: Add as_needed handling.
5246         * ldlex.l: Recognize AS_NEEDED token.
5247         * ld.h (struct filename_list): Add as_needed flag.
5248
5249 2005-02-04  Ulrich Drepper  <drepper@redhat.com>
5250
5251         * elflint.c (check_symtab): Correctly determine size of GOT section.
5252
5253 2005-01-19  Ulrich Drepper  <drepper@redhat.com>
5254
5255         * ld.c: Remove unnecessary more_help function.  Print bug report
5256         address using argp.
5257         * strip.c: Likewise.
5258         * size.c: Likewise.
5259         * nm.c: Likewise.
5260         * readelf.c: Likewise.
5261         * elflint.c: Likewise.
5262
5263         * elflint.c (main): Don't check for parameter problems here.
5264         (parse_opt): Do it here, where we get informed about some of them
5265         anyway.
5266
5267         * readelf.c (main): Don't check for parameter problems here.
5268         (parse_opt): Do it here, where we get informed about some of them
5269         anyway.
5270
5271 2005-01-11  Ulrich Drepper  <drepper@redhat.com>
5272
5273         * strip.c: Update copyright year.
5274         * readelf.c: Likewise.
5275         * size.c: Likewise.
5276         * nm.c: Likewise.
5277         * ld.c: Likewise.
5278         * elflint.c: Likewise.
5279
5280         * elflint.c (check_symtab): Don't warn about wrong size for
5281         _DYNAMIC and __GLOBAL_OFFSET_TABLE__ for --gnu-ld.
5282
5283 2004-10-05  Ulrich Drepper  <drepper@redhat.com>
5284
5285         * readelf.c (print_phdr): In section mapping, also indicate
5286         sections in read-only segments.
5287
5288 2004-09-25  Ulrich Drepper  <drepper@redhat.com>
5289
5290         * readelf.c: Make compile with gcc 4.0.
5291         * strip.c: Likewise.
5292
5293 2004-08-16  Ulrich Drepper  <drepper@redhat.com>
5294
5295         * strip.c (handle_elf): Rewrite dynamic memory handling to use of
5296         allocate to work around gcc 3.4 bug.
5297
5298 2004-01-25  Ulrich Drepper  <drepper@redhat.com>
5299
5300         * ldlex.l (invalid_char): Better error message.
5301
5302 2004-01-23  Ulrich Drepper  <drepper@redhat.com>
5303
5304         * readelf.c: Print SHT_GNU_LIBLIST sections.
5305
5306         * none_ld.c: New file.
5307
5308 2004-01-21  Ulrich Drepper  <drepper@redhat.com>
5309
5310         * Makefile.am: Enable building of machine specific linker.
5311
5312 2004-01-20  Ulrich Drepper  <drepper@redhat.com>
5313
5314         * Makefile.am: Support building with mudflap.
5315
5316         * i386_ld.c: Fix warnings gcc 3.4 spits out.
5317         * ldgeneric.c: Likewise.
5318         * ldscript.y: Likewise.
5319         * readelf.c: Likewise.
5320         * strip.c: Likewise.
5321
5322         * readelf.c (print_debug_line_section): Determine address size
5323         correctly.
5324
5325 2004-01-19  Ulrich Drepper  <drepper@redhat.com>
5326
5327         * readelf.c (print_phdr): Show which sections are covered by the
5328         PT_GNU_RELRO entry.
5329
5330         * elflint.c (check_program_header): Check PT_GNU_RELRO entry.
5331
5332         * readelf.c (print_debug_macinfo_section): Implement.
5333
5334 2004-01-18  Ulrich Drepper  <drepper@redhat.com>
5335
5336         * readelf.c (print_debug_line_section): Implement.
5337
5338 2004-01-17  Ulrich Drepper  <drepper@redhat.com>
5339
5340         * src/elflint.c: Use PACKAGE_NAME instead of PACKAGE.
5341         * src/ld.c: Likewise.
5342         * src/nm.c: Likewise.
5343         * src/readelf.c: Likewise.
5344         * src/size.c: Likewise.
5345         * src/strip.c: Likewise.
5346
5347         * strip.c: Add a few more unlikely.  Reduce scope of some variables.
5348
5349         * Makefile.am: Support building with mudflap.
5350
5351 2004-01-16  Ulrich Drepper  <drepper@redhat.com>
5352
5353         * readelf.c (print_debug_info_section): Free dies memory.
5354
5355         * readelf.c: Print .debug_info section content.
5356
5357 2004-01-13  Ulrich Drepper  <drepper@redhat.com>
5358
5359         * readelf.c (print_shdr): Add support for SHF_ORDERED and SHF_EXCLUDE.
5360
5361 2004-01-12  Ulrich Drepper  <drepper@redhat.com>
5362
5363         * readelf.c (print_debug_aranges): Implement using libdw.
5364
5365 2004-01-11  Ulrich Drepper  <drepper@redhat.com>
5366
5367         * nm.c: Adjust for Dwarf_Files type and dwarf_lineno interface change.
5368
5369         * readelf.c: Use libdw instead of libdwarf.  Not all of the old
5370         behavior is available yet.
5371         * Makefile.am: Link readelf with libdw.  Remove libdwarf include path.
5372
5373 2004-01-09  Ulrich Drepper  <drepper@redhat.com>
5374
5375         * nm.c (get_local_names): Adjust call to dwarf_nextcu.
5376
5377         * nm.c: Implement getting information about local variables.
5378
5379 2004-01-07  Ulrich Drepper  <drepper@redhat.com>
5380
5381         * nm.c: Read also debug information for local symbols.
5382
5383 2004-01-05  Ulrich Drepper  <drepper@redhat.com>
5384
5385         * nm.c: Shuffle dwarf handling code around so the maximum column
5386         width can be computed ahead of printing.  Avoid collection symbols
5387         which are not printed anyway.
5388
5389         * nm.c: Rewrite dwarf handling to use libdw.
5390         * Makefile.am (AM_CFLAGS): Add -std parameter.
5391         (INCLUDES): Find header in libdw subdir.
5392         (nm_LDADD): Replace libdwarf with libdw.
5393
5394         * elflint.c: Update copyright year.
5395         * readelf.c: Likewise.
5396         * size.c: Likewise.
5397         * strip.c: Likewise.
5398         * nm.c: Likewise.
5399
5400 2003-12-31  Ulrich Drepper  <drepper@redhat.com>
5401
5402         * strip.c (process_file): Close file before returning.
5403
5404 2003-11-19  Ulrich Drepper  <drepper@redhat.com>
5405
5406         * readelf.c (handle_dynamic): Make column for tag name wider.
5407
5408 2003-09-29  Ulrich Drepper  <drepper@redhat.com>
5409
5410         * readelf.c (handle_dynamic): Always terminate tag name with a space.
5411
5412 2003-09-25  Ulrich Drepper  <drepper@redhat.com>
5413
5414         * strip.c (process_file): Don't mmap the input file, we modify the
5415         data structures and don't want the change end up on disk.
5416
5417 2003-09-23  Jakub Jelinek  <jakub@redhat.com>
5418
5419         * unaligned.h (union u_2ubyte_unaligned,
5420         union u_4ubyte_unaligned, union u_8ubyte_unaligned): Add
5421         packed attribute.
5422         (add_2ubyte_unaligned, add_4ubyte_unaligned,
5423         add_8ubyte_unaligned): Avoid nesting bswap_NN macros.
5424         Read/store value through _ptr->u instead of *_ptr.
5425
5426 2003-09-22  Ulrich Drepper  <drepper@redhat.com>
5427
5428         * size.c (show_sysv): Change type of maxlen to int.
5429
5430         * strip.c (handle_elf): Handle the 64-bit archs which is 64-bit
5431         buckets.
5432
5433         * i386_ld.c: Many many fixes and extensions.
5434         * ld.c: Likewise.
5435         * ldgeneric.c: Likewise.
5436
5437 2003-08-16  Ulrich Drepper  <drepper@redhat.com>
5438
5439         * ldgeneric.c (check_definition): Don't add symbol on dso_list if
5440         the reference is from another DSO.
5441
5442 2003-08-15  Ulrich Drepper  <drepper@redhat.com>
5443
5444         * ldgeneric.c (find_entry_point): It is no fatal error if no entry
5445         point is found when creating a DSO.
5446
5447 2003-08-14  Ulrich Drepper  <drepper@redhat.com>
5448
5449         * ld.c (main): Always call FLAG_UNRESOLVED.
5450         * ldgeneric.c (ld_generic_flag_unresolved): Only complain about
5451         undefined symbols if not creating DSO or ld_state.nodefs is not set.
5452
5453 2003-08-13  Ulrich Drepper  <drepper@redhat.com>
5454
5455         * Makefile.in: Depend on libebl.a, not libebl.so.
5456
5457         * ld.c (main): Mark stream for linker script as locked by caller.
5458         (read_version_script): Likewise.
5459         * ldlex.c: Define fread and fwrite to _unlocked variant.
5460
5461         * i386_ld.c (elf_i386_finalize_plt): Replace #ifdefs with uses of
5462         target_bswap_32.
5463         * unaligned.h: Define target_bswap_16, target_bswap_32, and
5464         target_bswap_64.
5465         (store_2ubyte_unaligned, store_4ubyte_unaligned,
5466         store_8ubyte_unaligned): Define using new macros.
5467
5468 2003-08-12  Ulrich Drepper  <drepper@redhat.com>
5469
5470         * i386_ld.c (elf_i386_finalize_plt): Use packed structs to access
5471         possibly unaligned memory.  Support use of big endian machines.
5472
5473 2003-08-11  Ulrich Drepper  <drepper@redhat.com>
5474
5475         * Moved to CVS archive.