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