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