Commit Graph

3362 Commits

Author SHA1 Message Date
Nick Clifton 04d7fa2132 Update description of how to make a release to include the use of the git clean command.
PR 23440
	* README-how-to-make-a-release: Use git clean to delete spurious
	files from the local source repository.
2019-02-12 11:05:21 +00:00
Andrew Burgess 46cbf38dc3 binutils: Add new GNU format mode to `size` utility
The size tool currently defaults to berkeley format output.  However,
this output format has a weird quirk, read-only data is counted
against the text sections, not the data sections.

The code offers no real explanation for why this is, but I'm reluctant
to change it for two reasons, first, I'm assuming it probably makes
sense in some case that I'm not thinking of (maybe a target where
sections are not marked executable, and so there's no distinction
between read-only data and code), and second, the code has been this
way for at least 20 years, I worry that changing things now might
cause more confusion than it solves.

This commit then introduces a new output format for the size tool,
this new format displays the results in a similar manor to the
berkeley format, but counts read-only data in the data column, and
only executable sections are counted in the text column.

Given that this is a brand new output format I've gone ahead and
simplified things a little, while the berkeley format displays the
total twice, once in decimal and once in hex, the new display format
just displays the total in decimal.  Of course, there's still the
'--radix' option which can be used to display all the results in
hexadecimal or octal.

I've called the new format 'gnu', so '--format=gnu' or '-G' are used
to access it.

binutils/ChangeLog:

	* size.c (berkeley_format): Delete.
	(enum output_format): New enum.
	(selected_output_format): New variable.
	(usage): Update to mention GNU format.
	(main): Update to extract options, and select format as needed.
	Handle GNU format where needed.
	(berkeley_sum): Renamed to...
	(berkeley_or_gnu_sum): ...this, and updated to handle both formats.
	(berkeley_format): Renamed to...
	(berkeley_or_gnu_format): ...this, and updated to handle both
	formats.
	(print_sizes): Handle GNU format.
	* doc/binutils.texi (size): Document new GNU format.
	* testsuite/binutils-all/size.exp: Add test of extended
	functionality.
	* NEWS: Mention new functionality.
2019-02-08 11:07:24 +00:00
Andrew Burgess 96fd92af29 binutils/size: Update example output in documentation
The example output from size in Berkeley format is out of date.  The
columns are now displayed right aligned.  This patch updates the
documentation to reflect reality.

binutils/ChangeLog:

	* doc/binutils.texi (size): Update example output for Berkeley
	format output.
2019-02-08 10:56:56 +00:00
Nick Clifton 2012bf013b Move potentially obsolete BFD targets into the definitely obsolete section. Add a note to the README-how-to-make-a-release document about doing this.
bfd	* config.bfd: Move the powerpc-lynxos and powerpc-windiss targets
	into the definitely obsolete list.

binutils * README-how-to-make-a-release: Add a note about updating the
	obsolete targets in the bfd/config.bfd file.
2019-02-07 14:30:02 +00:00
Nick Clifton 082cbd3b37 Add more notes on how to make a release 2019-02-04 11:19:42 +00:00
John Darrington 0019baae63 Update binutils/MAINTAINERS for S12Z.
binutils/
	* MAINTAINERS: Add self as S12Z maintainer.
2019-02-01 18:08:09 +01:00
Nick Clifton 183445093e Prevent a potential illegal memory access in readelf when parsing a note with a zero name size.
PR 24131
	* readelf.c (process_notes_at): Prevent an illegal memory access
	when the note's namesize is zero.
	(decode_tic6x_unwind_bytecode): Add code to handle the case where
	no registers are specified in a frame pop instruction.
2019-01-25 13:16:06 +00:00
Nick Clifton 9ed1348c20 Updated Bulgarian and Russian translations for some of the binutils sub-directories 2019-01-25 11:48:55 +00:00
Nick Clifton d99386305c Updated translations for some of the binutils subdirectory. 2019-01-23 10:26:54 +00:00
Nick Clifton 375cd4233d Updated translations for various binutils subdirectories. 2019-01-21 12:59:20 +00:00
Nick Clifton f48dfe417e Change version to 2.32.51 and regenerate configure and pot files. 2019-01-19 16:51:42 +00:00
Nick Clifton f974f26cb1 Add markers for 2.32 branch to NEWS and ChangeLog files. 2019-01-19 15:55:50 +00:00
Nick Clifton baae986a40 Update objdump's --disassemble=<symbol> feature so that if <symbol> is a function, the entire function will be disassembled, regardless of the presence of interveening symbols.
* objdump.c (disassemble_section): When disassembling from a
	symbol only stop at the next symbol if the original symbol was not
	a function symbol.  Otherwise continue disassembling until a new
	function is reached.
	* testsuite/binutils-all/objdump.exp: Add tests of extended
	functionality.
	* testsuite/binutils-all/disasm.s: New test source file.
2019-01-17 15:29:43 +00:00
Jim Wilson 2dc8dd17cd RISC-V: Support ELF attribute for gas and readelf.
2019-01-16  Kito Cheng  <kito@andestech.com>
		    Nelson Chu  <nelson@andestech.com>

	bfd/
	* elfnn-riscv.c (riscv_elf_obj_attrs_arg_type): New.
	(elf_backend_obj_attrs_vendor): Define.
	(elf_backend_obj_attrs_section_type): Likewise.
	(elf_backend_obj_attrs_section): Likewise.
	(elf_backend_obj_attrs_arg_type): Define as
	riscv_elf_obj_attrs_arg_type.
	* elfxx-riscv.c (riscv_estimate_digit): New.
	(riscv_estimate_arch_strlen1): Likewise.
	(riscv_estimate_arch_strlen): Likewise.
	(riscv_arch_str1): Likewise.
	(riscv_arch_str): Likewise.
	* elfxx-riscv.h (riscv_arch_str): Declare.
	binutils/
	* readelf.c (get_riscv_section_type_name): New function.
	(get_section_type_name): Add handler for RISC-V.
	(riscv_attr_tag_t): Declare.
	(riscv_attr_tag): New.
	(display_riscv_attribute): New function.
	(process_attributes): Add handler for RISC-V.
	* testsuite/binutils-all/strip-3.d: Remove .riscv.attribute
	section.
	gas/
	* config/tc-riscv.c (DEFAULT_RISCV_ATTR): Define to 0 if not defined.
	(riscv_set_options): Add `arch_attr` field.
	(riscv_opts): Set default value for arch_attr.
	(riscv_write_out_arch_attr): New.
	(riscv_set_public_attributes): Likewise.
	(riscv_md_end): Likewise.
	(riscv_convert_symbolic_attribute): Likewise.
	(s_riscv_attribute): Likewise.
	(explicit_arch_attr): Likewise.
	(riscv_pseudo_table): Add .attribute to the table.
	(options): Add OPTION_ARCH_ATTR and OPTION_NO_ARCH_ATTR
	enumeration constants.
	(md_longopts): Add `march-attr' and `mno-arch-attr' options.
	(md_parse_option): Handle the new options.
	(md_show_usage): Document the `march-attr' option.
	* config/tc-riscv.h (md_end): Define as riscv_md_end
	(riscv_md_end): Declare.
	(CONVERT_SYMBOLIC_ATTRIBUTE): Define as
	riscv_convert_symbolic_attribute.
	(riscv_convert_symbolic_attribute): Declare.
	(start_assemble): Declare.
	* testsuite/gas/elf/elf.exp: Adjust test case for section2.e.
	* testsuite/gas/elf/section2.e-riscv: New.
	* testsuite/gas/riscv/attribute-01.d: New test
	* testsuite/gas/riscv/attribute-02.d: Likewise.
	* testsuite/gas/riscv/attribute-03.d: Likewise.
	* testsuite/gas/riscv/attribute-04.d: Likewise.
	* testsuite/gas/riscv/attribute-04.s: Likewise.
	* testsuite/gas/riscv/attribute-05.d: Likewise.
	* testsuite/gas/riscv/attribute-05.s: Likewise.
	* testsuite/gas/riscv/attribute-06.d: Likewise.
	* testsuite/gas/riscv/attribute-06.s: Likewise.
	* testsuite/gas/riscv/attribute-07.d: Likewise.
	* testsuite/gas/riscv/attribute-07.s: Likewise.
	* testsuite/gas/riscv/attribute-08.d: Likewise.
	* testsuite/gas/riscv/attribute-08.s: Likewise.
	* testsuite/gas/riscv/attribute-unknown.d: Likewise.
	* testsuite/gas/riscv/attribute-unknown.s: Likewise.
	* testsuite/gas/riscv/empty.l: Likewise.
	* doc/c-riscv.texi (.attribute): Add documentation.
	* configure.ac (--enable-default-riscv-attribute): New options.
	* configure: Re-generate.
	* config.in: Re-generate.
	include/
	* elf/riscv.h (SHT_RISCV_ATTRIBUTES): Define.
	(Tag_RISCV_arch): Likewise.
	(Tag_RISCV_priv_spec): Likewise.
	(Tag_RISCV_priv_spec_minor): Likewise.
	(Tag_RISCV_priv_spec_revision): Likewise.
	(Tag_RISCV_unaligned_access): Likewise.
	(Tag_RISCV_stack_align): Likewise.
2019-01-16 13:14:59 -08:00
Nick Clifton 12add40ee4 Stop objdump from displaying control codes embedded in symbol names.
PR 23963
binutils* objdump.c (sanitize_string): New function.  Removes control
	characters from symbol names.
	(dump_section_header): Use new function.
	(objdump_print_symname): Likewise.
	(objdump_print_addr_with_sym): Likewise.
	(show_line): Likewise.
	(disassemble_bytes): Likewise.
	(disassemble_section): Likewise.
	(load_specific_debug_section): Likewise.
	(read_section_stabs): Likewise.
	(print_section_stabs): Likewise.
	(dump_section): Likewise.
	(dump_reloc_set): Likewise.
	(dump_relocs_in_section): Likewise.
	(dump_bfd): Likewise.
	(display_any_bfd): Likewise.

gas	* testsuite/gas/mips/mips16-branch-absolute-1.d: Adjust for the fact that
	control characters are now displayed as escape sequences.
	* testsuite/gas/mips/mips16-e.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-delay-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-delay-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n32-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n32-1.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-0.d: Likewise.
	* testsuite/gas/mips/mips16-pcrel-n64-sym32-1.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-0.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-1.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-delay-0.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-delay-1.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n32-0.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n32-1.d: Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n64-sym32-0.d:
	Likewise.
	* testsuite/gas/mips/mips16e2@mips16-pcrel-n64-sym32-1.d:
	Likewise.
	* testsuite/gas/mips/mipsel16-e.d: Likewise.
	* testsuite/gas/mips/mipsr6@msa.d: Likewise.
	* testsuite/gas/mips/mipsr6@relax-swap3.d: Likewise.
	* testsuite/gas/mips/r6-64-n32.d: Likewise.
	* testsuite/gas/mips/r6-64-n64.d: Likewise.
	* testsuite/gas/mips/r6-n32.d: Likewise.
	* testsuite/gas/mips/r6-n64.d: Likewise.
	* testsuite/gas/mips/r6.d: Likewise.
	* testsuite/gas/mips/tmips16-e.d: Likewise.
	* testsuite/gas/mips/tmipsel16-e.d: Likewise.
	* testsuite/gas/mn10300/relax.d: Likewise.
2019-01-10 15:23:44 +00:00
Nick Clifton c0b0b1c2b4 Correct PR number in changelog entry. 2019-01-09 12:31:34 +00:00
Nick Clifton 28e817cc44 Fix a heap use after free memory access fault when displaying error messages about malformed archives.
PR 14049
	* readelf.c (process_archive): Use arch.file_name in error
	messages until the qualified name is available.
2019-01-09 12:25:16 +00:00
Andrew Paprocki 3107326d3d Adjust bfd/warning.m4 egrep patterns
Adjust the `bfd/warning.m4` `egrep` patterns to handle preprocessors
that do not define `__GNUC__`, leaving the string in the output.

bfd/
	* warning.m4: Adjust egrep pattern for non-GNU compilers.
	* configure: Regenerate.
binutils/
	* configure: Regenerate.
gas/
	* configure: Regenerate.
gold/
	* configure: Regenerate.
gprof/
	* configure: Regenerate.
ld/
	* configure: Regenerate.
opcodes/
	* configure: Regenerate.
2019-01-09 13:51:08 +10:30
Alan Modra 923c6a7564 cxxfilt test failures
Fixes these:
bfin-elf  +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
bfin-elf  +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
h8300-elf  +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
h8300-elf  +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
i686-pe  +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
i686-pe  +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
i686-vxworks  +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
i686-vxworks  +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE
m32c-elf  +FAIL: cxxfilt: demangling _Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E
m32c-elf  +FAIL: cxxfilt: demangling _Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE

	* testsuite/binutils-all/cxxfilt.exp: Pass --no-strip-underscores
	unconditionally to tests needing the option rather than via a
	list of targets.
2019-01-09 11:22:50 +10:30
Nick Clifton 236f4ebe3a Remove support for old gnu v2 name mangling.
PR 24044
	* cxxfilt.c (hp_symbol_characters): Delete.
	(main): Remove depcreated demangling styles.
	* stabs.c (parse_stab_argtypes): Remove support for old gnu v2
	demangling opnames.
	* testsuite/binutils-all/cxxfilt.exp: Use the
	--no-strip-underscore option for targets that do prefix their
	symbols with underscores.
	Update tests to elimiate those that use gnu v2 encoding.
2019-01-08 16:53:26 +00:00
Tamar Christina e3ecd63133 Add testcase for PR/24065.
This adds a new testcase for objcopy -O ihex to test
that it correctly works.

binutils/ChangeLog:

	PR 24065
	* testsuite/binutils-all/copy-6.d: New test.
	* testsuite/binutils-all/objcopy.exp: Use it.
2019-01-08 14:58:03 +00:00
Alan Modra 171b8e1957 run_dump_test source in build directory
Some existing tests build .s and .d files for run_dump_test, using an
absolute #source: line in the .d file.  This patch changes that scheme
a little to instead use "#source: ./..." in .d files rather than
"#source: $objdir/...", which is more useful in cases where the .d
file is not generated.

This allows RX gas test files to be built in the build directory,
rather than in a source directory (which might be read-only).

binutils/
	* testsuite/lib/binutils-common.exp (run_dump_test): Don't prepend
	$srcdir/$subdir to source file name if it starts with "./".
gas/
	* testsuite/gas/rx/rx.exp: Create generated test source in
	current directory.
	* testsuite/gas/rx/Xtod.d, * testsuite/gas/rx/abs.d,
	* testsuite/gas/rx/adc.d, * testsuite/gas/rx/add.d,
	* testsuite/gas/rx/and.d, * testsuite/gas/rx/bclr.d,
	* testsuite/gas/rx/bcnd.d, * testsuite/gas/rx/bfmov.d,
	* testsuite/gas/rx/bmcnd.d, * testsuite/gas/rx/bnot.d,
	* testsuite/gas/rx/bra.d, * testsuite/gas/rx/brk.d,
	* testsuite/gas/rx/bset.d, * testsuite/gas/rx/bsr.d,
	* testsuite/gas/rx/btst.d, * testsuite/gas/rx/clrpsw.d,
	* testsuite/gas/rx/cmp.d, * testsuite/gas/rx/dabs.d,
	* testsuite/gas/rx/dadd.d, * testsuite/gas/rx/dbt.d,
	* testsuite/gas/rx/dcmp.d, * testsuite/gas/rx/ddiv.d,
	* testsuite/gas/rx/div.d, * testsuite/gas/rx/divu.d,
	* testsuite/gas/rx/dmov.d, * testsuite/gas/rx/dmul.d,
	* testsuite/gas/rx/dneg.d, * testsuite/gas/rx/dpopm.d,
	* testsuite/gas/rx/dpushm.d, * testsuite/gas/rx/dround.d,
	* testsuite/gas/rx/dsqrt.d, * testsuite/gas/rx/dsub.d,
	* testsuite/gas/rx/dtoX.d, * testsuite/gas/rx/emaca.d,
	* testsuite/gas/rx/emsba.d, * testsuite/gas/rx/emul.d,
	* testsuite/gas/rx/emula.d, * testsuite/gas/rx/emulu.d,
	* testsuite/gas/rx/fadd.d, * testsuite/gas/rx/fcmp.d,
	* testsuite/gas/rx/fdiv.d, * testsuite/gas/rx/fmul.d,
	* testsuite/gas/rx/fsqrt.d, * testsuite/gas/rx/fsub.d,
	* testsuite/gas/rx/ftoi.d, * testsuite/gas/rx/ftou.d,
	* testsuite/gas/rx/gprel.d, * testsuite/gas/rx/int.d,
	* testsuite/gas/rx/itof.d, * testsuite/gas/rx/jmp.d,
	* testsuite/gas/rx/jsr.d, * testsuite/gas/rx/machi.d,
	* testsuite/gas/rx/maclh.d, * testsuite/gas/rx/maclo.d,
	* testsuite/gas/rx/max.d, * testsuite/gas/rx/min.d,
	* testsuite/gas/rx/mov.d, * testsuite/gas/rx/movco.d,
	* testsuite/gas/rx/movli.d, * testsuite/gas/rx/movu.d,
	* testsuite/gas/rx/msbhi.d, * testsuite/gas/rx/msblh.d,
	* testsuite/gas/rx/msblo.d, * testsuite/gas/rx/mul.d,
	* testsuite/gas/rx/mulhi.d, * testsuite/gas/rx/mullh.d,
	* testsuite/gas/rx/mullo.d, * testsuite/gas/rx/mvfacgu.d,
	* testsuite/gas/rx/mvfachi.d, * testsuite/gas/rx/mvfaclo.d,
	* testsuite/gas/rx/mvfacmi.d, * testsuite/gas/rx/mvfc.d,
	* testsuite/gas/rx/mvfcp.d, * testsuite/gas/rx/mvfdc.d,
	* testsuite/gas/rx/mvfdr.d, * testsuite/gas/rx/mvtacgu.d,
	* testsuite/gas/rx/mvtachi.d, * testsuite/gas/rx/mvtaclo.d,
	* testsuite/gas/rx/mvtc.d, * testsuite/gas/rx/mvtcp.d,
	* testsuite/gas/rx/mvtdc.d, * testsuite/gas/rx/neg.d,
	* testsuite/gas/rx/nop.d, * testsuite/gas/rx/not.d,
	* testsuite/gas/rx/opecp.d, * testsuite/gas/rx/or.d,
	* testsuite/gas/rx/pop.d, * testsuite/gas/rx/popc.d,
	* testsuite/gas/rx/popm.d, * testsuite/gas/rx/push.d,
	* testsuite/gas/rx/pushc.d, * testsuite/gas/rx/pushm.d,
	* testsuite/gas/rx/r-bcc.d, * testsuite/gas/rx/r-bra.d,
	* testsuite/gas/rx/racl.d, * testsuite/gas/rx/racw.d,
	* testsuite/gas/rx/rdacl.d, * testsuite/gas/rx/rdacw.d,
	* testsuite/gas/rx/revl.d, * testsuite/gas/rx/revw.d,
	* testsuite/gas/rx/rmpa.d, * testsuite/gas/rx/rolc.d,
	* testsuite/gas/rx/rorc.d, * testsuite/gas/rx/rotl.d,
	* testsuite/gas/rx/rotr.d, * testsuite/gas/rx/round.d,
	* testsuite/gas/rx/rstr.d, * testsuite/gas/rx/rte.d,
	* testsuite/gas/rx/rtfi.d, * testsuite/gas/rx/rts.d,
	* testsuite/gas/rx/rtsd.d, * testsuite/gas/rx/sat.d,
	* testsuite/gas/rx/satr.d, * testsuite/gas/rx/save.d,
	* testsuite/gas/rx/sbb.d, * testsuite/gas/rx/sccnd.d,
	* testsuite/gas/rx/scmpu.d, * testsuite/gas/rx/setpsw.d,
	* testsuite/gas/rx/shar.d, * testsuite/gas/rx/shll.d,
	* testsuite/gas/rx/shlr.d, * testsuite/gas/rx/smovb.d,
	* testsuite/gas/rx/smovf.d, * testsuite/gas/rx/smovu.d,
	* testsuite/gas/rx/sstr.d, * testsuite/gas/rx/stnz.d,
	* testsuite/gas/rx/stz.d, * testsuite/gas/rx/sub.d,
	* testsuite/gas/rx/suntil.d, * testsuite/gas/rx/swhile.d,
	* testsuite/gas/rx/tst.d, * testsuite/gas/rx/utof.d,
	* testsuite/gas/rx/wait.d, * testsuite/gas/rx/xchg.d,
	* testsuite/gas/rx/xor.d: Add #source line.
ld/
	* testsuite/ld-elf/sec64k.exp: Use . rather than $objdir in
	generated source file names.
	* testsuite/ld-m68k/m68k-got.exp: Likewise.
2019-01-08 18:50:54 +10:30
Simon Marchi 4ae80ffc55 Revert "Sync libiberty sources with master version in gcc repository. Updated stabs demangling and cxxfilt tests to match."
The previous commit breaks the GDB build, which is still using functions
cplus_demangle_opname & co.  Since removing these usages is not an
obvious fix, let's revert this patch until we get rid of them.
2019-01-07 18:06:35 -05:00
Nick Clifton 053af8c903 Sync libiberty sources with master version in gcc repository. Updated stabs demangling and cxxfilt tests to match.
PR 24044
	* stabs.c (parse_stab_argtypes): Remove call to
	cplus_mangle_opcode.
	* testsuite/binutils-all/cxxfilt.exp: Replace tests of v2 encoding
	with v3 encoding.  Add escape for known failures.
2019-01-07 13:18:53 +00:00
Yoshinori Sato f87673e04f RX: binutils - Add RXv3 support.
* readelf.c (get_machine_flags): Add RXv3 output.
2019-01-05 22:53:42 +09:00
Nick Clifton 11fa9f134f Fix a possible integer overflow problem when examining corrupt binaries using a 32-bit binutil.
PR 24005
	* objdump.c (load_specific_debug_section): Check for integer
	overflow before attempting to allocate contents.
2019-01-04 13:44:34 +00:00
Nick Clifton cf0ad5bbf2 Fix ridiculously small memory leak.
PR 24001
	* objcopy.c (copy_object): Free dhandle after writing out the
	debug information.
	* objdump.c (dump_bfd): Free dhandle after printing out the debug
	information.
2019-01-04 12:11:51 +00:00
Alan Modra 827041555a Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
Alan Modra d5c04e1bf8 ChangeLog rotation 2019-01-01 21:25:40 +10:30
H.J. Lu 0a59decbb8 elf: Add PT_GNU_PROPERTY segment type
Linkers group input note sections with the same name into one output
note section with the same name.  One output note section is placed in
one PT_NOTE segment.  New linkers merge all input .note.gnu.property
sections into one output .note.gnu.property section with a single
NT_GNU_PROPERTY_TYPE_0 note in a single PT_NOTE segment.  Since older
linkers treat input .note.gnu.property section as a generic note section
and just concatenate all input .note.gnu.property sections into one
output .note.gnu.property section without merging them, we may
see one or more NT_GNU_PROPERTY_TYPE_0 notes in PT_NOTE segment, which
are invalid.

GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such
that linker sets the bit for non-relocatable outputs.  But it isn't
sufficient:

1. It doesn't cover generic properties.
2. When -mx86-used-note=yes is passed to x86 assembler, the
GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED
property in object file and older linkers generate invalid
NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID bit
set.

I am proposing the following changes:

1. Add PT_GNU_PROPERTY segment type:

 # define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)

which covers .note.gnu.property section.
2. Remove GNU_PROPERTY_X86_UINT32_VALID.

bfd/

	PR ld/23900
	* elf.c (get_program_header_size): Add a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	(_bfd_elf_map_sections_to_segments): Create a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	* elfxx-x86.c (_bfd_elf_link_setup_gnu_properties): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.

binutils/

	PR ld/23900
	* readelf.c (get_segment_type): Support PT_GNU_PROPERTY.
	(decode_x86_isa): Don't check GNU_PROPERTY_X86_UINT32_VALID.
	(decode_x86_feature_1): Likewise.
	(decode_x86_feature_2): Likewise.
	(print_gnu_property_note): Remove GNU_PROPERTY_X86_UINT32_VALID
	check.
	* testsuite/binutils-all/i386/empty.d: Updated.
	* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/empty.d: Likewise.
	* testsuite/binutils-all/i386/pr21231b.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0x7fffffff.
	* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.

gas/

	PR ld/23900
	* config/tc-i386.c (x86_cleanup): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.
	* testsuite/gas/i386/property-1.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.

include/

	PR ld/23900
	* elf/common.h (PT_GNU_PROPERTY): New.
	(GNU_PROPERTY_X86_UINT32_VALID): Removed.

ld/

	PR ld/23900
	* testsuite/ld-elf/elf.exp: Run PR ld/23900 test.
	* testsuite/ld-elf/pr23900-1-32.rd: New file.
	* testsuite/ld-elf/pr23900-1-64.rd: Likewise.
	* testsuite/ld-elf/pr23900-1.d: Likewise.
	* testsuite/ld-elf/pr23900-1.s: Likewise.
	* testsuite/ld-elf/pr23900-2.s: Likewise.
	* testsuite/ld-elf/pr23900-2a.d: Likewise.
	* testsuite/ld-elf/pr23900-2b.d: Likewise.
	* testsuite/ld-i386/ibt-plt-1.d: Adjusted.
	* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
	* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
	* testsuite/ld-i386/pr23372c.d: Expect <None>
	for GNU_PROPERTY_X86_ISA_1_USED.
	* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372c.d: Likewise.
	* testsuite/ld-x86-64/pr23372d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372d.d: Likewise.
	* testsuite/ld-x86-64/property-x86-5a.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.
	* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
2018-12-14 04:55:34 -08:00
Sam Tebbs 0903806253 Move aarch64 CIE code to aarch64 backend
This commit moves all aarch64-specific code to deal with CIE structure
introduced in 3a67e1a6b4 from
target-independent files to the aarch64 backend.

2018-12-13  Sam Tebbs  <sam.tebbs@arm.com>

binutils/
	* dwarf.c (read_cie):  Add check for 'B'.

gas/
	* config/tc-aarch64.h (enum pointer_auth_key,
	tc_fde_entry_extras, tc_cie_entry_extras, tc_fde_entry_init_extra,
	tc_output_cie_extra, tc_cie_fde_equivalent_extra,
	tc_cie_entry_init_extra): Define.
	* dw2gencfi.c (struct cie_entry): Add tc_cie_entry_extras invocation.
	(alloc_fde_entry, select_cie_for_fde): Add tc_fde_entry_init_extra
	invocation.
	(output_cie): Add tc_output_cie_extra invocation.
	(select_cie_for_fde): Add tc_cie_fde_equivalent_extra invocation.
	* dw2gencfi.h (enum pointer_auth_key): Move to config/tc-aarch64.h.
	(struct fde_entry): Add tc_fde_entry_extras invocation
2018-12-13 16:37:40 +00:00
Nick Clifton 69799d67e8 Fix a failure in the libiberty testsuite by increasing the recursion limit to 2048.
PR 88409
include	* demangle.h (DEMANGLE_RECURSION_LIMIT): Increase to 2048.

binutils* NEWS: Note that recursion limit has increased to 2048.
	* doc/binutils.texi: Likewise.
2018-12-11 12:01:15 +00:00
Alan Modra 7ca166c940 Fix strings.c endian issue and strings test
git commit 71f5e3f7b6 obviously wasn't tested on a big-endian host,
and the test fail message resulted in tcl errors.

	* strings.c (unget_part_char): New function.
	(print_strings): Use unget_part_char.  Formatting.
	* testsuite/binutils-all/strings.exp (test_multibyte): Don't
	use square brackets in fail message.  Expect "String1\nString2".
2018-12-08 13:22:33 +10:30
Alan Modra c2f5dc30af PR23952, memory leak in _bfd_generic_read_minisymbols
bfd/
	PR 23952
	* syms.c (_bfd_generic_read_minisymbols): Free syms before
	returning with zero symcount.
binutils/
	* nm.c (display_rel_file): Use xrealloc to increase minisyms
	for synthetic symbols.
2018-12-08 00:11:16 +10:30
Nick Clifton af03af8f55 Synchronize libiberty with gcc and add --no-recruse-limit option to tools that support name demangling.
This patch addresses the multitude of bug reports about resource exhaustion
in libiberty's name demangling code.  It adds a limit to the amount of
recursion that is allowed, before an error is triggered.  It also adds a
new demangling option to disable this limit.  (The limit is enabled by
default).

	PR 87681
	PR 87675
	PR 87636
	PR 87335
libiberty * cp-demangle.h (struct d_info): Add recursion_limit field.
	* cp-demangle.c (d_function_type): If the recursion limit is
	enabled and reached, return with a failure result.
        (d_demangle_callback): If the recursion limit is enabled, check
	for a mangled string that is so long that there is not enough
	stack space for the local arrays.
        * cplus-dem.c (struct work): Add recursion_level field.
	(demangle_nested_args): If the recursion limit is enabled and
	reached, return with a failure result.

include	* demangle.h (DMGL_RECURSE_LIMIT): Define.
        (DEMANGLE_RECURSION_LIMIT): Prototype.

binutuils * addr2line.c (demangle_flags): New static variable.
        (long_options): Add --recurse-limit and --no-recurse-limit.
        (translate_address): Pass demangle_flags to bfd_demangle.
        (main): Handle --recurse-limit and --no-recurse-limit options.
        * cxxfilt.c (flags): Add DMGL_RECURSE_LIMIT.
        (long_options): Add --recurse-limit and --no-recurse-limit.
        (main): Handle new options.
        * dlltool.c (gen_def_file): Include DMGL_RECURSE_LIMIT in flags
        passed to cplus_demangle.
        * nm.c (demangle_flags): New static variable.
        (long_options): Add --recurse-limit and --no-recurse-limit.
        (main): Handle new options.
        * objdump.c (demangle_flags): New static variable.
        (usage): Add --recurse-limit and --no-recurse-limit.
        (long_options): Likewise.
        (objdump_print_symname): Pass demangle_flags to bfd_demangle.
        (disassemble_section): Likewise.
        (dump_dymbols): Likewise.
        (main): Handle new options.
        * prdbg.c (demangle_flags): New static variable.
        (tg_variable): Pass demangle_flags to demangler.
        (tg_start_function): Likewise.
        * stabs.c (demangle_flags): New static variable.
        (stab_demangle_template): Pass demangle_flags to demangler.
        (stab_demangle_v3_argtypes): Likewise.
        (stab_demangle_v3_arg): Likewise.
	* doc/binutuls.texi: Document new command line options.
	* NEWS: Mention the new feature.
        * testsuite/config/default.exp (CXXFILT): Define if not already
        defined.
        (CXXFILTFLAGS): Likewise.
        * testsuite/binutils-all/cxxfilt.exp: New file.  Runs a few
        simple tests of the cxxfilt program.
2018-12-07 11:32:55 +00:00
Nick Clifton 8acbe8ffa0 Update the assembler to use a version of 3 when generating the header of the .debug_line section.
PR 23941
gas	* dwarf2dbg.c (DWARF2_LINE_VERSION): Change to 3.
	* testsuite/gas/elf/dwarf2-3.d: Update expected output.
	* testsuite/gas/elf/dwarf2-5.d: Likewise.
	* testsuite/gas/i386/debug1.d: Likewise.
	* testsuite/gas/i386/dw2-compress-1.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-1.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3a.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
	* testsuite/gas/ia64/pr13167.d: Likewise.
	* testsuite/gas/mips/loc-swap-2.d: Likewise.
	* testsuite/gas/mips/loc-swap.d: Likewise.
	* testsuite/gas/mips/micromips@loc-swap-2.d: Likewise.
	* testsuite/gas/mips/micromips@loc-swap.d: Likewise.
	* testsuite/gas/mips/mips16@loc-swap-2.d: Likewise.
	* testsuite/gas/mips/mips16@loc-swap.d: Likewise.
	* testsuite/gas/mips/mips16e@loc-swap.d: Likewise.

binutils* testsuite/binutils-all/i386/compressed-1a.d: Update expected output.
	* testsuite/binutils-all/x86-64/compressed-1a.d: Likewise.
2018-12-03 17:26:41 +00:00
Alan Modra 4770fb94ee PR23946, illegal memory access in readelf.c:slurp_ia64_unwind_table
PR 23946
	* readelf.c (slurp_ia64_unwind_table): Bounds check symbol index
	on reloc.
	(slurp_hppa_unwind_table): Likewise.
2018-12-01 22:13:58 +10:30
Alan Modra 726bd37d6c PR23945, NULL pointer dereference in readelf.c:slurp_hppa_unwind_table
PR 23945
	* readelf.c (slurp_ia64_unwind_table): Don't call elf_ia64_reloc_type
	needlessly.
	(slurp_hppa_unwind_table): Use same range checks and error messages
	as slurp_ia64_unwind_table.
2018-12-01 22:10:28 +10:30
Nick Clifton 8936f76804 objdump: Fix check for corrupt reloc information, to allow for the fact that PDP11 relocs are bigger when in internal format.
PR 23931
	* objdump.c (dump_relocs_in_section): When checking for an
	unreasonable amount of relocs in a bfd, allow for the fact that
	the internal representation of a reloc may be bigger than the
	external representation.
2018-11-29 10:57:54 +00:00
Mark Wielaard 4207142d6a Handle ELF compressed header alignment correctly by setting up the section alignment correctly for the Elf32_Chdr or Elf64_Chdr type and respect the ch_addralign field when decompressing the section data.
PR binutils/23919
binutils* readelf.c (dump_sections_as_strings): Remove bogus addralign check.
	(dump_sections_as_bytes): Likewise.
	(load_specific_debug_sections): Likewise.
	* testsuite/binutils-all/dw2-3.rS: Adjust alignment.
	* testsuite/binutils-all/dw2-3.rt: Likewise.

bfd	* bfd.c (bfd_update_compression_header): Explicitly set alignment.
	(bfd_check_compression_header): Add uncompressed_alignment_power
	argument. Check ch_addralign is a power of 2.
	* bfd-in2.h: Regenerated.
	* compress.c (bfd_compress_section_contents): Get and set
	orig_uncompressed_alignment_pow if section is decompressed.
	(bfd_is_section_compressed_with_header): Add and get
	uncompressed_align_pow_p argument.
	(bfd_is_section_compressed): Add uncompressed_align_power argument
	to bfd_is_section_compressed_with_header call.
	(bfd_init_section_decompress_status): Get and set
	uncompressed_alignment_power.
	* elf.c (_bfd_elf_make_section_from_shdr): Add
	uncompressed_align_power argument to
	bfd_is_section_compressed_with_header call.
2018-11-27 11:59:10 +00:00
H.J. Lu f92f9e8780 readelf: Prune gaps warning in build notes
Since some object files may not have build notes, it is normal to have
gaps in build notes.

	PR binutils/23898
	* testsuite/lib/binutils-common.exp (prune_warnings_extra):
	Prune gaps in build notes.
2018-11-20 06:46:03 -08:00
Francois H. Theron 97b3f39201 opcodes/nfp: Fix disassembly of crc[] with swapped operands.
The decoding of the CRC operation in alu instructions was using bits
from the instruction word directly, instead of srcA which would be
different if the swap bit was set.

Signed-off-by: Francois H. Theron <francois.theron@netronome.com>
2018-11-13 15:33:21 +02:00
Hafiz Abid Qadeer 5d762de01c Fix a typo in iconv.m4.
config/
2018-11-09  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS.
	Append $INCICONV to it.

gdb/
2018-11-09  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* configure: Regenerate.

binutils/
2018-11-09  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* configure: Regenerate.

intl/
2018-11-09  Hafiz Abid Qadeer  <abidh@codesourcery.com>

	* configure: Regenerate.
2018-11-09 16:08:10 +00:00
Nick Clifton dcd9adc5cb oops - add missing piece of previous delta 2018-11-09 12:51:46 +00:00
Nick Clifton 71f5e3f7b6 Enhance the strings program so that it can display multibyte strings.
* strings.c (print_strings): Check for multibyte encodings.
	* binutils-all/strings-1.bin: New file.  Test binary for string decoding.
	* testsuite/binutils-all/strings.exp: New file.  Test the strings program.
	* testsuite/config/default.exp (STRINGS): Define if not provided
	by the environment.
	(STRINGSFLAGS): Likewise.
2018-11-09 12:48:23 +00:00
Masatake Yamato d3def5d73e Enhance objdump's --disassemble switch so that it can now take an optional parameter, specifying the starting symbol for disassembly. Disassembly will continue from this symbol up to the next symbol.
* objdump.c (long_options): Have the --disassemble option take an
	optional argument.
	(usage): Add description for the `symbol' argument to the
	--disassemble option.
	(disasm_sym): New file private variable.
	(struct objdump_disasm_info): New field `symbol'.
	(disassemble_section): Introduce `do_print' local variable
	to control whether objdump displays the result of disassembling
	for a symbol or not.
	(main): Set `symbol' file private variable if the option argument
	for the --disassemble option is given.
	* doc/binutils.texi (objdump): Add description for the option
	argument.
	* NEWS: Mention the new feature.
	* testsuite/binutils-all/objdump.exp: Add tests of the -d and
	--disassemble=<symbol> options.
	* testsuite/binutils-all/bintest.s: Add more symbols and code.
	* testsuite/binutils-all/readelf.s: Update expected output.
	* testsuite/binutils-all/readelf.ss-64: Likewise.
	* testsuite/binutils-all/readelf.ss-mips: Likewise.
	* testsuite/binutils-all/readelf.ss-tmips: Likewise.
2018-11-07 18:07:36 +00:00
Nick Clifton 0661ae2e53 Add updated French and Portuguese translations.
gas	* po/fr.po: Updated French translation.
bfd	* po/fr.po: Updated French translation.
	* po/pt.po: Updated Portuguese translation.
binutils* po/pt.po: Updated Portuguese translation.
2018-11-07 16:09:27 +00:00
Roman Bolshakov fc7b364aba Add support for new load commands added by Apple to the MACH-O file format.
bfd	* mach-o.h: Add new enums for BFD_MACH_O_PLATFORM_MACOS,
	BFD_MACH_O_PLATFORM_IOS, BFD_MACH_O_PLATFORM_TVOS,
	BFD_MACH_O_PLATFORM_WATCHOS, BFD_MACH_O_PLATFORM_BRIDGEOS,
	BFD_MACH_O_TOOL_CLANG, BFD_MACH_O_TOOL_SWIFT, BFD_MACH_O_TOOL_LD.
	(struct bfd_mach_o_note_command): New.
	(struct bfd_mach_o_build_version_tool): New.
	(struct bfd_mach_o_build_version_command): New.
	(bfd_mach_o_read_version_min): Don't split version into
	a few fields. Rename reserved to sdk.
	* mach-o.c (bfd_mach_o_read_version_min): Don't split version into a
	few fields. Rename reserved to sdk.
	(bfd_mach_o_read_command): Handle LC_VERSION_MIN_TVOS, LC_NOTE,
	LC_BUILD_VERSION.
	(bfd_mach_o_read_note): New.
	(bfd_mach_o_read_build_version): New.

	PR 23728
binutils* od-macho.c (printf_version): New.
	(dump_load_command): Use it to print version. Print sdk version. Print
	version info for watchOS and tvOS. Print LC_NOTE, LC_BUILD_VERSION.
	(dump_buld_version): New.
	(bfd_mach_o_platform_name): New
	(bfd_mach_o_tool_name): New

	* mach-o/external.h (mach_o_nversion_min_command_external): Rename
	reserved to sdk.
	(mach_o_note_command_external): New.
	(mach_o_build_version_command_external): New.
	* mach-o/loader.h (BFD_MACH_O_LC_VERSION_MIN_TVOS): Define.
	(BFD_MACH_O_LC_NOTE): Define.
2018-11-07 15:20:22 +00:00
Yoshinori Sato 8d3c78e473 rx: Add target rx-*-linux. 2018-11-07 17:18:05 +09:00
H.J. Lu 8a6b075bc0 elfedit: Add --enable-x86-feature/--disable-x86-feature
Add --enable-x86-feature and --disable-x86-feature options to elfedit
to set and clear the IBT and SHSTK bits in program property in ELF
executables and shared objects.

binutils/

	* doc/binutils.texi: Document --enable-x86-feature and
	--disable-x86-feature options for elfedit.
	* elfedit.c: Include "config.h" and <sys/mman.h>.
	(enable_x86_features): New.
	(disable_x86_features): Likewise.
	(update_gnu_property): Likewise.
	(elf_x86_feature): Likewise.
	(process_file): Call update_gnu_property on ET_EXEC or ET_DYN
	file.
	(command_line_switch): Add OPTION_ENABLE_X86_FEATURE and
	OPTION_DISABLE_X86_FEATURE.
	(options): Add--enable-x86-feature and --disable-x86-feature.
	(usage): Likewise.
	(main): Handle OPTION_ENABLE_X86_FEATURE and
	OPTION_DISABLE_X86_FEATURE.

ld/

	* testsuite/config/default.exp (ELFEDIT): New.
	* testsuite/ld-elf/linux-x86.exp (elfedit_test): New proc.
	Run elfedit tests.
	* testsuite/ld-elf/x86-feature-1a.rd: New file.
	* testsuite/ld-elf/x86-feature-1b.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1c.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1d.rd: Likewise.
	* testsuite/ld-elf/x86-feature-1e.rd: Likewise.
2018-11-06 09:38:51 -08:00