Commit Graph

149 Commits

Author SHA1 Message Date
Nick Clifton 31bf18645d Add support for --dwarf-[3|4|5] to assembler command line.
PR 25612
	* as.c (dwarf_level): Define.
	(show_usage): Add --gdwarf-3, --gdwarf-4 and --gdwarf-5.
	(parse_args): Add support for the new options.
	as.h (dwarf_level): Prototype.
	* dwarf2dbg.c (DWARF2_VERSION): Use dwarf_level as default version
	value.
	* config/tc-ia64.h (DWARF2_VERISION): Update definition.
	(DWARF2_LINE_VERSION): Remove definition.
	* doc/as.texi: Document the new options.
2020-03-06 14:52:14 +00:00
Nick Clifton 3c968de5c7 Stop the assembler from complaining that the input and output files are the same, if neither of them are regular files.
PR 25572
	* as.c (main): Allow matching input and outputs when they are
	not regular files.
2020-03-06 10:44:12 +00:00
Alan Modra b3adc24a07 Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
Andrew Burgess 0ac2b354ee gas/riscv: Produce version 3 DWARF CIE by default
The flag controlling the default DWARF CIE version to produce now
starts with the value -1.  This can be modified with the command line
flag as before, but after command line flag processing, in
md_after_parse_args targets can, if the global still has the value -1,
override this value.  This gives a target specific default.

If a CIE version is not select either by command line flag, or a
target specific default, then some new code in dwarf2_init now select
a global default.  This remains as version 1 to match previous
behaviour.

This RISC-V has a target specific default of version provided, this
make the return column uleb128, which means we can use all DWARF
registers include CSRs.

I chose to switch to version 3 rather than version 4 as this is most
similar to the global default (version 1).  Switching to version 4
adds additional columns to the CIE header.

gas/ChangeLog:

	* as.c (flag_dwarf_cie_version): Change initial value to -1, and
	update comment.
	* config/tc-riscv.c (riscv_after_parse_args): Set
	flag_dwarf_cie_version if it has not already been set.
	* dwarf2dbg.c (dwarf2_init): Initialise flag_dwarf_cie_version if
	needed.
	* testsuite/gas/riscv/default-cie-version.d: New file.
	* testsuite/gas/riscv/default-cie-version.s: New file.

ld/ChangeLog:

	* testsuite/ld-elf/eh5.d: Accept version 3 DWARF CIE.

Change-Id: Ibbfe8f0979fba480bf0a359978b09d2b3055555e
2019-11-28 00:03:05 +00:00
Andrew Burgess 66f8b2cbbb gas: Add --gdwarf-cie-version command line flag
Add a flag to control the version of CIE that is generated.  By
default gas produces CIE version 1, and this continues to be the
default after this patch.

However, a user can now provide --gdwarf-cie-version=NUMBER to switch
to either version 3 or version 4 of CIE, version 2 was never released,
and so causes an error as does any number less than 1 or greater than
4.

Producing version 4 CIE requires two new fields to be added to the
CIE, an address size field, and an segment selector field.  For a flat
address space the DWARF specification indicates that the segment
selector should be 0, and the address size fields just contains the
address size in bytes.  For now we support 4 or 8 byte addresses, and
the segment selector is always produced as 0.  At some future time we
might need to allow targets to override this.

gas/ChangeLog:

	* as.c (parse_args): Parse --gdwarf-cie-version option.
	(flag_dwarf_cie_version): New variable.
	* as.h (flag_dwarf_cie_version): Declare.
	* dw2gencfi.c (output_cie): Switch from DW_CIE_VERSION to
	flag_dwarf_cie_version.
	* doc/as.texi (Overview): Document --gdwarf-cie-version.
	* NEWS: Likewise.
	* testsuite/gas/cfi/cfi.exp: Add new tests.
	* testsuite/gas/cfi/cie-version-0.d: New file.
	* testsuite/gas/cfi/cie-version-1.d: New file.
	* testsuite/gas/cfi/cie-version-2.d: New file.
	* testsuite/gas/cfi/cie-version-3.d: New file.
	* testsuite/gas/cfi/cie-version-4.d: New file.
	* testsuite/gas/cfi/cie-version.s: New file.

include/ChangeLog:

	* dwarf2.h (DW_CIE_VERSION): Delete.

Change-Id: I9de19461aeb8332b5a57bbfe802953d0725a7ae8
2019-11-18 10:30:21 +00:00
Alan Modra fd3619828e bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
	(bfd_get_section_lma, bfd_get_section_alignment),
	(bfd_get_section_size, bfd_get_section_flags),
	(bfd_get_section_userdata): Delete.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
	(bfd_section_flags, bfd_section_userdata): New.
	(bfd_is_com_section): Rename parameter.
	* section.c (bfd_set_section_userdata, bfd_set_section_vma),
	(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
	(bfd_set_section_size): Delete bfd parameter, rename section parameter.
	(bfd_set_section_lma): New.
	* bfd-in2.h: Regenerate.
	* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
	update callers.
	* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
	* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
	* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
	* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
	* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
	* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
	* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
	* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
	* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
	* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
	* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
	* xcofflink.c: Update throughout for bfd section macro and function
	changes.
binutils/
	* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
	* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
	* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
	* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
	throughout for bfd section macro and function changes.
gas/
	* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
	* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
	* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
	* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
	* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
	* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
	* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
	* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
	* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
	* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
	* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
	* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
	* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
	* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
	* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
	* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
	* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
	* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
	bfd section macro and function changes.
	* write.c (compress_debug): Use bfd_rename_section.
gdb/
	* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
	* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
	* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
	* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
	* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
	* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
	* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
	* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
	* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
	* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
	* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
	* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
	* solib-spu.c, * solib-svr4.c, * solib-target.c,
	* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
	* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
	* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
	* mi/mi-interp.c: Update throughout for bfd section macro and
	function changes.
	* gcore (gcore_create_callback): Use bfd_set_section_lma.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
	* corefile.c, * symtab.c: Update throughout for bfd section
	macro and function changes.
ld/
	* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
	* emultempl/aarch64elf.em, * emultempl/aix.em,
	* emultempl/armcoff.em, * emultempl/armelf.em,
	* emultempl/cr16elf.em, * emultempl/cskyelf.em,
	* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
	* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
	* emultempl/mmo.em, * emultempl/msp430.em,
	* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
	throughout for bfd section macro and function changes.
libctf/
	* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
	* arc-ext.c: Update throughout for bfd section macro changes.
sim/
	* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
	* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
	* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
	* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
	* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-19 09:40:13 +09:30
Alan Modra af60449c26 Use temp_ilp and restore_ilp in more places
* as.c (macro_expr): Use temp_ilp and restore_ilp.
	* macro.c (buffer_and_nest): Likewise.
	* read.c (temp_ilp): Remove FIXME.
2019-03-18 22:39:55 +10:30
Alan Modra 827041555a Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
Alan Modra bf2dd8d7cf BFD_INIT_MAGIC
This patch performs a run-time test that a shared libbfd.so has been
compiled with the same size bfd_vma as that of apps using the library.
On a 32-bit host it is easily possible to have one libbfd.so compiled
to support 64-bit targets (or configured with --enable-64-bit-bfd)
while another only supports 32-bit targets.  The two libraries will
have differently sized bfd_vma types, and if the wrong one is loaded
all sorts of weird behaviour might be seen.

bfd/
	PR 23534
	* init.c (BFD_INIT_MAGIC): Define.
	(bfd_init): Return BFD_INIT_MAGIC.
	bfd-in2.h: Regenerate.
binutils/
	PR 23534
	* addr2line.c (main): Exit with fatal error if bfd_init
	returns an unexpected value.
	* ar.c (main): Likewise.
	* dlltool.c (identify_dll_for_implib): Likewise.
	* nm.c (main): Likewise.
	* objcopy.c (main): Likewise.
	* objdump.c (main): Likewise.
	* size.c (main): Likewise.
	* strings.c (main): Likewise.
	* windmc.c (main): Likewise.
	* windres.c (main): Likewise.
gas/
	PR 23534
	* as.c (main): Exit with fatal error if bfd_init returns an
	unexpected value.
ld/
	PR 23534
	* ldmain.c (main): Exit with fatal error if bfd_init returns
	an unexpected value.
2018-10-15 22:11:58 +10:30
Robert Yang 2a50366ded When the assembler reports that the input and output are the same, report the file names involved, in order to help debugging. Also do not equate two files are the same if the have the same inode value but reside on different file systems.
* as.c (main): Improve check for input file matching output file.
2018-08-14 12:22:35 +01:00
H.J. Lu 3a53fb12c8 as --help: Display default option for --elf-stt-common=
* as.c (show_usage): Display default option for --elf-stt-common=.
2018-08-09 09:57:11 -07:00
Nick Clifton c3533c4c7c Fix a problem in the assembler when checking for overlapping input and output files on non-POSIX compliant systems.
PR 23153
	* as.c (main): When checking for an output file that is also an
	input file, also check that the inode is not zero.
2018-05-14 13:05:02 +01:00
Nick Clifton 0df8ad28f0 Extend the assembler so that it can automatically generate GNU Build attribute notes if none are present in the input files.
gas	* as.c (flag_generate_build_notes): New variable.
	(show_usage): Add entry for --generate-missing-build-notes.
	(parse_args): Parse --generate-missing-build-notes.
	* as.h: Export flag_generate_build_notes.
	* symbols.c (save_symbol_name): Ensure that the name parameter is
	not NULL.
	* write.c (create_obj_attrs_section): Reformat.
	(create_note_reloc): New function - creates a relocation for a
	field in a GNU Build attribute note.
	(maybe_generate_build_notes): New function - created GNU Build
	attribute notes if none are present in the output file.
	(write_object_file): Call maybe_generate_build_notes.
	* configure.ac (--enable-generate-build-notes): New option.
	* NEWS: Announce the new feature.
	* doc/as.textinfo: Document the new option.
	* config.in: Regenerate.
	* configure: Regenerate.

binutils* readelf.c (is_32bit_abs_reloc): Support R_PARISC_DIR32 as a
	32-bit absolute reloc for the HPPA target.
	* testsuite/binutils-all/note-5.d: New test.
	* testsuite/binutils-all/note-5.s: Source file for new test.
	* testsuite/binutils-all/objcopy.exp: Run new test.
2018-04-26 15:12:42 +01:00
John Darrington 67f846b59b Stop the assembler from overwriting its output file.
* as.c (main): Fail if the output is the same as one of the input
	files.
	* testsuite/gas/all/gas.exp: Test the new feature.
2018-04-12 15:08:59 +01:00
Alan Modra 219d1afa89 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
Jim Wilson 5f71e59e1a Fix build error with --enable-targets=all.
gas/
	* as.c (INITIALIZING_EMULS): Define.
	* config/obj-multi.h (FAKE_LABEL_NAME): When INITIALIZING_EMULS set,
	don't define it.
2017-11-23 12:30:47 -08:00
Jim Wilson 2469b3c584 Riscv ld-elf/stab failure and fake label cleanup.
* as.c: Include write.h.
	(common_emul_init): Use FAKE_LABEL_NAME.
	* ecoff.c (add_file, ecoff_directive_end, ecoff_directive_loc):
	Likewise.
	(ecoff_build_symbols): Use FAKE_LABEL_CHAR.
	* expr.c (get_symbol_name): Use FAKE_LABEL_CHAR.  Accept only if
	input_from_string is TRUE.
	* read.c (input_from_string): New.
	(read_symbol_name): Use FAKE_LABEL_CHAR.  Accept only if
	input_from_string is TRUE.
	(temp_ilp): Set input_from_string to TRUE.
	(restore_ilp): Set input_from_string to FALSE.
	* read.h (input_from_string): Declare.
	* symbols.c: Include write.h
	(S_IS_LOCAL): Check for FAKE_LABEL_CHAR.
	(symbol_relc_make_sym): Fix comment refering to default fake label
	string.
	* write.h (FAKE_LABEL_CHAR): New.
	* config/tc-riscv.h (FAKE_LABEL_CHAR): Define.
	* testsuite/gas/all/err-fakelabel.s: New.
2017-11-22 11:20:48 -08:00
Alan Modra 992a06eea4 gas and ld pluralization fixes
gas/
	* as.c (main): Properly pluralize messages.
	* frags.c (frag_grow): Likewise.
	* read.c (emit_expr_with_reloc, emit_expr_fix): Likewise.
	(parse_bitfield_cons): Likewise.
	* write.c (fixup_segment, compress_debug, write_contents): Likewise.
	(relax_segment): Likewise.
	* config/tc-arm.c (s_arm_elf_cons): Likewise.
	* config/tc-cr16.c (l_cons): Likewise.
	* config/tc-i370.c (i370_elf_cons): Likewise.
	* config/tc-m68k.c (m68k_elf_cons): Likewise.
	* config/tc-msp430.c (msp430_operands): Likewise.
	* config/tc-s390.c (s390_elf_cons, s390_literals): Likewise.
	* config/tc-mcore.c (md_apply_fix): Likewise.
	* config/tc-tic54x.c (md_assemble): Likewise.
	* config/tc-xtensa.c (xtensa_elf_cons): Likewise.
	(xg_expand_assembly_insn): Likewise.
	* config/xtensa-relax.c (build_transition): Likewise.
ld/
	* ldlang.c (lang_size_sections_1): Properly pluralize messages.
	(lang_check_section_addresses): Likewise.
2017-11-07 17:00:37 +10:30
Tristan Gingold e4943f2c75 Remove datasize measurements based on sbrk()
binutils/
	* nm.c (show_stats): Remove variable.
	(long_options): Remove --stats option.
	(main): Remove handling of --stats.

ld/
	* ldmain.c (main): Remove display of data size.

gas/
	* as.c (start_sbrk): Remove.
	(main): Remove assignment.
	(dump_statistics): Remove display of data size.
2017-07-19 09:55:12 +02:00
Nathan Sidwell 1ec4b9f28b Catch gas exit-via-signal
gas/
	* as.h (gas_assert): Use abort.
	(as_assert): Remove.
	(signal_init): Declare.
	* as.c (main): Call signal_init.
	* messages.c: #include <signal.h>
	(as_assert): Delete.
	(as_abort): Allow NULL FILE.
	(signal_crash): New.
	(signal_init): Register fatal signal handlers.
	* configure.ac: Check for strsignal.
	* config.in: Rebuilt.
	* configure: Rebuilt.
2017-01-18 08:23:10 -05:00
Alan Modra 2571583aed Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
Andrew Burgess 9004b6bd58 Allow ARC target to be configured with --with-cpu=<cpu-name>.
gas	* config.in (TARGET_WITH_CPU): Undefine.
	* configure.ac: Add --with-cpu support, and define in config.h.
	* configure: Regenerate.
	* config/tc-arc.c: Use TARGET_WITH_CPU to select default CPU.
	* NEWS: Mention new configure option.
2016-06-30 11:14:41 +01:00
Nick Clifton 2edb36e77f Add command line option to stop the assembler from padding the end of sections to their alignment boundary.
PR gas/20247
	* as.h (do_not_pad_sections_to_alignment): New global variable.
	* as.c (show_usage): Add --no-pad-sections.
	(parse_args): Likewise.
	* write.c (size_seg): Skip padding the end of the section if
	requested from the command line.
	(SUB_SEGMENT_ALIGN): Likewise.
	* doc/as.texinfo: Document the new option.
	* NEWS: Mention the new feature.
	* testsuite/gas/elf/section11.s: New test.
	* testsuite/gas/elf/section11.d: New test driver.
	* testsuite/gas/elf/elf.exp: Run the new test.
2016-06-27 13:51:06 +01:00
Trevor Saunders add39d2344 use XNEW and related macros more
Its a bit shorter and simpler than raw xmalloc.

gas/ChangeLog:

2016-05-13  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* app.c (app_push): Use XNEW and related macros.
	* as.c (parse_args): Likewise.
	* cgen.c (make_right_shifted_expr): Likewise.
	(gas_cgen_tc_gen_reloc): Likewise.
	* config/bfin-defs.h: Likewise.
	* config/bfin-parse.y: Likewise.
	* config/obj-coff.c (stack_init): Likewise.
	(stack_push): Likewise.
	(coff_obj_symbol_new_hook): Likewise.
	(coff_obj_symbol_clone_hook): Likewise.
	(add_lineno): Likewise.
	(coff_frob_symbol): Likewise.
	* config/obj-elf.c (obj_elf_section_name): Likewise.
	(build_group_lists): Likewise.
	* config/obj-evax.c (evax_symbol_new_hook): Likewise.
	* config/obj-macho.c (obj_mach_o_indirect_symbol): Likewise.
	* config/tc-aarch64.c (insert_reg_alias): Likewise.
	(find_or_make_literal_pool): Likewise.
	(add_to_lit_pool): Likewise.
	(fill_instruction_hash_table): Likewise.
	* config/tc-alpha.c (load_expression): Likewise.
	(emit_jsrjmp): Likewise.
	(s_alpha_ent): Likewise.
	(s_alpha_end): Likewise.
	(s_alpha_linkage): Likewise.
	(md_begin): Likewise.
	(tc_gen_reloc): Likewise.
	* config/tc-arc.c (arc_insert_opcode): Likewise.
	(arc_extcorereg): Likewise.
	* config/tc-bfin.c: Likewise.
	* config/tc-cr16.c: Likewise.
	* config/tc-cris.c: Likewise.
	* config/tc-crx.c (preprocess_reglist): Likewise.
	* config/tc-d10v.c: Likewise.
	* config/tc-frv.c (frv_insert_vliw_insn): Likewise.
	(frv_tomcat_shuffle): Likewise.
	* config/tc-h8300.c: Likewise.
	* config/tc-i370.c (i370_macro): Likewise.
	* config/tc-i386.c (lex_got): Likewise.
	(md_parse_option): Likewise.
	* config/tc-ia64.c (alloc_record): Likewise.
	(set_imask): Likewise.
	(save_prologue_count): Likewise.
	(dot_proc): Likewise.
	(dot_endp): Likewise.
	(ia64_frob_label): Likewise.
	(add_qp_imply): Likewise.
	(add_qp_mutex): Likewise.
	(mark_resource): Likewise.
	(dot_alias): Likewise.
	* config/tc-m68hc11.c: Likewise.
	* config/tc-m68k.c (m68k_frob_label): Likewise.
	(s_save): Likewise.
	(mri_control_label): Likewise.
	(push_mri_control): Likewise.
	(build_mri_control_operand): Likewise.
	(s_mri_else): Likewise.
	(s_mri_break): Likewise.
	(s_mri_next): Likewise.
	(s_mri_for): Likewise.
	(s_mri_endw): Likewise.
	* config/tc-metag.c (create_mnemonic_htab): Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mmix.c (s_loc): Likewise.
	* config/tc-nds32.c (nds32_relax_hint): Likewise.
	* config/tc-nios2.c (nios2_insn_reloc_new): Likewise.
	* config/tc-rl78.c: Likewise.
	* config/tc-rx.c (rx_include): Likewise.
	* config/tc-sh.c: Likewise.
	* config/tc-sh64.c (shmedia_frob_section_type): Likewise.
	* config/tc-sparc.c: Likewise.
	* config/tc-spu.c: Likewise.
	* config/tc-tic6x.c (static tic6x_unwind_info *tic6x_get_unwind): Likewise.
	(tic6x_start_unwind_section): Likewise.
	* config/tc-tilegx.c: Likewise.
	* config/tc-tilepro.c: Likewise.
	* config/tc-v850.c: Likewise.
	* config/tc-visium.c: Likewise.
	* config/tc-xgate.c: Likewise.
	* config/tc-xtensa.c (xtensa_translate_old_userreg_ops): Likewise.
	(new_resource_table): Likewise.
	(resize_resource_table): Likewise.
	(xtensa_create_trampoline_frag): Likewise.
	(xtensa_maybe_create_literal_pool_frag): Likewise.
	(cache_literal_section): Likewise.
	* config/xtensa-relax.c (append_transition): Likewise.
	(append_condition): Likewise.
	(append_value_condition): Likewise.
	(append_constant_value_condition): Likewise.
	(append_literal_op): Likewise.
	(append_label_op): Likewise.
	(append_constant_op): Likewise.
	(append_field_op): Likewise.
	(append_user_fn_field_op): Likewise.
	(enter_opname_n): Likewise.
	(enter_opname): Likewise.
	(split_string): Likewise.
	(parse_insn_templ): Likewise.
	(clone_req_or_option_list): Likewise.
	(clone_req_option_list): Likewise.
	(parse_option_cond): Likewise.
	(parse_insn_pattern): Likewise.
	(parse_insn_repl): Likewise.
	(build_transition): Likewise.
	(build_transition_table): Likewise.
	* dw2gencfi.c (alloc_fde_entry): Likewise.
	(alloc_cfi_insn_data): Likewise.
	(cfi_add_CFA_remember_state): Likewise.
	(dot_cfi_escape): Likewise.
	(dot_cfi_fde_data): Likewise.
	(select_cie_for_fde): Likewise.
	* dwarf2dbg.c (dwarf2_directive_loc): Likewise.
	* ecoff.c (ecoff_add_bytes): Likewise.
	(ecoff_build_debug): Likewise.
	* input-scrub.c (input_scrub_push): Likewise.
	(input_scrub_begin): Likewise.
	(input_scrub_next_buffer): Likewise.
	* itbl-ops.c (append_insns_as_macros): Likewise.
	(alloc_entry): Likewise.
	(alloc_field): Likewise.
	* listing.c (listing_newline): Likewise.
	(listing_listing): Likewise.
	* macro.c (get_any_string): Likewise.
	(delete_macro): Likewise.
	* stabs.c (generate_asm_file): Likewise.
	(stabs_generate_asm_lineno): Likewise.
	* subsegs.c (subseg_change): Likewise.
	(subseg_get): Likewise.
	* symbols.c (define_dollar_label): Likewise.
	(symbol_relc_make_sym): Likewise.
	* write.c (write_relocs): Likewise.
2016-05-13 00:35:51 -04:00
Trevor Saunders 325801bda4 use XNEW and related macros more
gas/ChangeLog:

2016-04-03  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* app.c (app_push): use XNEW macro.
	* as.c: Likewise.
	* config/obj-elf.c (obj_elf_change_section): Likewise.
	(elf_copy_symbol_attributes): Likewise.
	(obj_elf_size): Likewise.
	(build_group_lists): Likewise.
	* config/tc-aarch64.c (add_operand_error_record): Likewise.
	(md_assemble): Likewise.
	(tc_gen_reloc): Likewise.
	(get_upper_str): Likewise.
	(aarch64_parse_features): Likewise.
	* config/tc-arm.c (insert_reg_alias): Likewise.
	(insert_neon_reg_alias): Likewise.
	(find_or_make_literal_pool): Likewise.
	(s_arm_elf_cons): Likewise.
	(add_unwind_opcode): Likewise.
	(arm_parse_extension): Likewise.
	* config/tc-avr.c (create_record_for_frag): Likewise.
	* config/tc-crx.c: Likewise.
	* config/tc-d30v.c: Likewise.
	* config/tc-dlx.c (s_proc): Likewise.
	* config/tc-ft32.c: Likewise.
	* config/tc-h8300.c: Likewise.
	* config/tc-hppa.c (pa_proc): Likewise.
	(create_new_space): Likewise.
	(create_new_subspace): Likewise.
	* config/tc-i860.c: Likewise.
	* config/tc-i960.c: Likewise.
	* config/tc-ia64.c: Likewise.
	* config/tc-iq2000.c (iq2000_add_macro): Likewise.
	(iq2000_record_hi16): Likewise.
	* config/tc-m32c.c (m32c_indirect_operand): Likewise.
	* config/tc-m32r.c (debug_sym): Likewise.
	(m32r_record_hi16): Likewise.
	* config/tc-m68k.c (m68k_ip): Likewise.
	(md_begin): Likewise.
	* config/tc-mcore.c: Likewise.
	* config/tc-microblaze.c (check_got): Likewise.
	* config/tc-mips.c (append_insn): Likewise.
	(s_mipsset): Likewise.
	(mips_record_label): Likewise.
	(s_mips_end): Likewise.
	* config/tc-mmix.c (mmix_frob_file): Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-moxie.c: Likewise.
	* config/tc-msp430.c: Likewise.
	* config/tc-nds32.c (nds32_elf_save_pseudo_pattern): Likewise.
	* config/tc-ns32k.c: Likewise.
	* config/tc-or1k.c: Likewise.
	* config/tc-pdp11.c: Likewise.
	* config/tc-pj.c (fake_opcode): Likewise.
	* config/tc-ppc.c (ppc_apuinfo_section_add): Likewise.
	(ppc_macro): Likewise.
	(ppc_dwsect): Likewise.
	(ppc_machine): Likewise.
	* config/tc-rl78.c (rl78_frag_init): Likewise.
	* config/tc-rx.c (rx_frag_init): Likewise.
	* config/tc-s390.c (s390_lit_suffix): Likewise.
	(s390_machine): Likewise.
	(s390_machinemode): Likewise.
	* config/tc-score.c (s3_insert_reg): Likewise.
	(s3_gen_reloc): Likewise.
	* config/tc-score7.c (s7_insert_reg): Likewise.
	(s7_gen_reloc): Likewise.
	* config/tc-tic30.c (tic30_operand): Likewise.
	* config/tc-tic4x.c (tic4x_inst_make): Likewise.
	* config/tc-tic54x.c (stag_add_field): Likewise.
	(tic54x_struct): Likewise.
	(tic54x_space): Likewise.
	(tic54x_field): Likewise.
	(tic54x_mlib): Likewise.
	(subsym_substitute): Likewise.
	* config/tc-tic6x.c (tic6x_frob_label): Likewise.
	* config/tc-vax.c: Likewise.
	* config/tc-xc16x.c: Likewise.
	* config/tc-xtensa.c (xtensa_add_insn_label): Likewise.
	(directive_push): Likewise.
	(xtensa_begin_directive): Likewise.
	(tokenize_arguments): Likewise.
	(xtensa_add_literal_sym): Likewise.
	(new_resource_table): Likewise.
	(resize_resource_table): Likewise.
	(emit_single_op): Likewise.
	(xtensa_create_trampoline_frag): Likewise.
	(xtensa_maybe_create_literal_pool_frag): Likewise.
	(xtensa_add_config_info): Likewise.
	(xtensa_realloc_fixup_cache): Likewise.
	(add_subseg_info): Likewise.
	(cache_literal_section): Likewise.
	(add_xt_block_frags): Likewise.
	(add_xt_prop_frags): Likewise.
	(init_op_placement_info_table): Likewise.
	(build_section_rename): Likewise.
	* config/tc-z80.c: Likewise.
	* config/tc-z8k.c: Likewise.
	* depend.c (register_dependency): Likewise.
	* dwarf2dbg.c (get_line_subseg): Likewise.
	(dwarf2_gen_line_info_1): Likewise.
	(get_filenum): Likewise.
	* ecoff.c (allocate_scope): Likewise.
	(allocate_vlinks): Likewise.
	(allocate_shash): Likewise.
	(allocate_thash): Likewise.
	(allocate_tag): Likewise.
	(allocate_forward): Likewise.
	(allocate_thead): Likewise.
	(allocate_lineno_list): Likewise.
	* expr.c (make_expr_symbol): Likewise.
	* hash.c (hash_new_sized): Likewise.
	* input-file.c (input_file_push): Likewise.
	* listing.c (file_info): Likewise.
	(listing_newline): Likewise.
	* macro.c (new_formal): Likewise.
	(define_macro): Likewise.
	* remap.c (add_debug_prefix_map): Likewise.
	* symbols.c (symbol_find_noref): Likewise.
	(define_dollar_label): Likewise.
	(fb_label_instance_inc): Likewise.
	(symbol_relc_make_value): Likewise.
2016-04-03 20:43:23 -04:00
Trevor Saunders 97830986a1 cast to char * when assigning to optarg
gas/ChangeLog:

2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* as.c (parse_args): Cast literal to char * when assigning to optarg.
2016-03-31 07:28:08 -04:00
Trevor Saunders a90fb5e33b rename flag_size_check to flag_allow_nonconst_size and make it a bool
This name describes what the variable means slightly better, and the enum with
two values that is only used for this one variable is kind of silly.

gas/ChangeLog:

2016-03-25  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* as.c (parse_args): Adjust.
	* as.h (flag_size_check): Rename to flag_allow_nonconst_size.
	* config/obj-elf.c (elf_frob_symbol): Adjust.
2016-03-25 20:24:57 -04:00
H.J. Lu b8871f357f Properly implement STT_COMMON
The BFD configure option, --enable-elf-stt-common, can't be to used to
verify STT_COMMON implementation with the normal binutils build.  Instead,
this patch removes it from BFD.  It adds --elf-stt-common=[no|yes] to ELF
assembler/objcopy and adds -z common/-z nocommon to ld.

A configure option, --enable-elf-stt-common, is added to gas to specify
whether ELF assembler should generate common symbols with the STT_COMMON
type by default.

Since BSF_KEEP_G is never used, it is renamed to BSF_ELF_COMMON for ELF
common symbols.

bfd/

	PR ld/19645
	* bfd.c (bfd): Change flags to 20 bits.
	(BFD_CONVERT_ELF_COMMON): New.
	(BFD_USE_ELF_STT_COMMON): Likewise.
	(BFD_FLAGS_SAVED): Add BFD_CONVERT_ELF_COMMON and
	BFD_USE_ELF_STT_COMMON.
	(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
	* configure.ac: Remove --enable-elf-stt-common.
	* elf.c (swap_out_syms): Choose STT_COMMON or STT_OBJECT for
	common symbol depending on BFD_CONVERT_ELF_COMMON and
	BFD_USE_ELF_STT_COMMON.
	* elfcode.h (elf_slurp_symbol_table): Set BSF_ELF_COMMON for
	STT_COMMON.
	* elflink.c (bfd_elf_link_mark_dynamic_symbol): Also check
	STT_COMMON.
	(elf_link_convert_common_type): New function.
	(elf_link_output_extsym): Choose STT_COMMON or STT_OBJECT for
	common symbol depending on BFD_CONVERT_ELF_COMMON and
	BFD_USE_ELF_STT_COMMON.  Set sym.st_info after sym.st_shndx.
	* elfxx-target.h (TARGET_BIG_SYM): Add BFD_CONVERT_ELF_COMMON
	and BFD_USE_ELF_STT_COMMON to object_flags.
	(TARGET_LITTLE_SYM): Likewise.
	* syms.c (BSF_KEEP_G): Renamed to ...
	(BSF_ELF_COMMON): This.
	* bfd-in2.h: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.

binutils/

	PR ld/19645
	* NEWS: Mention --elf-stt-common= for objcopy.
	* doc/binutils.texi: Document --elf-stt-common= for objcopy.
	* objcopy.c (do_elf_stt_common): New.
	(command_line_switch): Add OPTION_ELF_STT_COMMON.
	(copy_options): Add --elf-stt-common=.
	(copy_usage): Add --elf-stt-common=.
	(copy_object): Also check do_elf_stt_common for ELF targets.
	(copy_file): Handle do_elf_stt_common.
	(copy_main): Handle OPTION_ELF_STT_COMMON.
	* readelf.c (apply_relocations): Support STT_COMMON.
	* testsuite/binutils-all/common-1.s: New file.
	* testsuite/binutils-all/common-1a.d: Likewise.
	* testsuite/binutils-all/common-1b.d: Likewise.
	* testsuite/binutils-all/common-1c.d: Likewise.
	* testsuite/binutils-all/common-1d.d: Likewise.
	* testsuite/binutils-all/common-1e.d: Likewise.
	* testsuite/binutils-all/common-1f.d: Likewise.
	* testsuite/binutils-all/common-2.s: Likewise.
	* testsuite/binutils-all/common-2a.d: Likewise.
	* testsuite/binutils-all/common-2b.d: Likewise.
	* testsuite/binutils-all/common-2c.d: Likewise.
	* testsuite/binutils-all/common-2d.d: Likewise.
	* testsuite/binutils-all/common-2e.d: Likewise.
	* testsuite/binutils-all/common-2f.d: Likewise.
	* testsuite/binutils-all/objcopy.exp
	(objcopy_test_elf_common_symbols): New proc.
	Run objcopy_test_elf_common_symbols for ELF targets

gas/

	PR ld/19645
	* NEWS: Mention --enable-elf-stt-common and --elf-stt-common=
	for ELF assemblers.
	* as.c (flag_use_elf_stt_common): New.
	(show_usage): Add --elf-stt-common=.
	(option_values): Add OPTION_ELF_STT_COMMON.
	(std_longopts): Add --elf-stt-common=.
	(parse_args): Handle --elf-stt-common=.
	* as.h (flag_use_elf_stt_common): New.
	* config.in: Regenerated.
	* configure: Likewise.
	* configure.ac: Add --enable-elf-stt-common and define
	DEFAULT_GENERATE_ELF_STT_COMMON.
	* gas/write.c (write_object_file): Set BFD_CONVERT_ELF_COMMON
	and BFD_USE_ELF_STT_COMMON if flag_use_elf_stt_common is set.
	* doc/as.texinfo: Document --elf-stt-common=.
	* testsuite/gas/elf/common3.s: New file.
	* testsuite/gas/elf/common3a.d: Likewise.
	* testsuite/gas/elf/common3b.d: Likewise.
	* testsuite/gas/elf/common4.s: Likewise.
	* testsuite/gas/elf/common4a.d: Likewise.
	* testsuite/gas/elf/common4b.d: Likewise.
	* testsuite/gas/i386/dw2-compress-3b.d: Likewise.
	* testsuite/gas/i386/dw2-compressed-3b.d: Likewise.
	* testsuite/gas/elf/elf.exp: Run common3a, common3b, common4a
	and common4b.
	* testsuite/gas/i386/dw2-compress-3.d: Renamed to ...
	* testsuite/gas/i386/dw2-compress-3a.d: This.  Pass
	--elf-stt-common=no to as.
	* testsuite/gas/i386/dw2-compressed-3.d: Renamed to ...
	* testsuite/gas/i386/dw2-compressed-3a.d: This.  Pass
	--elf-stt-common=no to as.
	* testsuite/gas/i386/i386.exp: Run dw2-compress-3a,
	dw2-compress-3b, dw2-compressed-3a and dw2-compressed-3b instead
	of dw2-compress-3 and dw2-compressed-3.

include/

	PR ld/19645
	* bfdlink.h (bfd_link_elf_stt_common): New enum.
	(bfd_link_info): Add elf_stt_common.

ld/

	PR ld/19645
	* NEWS: Mention -z common/-z nocommon for ELF targets.
	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
	-z common and -z nocommon.
	* ld.texinfo: Document -z common/-z nocommon.
	* lexsup.c (elf_shlib_list_options): Add -z common/-z nocommon.
	* testsuite/ld-elf/tls_common.exp: Test --elf-stt-common=no and
	--elf-stt-common=yes with assembler.
	* testsuite/ld-elfcomm/common-1.s: New file.
	* testsuite/ld-elfcomm/common-1a.d: Likewise.
	* testsuite/ld-elfcomm/common-1b.d: Likewise.
	* testsuite/ld-elfcomm/common-1c.d: Likewise.
	* testsuite/ld-elfcomm/common-1d.d: Likewise.
	* testsuite/ld-elfcomm/common-1e.d: Likewise.
	* testsuite/ld-elfcomm/common-1f.d: Likewise.
	* testsuite/ld-elfcomm/common-2.s: Likewise.
	* testsuite/ld-elfcomm/common-2a.d: Likewise.
	* testsuite/ld-elfcomm/common-2b.d: Likewise.
	* testsuite/ld-elfcomm/common-2c.d: Likewise.
	* testsuite/ld-elfcomm/common-2d.d: Likewise.
	* testsuite/ld-elfcomm/common-2e.d: Likewise.
	* testsuite/ld-elfcomm/common-2f.d: Likewise.
	* testsuite/ld-elfcomm/common-3a.rd: Likewise.
	* testsuite/ld-elfcomm/common-3b.rd: Likewise.
	* testsuite/ld-i386/pr19645.d: Likewise.
	* testsuite/ld-i386/pr19645.s: Likewise.
	* testsuite/ld-x86-64/largecomm-1.s: Likewise.
	* testsuite/ld-x86-64/largecomm-1a.d: Likewise.
	* testsuite/ld-x86-64/largecomm-1b.d: Likewise.
	* testsuite/ld-x86-64/largecomm-1c.d: Likewise.
	* testsuite/ld-x86-64/largecomm-1d.d: Likewise.
	* testsuite/ld-x86-64/largecomm-1e.d: Likewise.
	* testsuite/ld-x86-64/largecomm-1f.d: Likewise.
	* testsuite/ld-x86-64/pr19645.d: Likewise.
	* testsuite/ld-x86-64/pr19645.s: Likewise.
	* testsuite/ld-elfcomm/elfcomm.exp: Test --elf-stt-common=yes
	with assembler.
	(assembler_generates_commons): Removed.
	Run -z common/-z nocommon tests.  Run *.d tests.
	* testsuite/ld-i386/i386.exp: Run pr19645.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-x86-64/dwarfreloc.exp: Test --elf-stt-common with
	assembler.  Test STT_COMMON with readelf.
2016-02-26 05:01:34 -08:00
Trevor Saunders e0471c16c5 Convert more variables to a constant form.
* as.c (select_emulation_mode): Add const qualifiers.
	* as.h: Likewise.
	* config/bfin-defs.h: Likewise.
	* config/bfin-parse.y: Likewise.
	* config/rx-parse.y: Likewise.
	* config/tc-aarch64.c (struct aarch64_option_table): Likewise.
	(struct aarch64_cpu_option_table): Likewise.
	(struct aarch64_arch_option_table): Likewise.
	(struct aarch64_option_cpu_value_table): Likewise.
	(struct aarch64_long_option_table): Likewise.
	(struct aarch64_option_abi_value_table): Likewise.
	* config/tc-arm.c (struct reloc_entry): Likewise.
	(tc_gen_reloc): Likewise.
	(struct arm_option_table): Likewise.
	(struct arm_legacy_option_table): Likewise.
	(struct arm_cpu_option_table): Likewise.
	(struct arm_arch_option_table): Likewise.
	(struct arm_option_extension_value_table): Likewise.
	(struct arm_option_fpu_value_table): Likewise.
	(struct arm_option_value_table): Likewise.
	(struct arm_long_option_table): Likewise.
	* config/tc-avr.c (struct avr_opcodes_s): Likewise.
	(struct mcu_type_s): Likewise.
	(struct exp_mod_s): Likewise.
	(avr_operand): Likewise.
	(avr_operands): Likewise.
	* config/tc-d10v.c (md_begin): Likewise.
	* config/tc-dlx.c: Likewise.
	* config/tc-fr30.c (fr30_is_colon_insn): Likewise.
	* config/tc-ft32.c (parse_condition): Likewise.
	* config/tc-h8300.c (do_a_fix_imm): Likewise.
	* config/tc-hppa.c (pa_ip): Likewise.
	(hppa_regname_to_dw2regnum): Likewise.
	* config/tc-i370.c (i370_elf_suffix): Likewise.
	* config/tc-i960.c (struct tabentry): Likewise.
	* config/tc-m32r.c: Likewise.
	* config/tc-m68k.c: Likewise.
	* config/tc-m68k.h: Likewise.
	* config/tc-mcore.c (parse_psrmod): Likewise.
	* config/tc-metag.c (struct metag_core_option): Likewise.
	(struct metag_long_option): Likewise.
	* config/tc-microblaze.c: Likewise.
	* config/tc-mips.c (macro): Likewise.
	* config/tc-mn10200.c: Likewise.
	* config/tc-mn10300.c: Likewise.
	* config/tc-msp430.c (struct rcodes_s): Likewise.
	(struct hcodes_s): Likewise.
	(md_parse_option): Likewise.
	* config/tc-ns32k.c (struct ns32k_option): Likewise.
	(optlist): Likewise.
	* config/tc-ppc.c (ppc_elf_suffix): Likewise.
	(tc_ppc_regname_to_dw2regnum): Likewise.
	* config/tc-ppc.h: Likewise.
	* config/tc-rl78.c: Likewise.
	* config/tc-rx.c (struct cpu_type): Likewise.
	* config/tc-sh.c (sh_regname_to_dw2regnum): Likewise.
	* config/tc-sparc.c (struct priv_reg_entry): Likewise.
	(sparc_ip): Likewise.
	* config/tc-spu.c (insn_fmt_string): Likewise.
	* config/tc-tic54x.c (tic54x_set_default_include): Likewise.
	* config/tc-v850.c: Likewise.
	* config/tc-visium.c (struct visium_arch_option_table): Likewise.
	(struct visium_long_option_table): Likewise.
	* config/tc-xgate.c: Likewise.
	* config/tc-z8k.c: Likewise.
	* read.c (add_include_dir): Likewise.
	* read.h: Likewise.
2016-02-25 16:55:21 +00:00
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
Nick Clifton e12fe5554c Add a gas configure option to select the default behaviour for the generation of debug sections - compressed or uncompressed.
PR gas/19109
	* configure.ac: Add option --enable-compressed-debug-sections.
	This sets the default behaviour for compressing debug sections.
	* as.c (flag_compress_debug): Define and initialise to
	COMPRESS_DEBUG_GABI_ZLIB if DEFAULT_COMPRESS_DEBUG is set.
	(show_usage): Indicate whether --no-compress-debug-sections
	or --compress-debug-sections is the default.
	* config/tc-i386.c (flag_compress_debug): Delete definition.
	* doc/as.texinfo (--nocompress-debug-sectionas): Update
	description.
	* NEWS: Announce the new feature.
	* config.in: Regenerate.
	* configure: Regenerate.
2015-10-19 11:45:54 +01:00
H.J. Lu 19a7fe52ae Make default compression gABI compliant
All programs in binutils+gdb git repo now support gABI compression
with the SHF_COMPRESSED bit.  This patch makes the zlib-gabi option
as compression default for gas, gold, ld and objcopy, instead of the
zlib-gnu option whose outputs are incompatible with gABI.

binutils/

	* objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not
	zlib-gnu.
	* doc/binutils.texi: Change --compress-debug-sections and
	--compress-debug-sections=zlib to zlib-gabi.

binutils/testsuite/

	* binutils-all/compress.exp: Update.

gas/

	* as.c (parse_args): Make --compress-debug-sections and
	--compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* doc/as.texinfo: Change --compress-debug-sections and
	--compress-debug-sections=zlib to zlib-gabi.

gold/

	* compressed_output.cc (Output_compressed_section::set_final_data_size):
	Make --compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* testsuite/Makefile.am (flagstest_compress_debug_sections.check):
	Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
	".zdebug_".
	* testsuite/Makefile.in: Regenerated.

ld/

	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make
	--compress-debug-sections=zlib the same as
	--compress-debug-sections=zlib-gabi.
	* ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi.

ld/testsuite/

	* ld-elf/zlibbegin.rS: Updated to .debug_.* with the
	SHF_COMPRESSED bit.
	* ld-elf/zlibnormal.rS: Likewise.
2015-07-14 10:26:23 -07:00
H.J. Lu ee0c0c503d Remove COMPRESS_DEBUG_ZLIB
COMPRESS_DEBUG_ZLIB isn't needed.  This patch removes COMPRESS_DEBUG_ZLIB
and replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.

bfd/

	* bfd-in.h (compressed_debug_section_type): Remove
	COMPRESS_DEBUG_ZLIB.
	* bfd-in2.h : Regenerated.
gas/

	* as.c (parse_args): Replace COMPRESS_DEBUG_ZLIB with
	COMPRESS_DEBUG_GNU_ZLIB.
	* config/tc-i386.c (flag_compress_debug): Likewise.

ld/

	* emultempl/elf32.em  (gld${EMULATION_NAME}_handle_option):
	Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.
2015-06-28 06:30:10 -07:00
Nicolas Pitre 451133cefa gas: section name substitution sequence
This patch adds the ability to automatically construct a section name
based on the prior section.

When gas is invoked with --sectname-subst, the occurrence of %S in a
section name will be substituted by the name of the current section. For
example:

	.macro exception_code
	.pushsection %S.exception
	[exception code here]
	.popsection
	.endm

	.text
	[code]
	exception_code
	[...]

	.section .init
	[init code]
	exception_code
	[...]

The first and second exception_code invocations create the
.text.exception and the .init.exception sections respectively.  This is
useful e.g. to discriminate between anciliary sections that are tied to
.init code and can be discarded at run time when initialization is over
vs anciliary sections tied to .text sections that need to stay resident.

	* as.c (show_usage): Document --sectname-subst.
	(parse_args): Add --sectname-subst.
	* as.h (flag_sectname_subst): New.
	* config/obj-elf.c (obj_elf_section_name): Add %S substitution.
	* doc/as.texinfo: Document it.
2015-06-17 08:52:00 +09:30
H.J. Lu 151411f8af Add SHF_COMPRESSED support to gas and objcopy
This patch adds --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}
options to gas and objcopy for ELF files. They control how DWARF debug
sections are compressed.  --compress-debug-sections=none is equivalent to
--nocompress-debug-sections.  --compress-debug-sections=zlib and
--compress-debug-sections=zlib-gnu are equivalent to
--compress-debug-sections.  --compress-debug-sections=zlib-gabi compresses
DWARF debug sections with SHF_COMPRESSED from the ELF ABI.  No linker
changes are required to support SHF_COMPRESSED.

bfd/

	* archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI
	bit.
	* bfd.c (bfd::flags): Increase size to 18 bits.
	(BFD_COMPRESS_GABI): New.
	(BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI.
	(BFD_FLAGS_FOR_BFD_USE_MASK): Likewise.
	(bfd_update_compression_header): New fuction.
	(bfd_check_compression_header): Likewise.
	(bfd_get_compression_header_size): Likewise.
	(bfd_is_section_compressed_with_header): Likewise.
	* compress.c (MAX_COMPRESSION_HEADER_SIZE): New.
	(bfd_compress_section_contents): Return the uncompressed size if
	the full section contents is compressed successfully.  Support
	converting from/to .zdebug* sections.
	(bfd_get_full_section_contents): Call
	bfd_get_compression_header_size to get compression header size.
	(bfd_is_section_compressed): Renamed to ...
	(bfd_is_section_compressed_with_header): This.  Add a pointer
	argument to return compression header size.
	(bfd_is_section_compressed): Use it.
	(bfd_init_section_decompress_status): Call
	bfd_get_compression_header_size to get compression header size.
	Return FALSE if uncompressed section size is 0.
	* elf.c (_bfd_elf_make_section_from_shdr): Support converting
	from/to .zdebug* sections.
	* bfd-in2.h: Regenerated.

binutils/

	* objcopy.c (do_debug_sections): Add compress_zlib,
	compress_gnu_zlib and compress_gabi_zlib.
	(copy_options): Use optional_argument on compress-debug-sections.
	(copy_usage): Update --compress-debug-sections.
	(copy_file): Handle compress_zlib, compress_gnu_zlib and
	compress_gabi_zlib.
	(copy_main): Handle
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
	* doc/binutils.texi: Document
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.

binutils/testsuite/

	* compress.exp: Add tests for
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
	* binutils-all/dw2-3.rS: New file.
	* binutils-all/dw2-3.rt: Likewise.
	* binutils-all/libdw2-compressedgabi.out: Likewise.

gas/

	* as.c (show_usage): Update --compress-debug-sections.
	(std_longopts): Use optional_argument on compress-debug-sections.
	(parse_args): Handle
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
	* as.h (compressed_debug_section_type): New.
	(flag_compress_debug): Change type to compressed_debug_section_type.
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.
	* write.c (compress_debug): Set BFD_COMPRESS_GABI for
	--compress-debug-sections=zlib-gabi.  Call
	bfd_get_compression_header_size to get compression header size.
	Don't rename section name for --compress-debug-sections=zlib-gabi.
	* config/tc-i386.c (compressed_debug_section_type): Set to
	COMPRESS_DEBUG_ZLIB.
	* doc/as.texinfo: Document
	--compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}.

gas/testsuite/

	* gas/i386/dw2-compressed-1.d: New file.
	* gas/i386/dw2-compressed-2.d: Likewise.
	* gas/i386/dw2-compressed-3.d: Likewise.
	* gas/i386/x86-64-dw2-compressed-2.d: Likewise.
	* gas/i386/i386.exp: Run dw2-compressed-2, dw2-compressed-1,
	dw2-compressed-3 and x86-64-dw2-compressed-2.

ld/testsuite/

	* ld-elf/compress.exp: Add a test for
	--compress-debug-sections=zlib-gabi.
	(build_tests): Add 2 tests for --compress-debug-sections=zlib-gabi.
	(run_tests): Likewise.
	Verify linker output with zlib-gabi compressed debug input.
	* ld-elf/compressed1a.d: New file.
	* ld-elf/compressed1b.d: Likewise.
	* ld-elf/compressed1c.d: Likewise.
2015-04-08 07:54:09 -07:00
H.J. Lu 0138187e9f Add --with-system-zlib in gas
This patch adds --with-system-zlib and remove --with-zlib in gas.

gas/

	* Makefile.am (ZLIBINC): New.
	(AM_CFLAGS): Add $(ZLIBINC).
	* as.c: (show_usage): Don't check HAVE_ZLIB_H.
	(parse_args): Likewise.
	* compress-debug.c: Don't check HAVE_ZLIB_H to include <zlib.h>.
	(compress_init): Don't check HAVE_ZLIB_H.
	(compress_data): Likewise.
	(compress_finish): Likewise.
	* configure.ac (AM_ZLIB): Removed.
	(zlibinc): New.  AC_SUBST.
	Add --with-system-zlib.
	* Makefile.in: Regenerated.
	* config.in: Likewise.
	* configure: Likewise.
	* doc/Makefile.in: Likewise.

gas/testsuite/

	* gas/i386/dw2-compress-1.d: Expect .zdebug_info.
2015-03-31 03:56:12 -07:00
Alan Modra efd321f91c Correct printed year in copyright notices 2015-01-02 01:08:15 +10:30
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Terry Guo d98b0e2bf6 2014-09-29 Terry Guo <terry.guo@arm.com>
* as.c (create_obj_attrs_section): Move it and call it from ...
        * write.c (create_obj_attrs_section): ... here.
        (subsegs_finish_section): Refactored.
2014-09-29 10:12:10 +08:00
Alan Modra 85024cd8bc Run write_object_file after errors
This is to fix unitialised memory access when printing listings.
Many targets don't initialise parts of insn frags or data frags that
have fixups, relying on md_apply_fix to finalise the frag.  Which is
fine normally, but means we need to run write_object_file after
errors, for listings.  Otherwise MALLOC_PERTURB_=1 causes errors like:
x86_64-linux  +FAIL: i386 mpx-inval-1
x86_64-linux  +FAIL: i386 inval-equ-1
x86_64-linux  +FAIL: i386 x86-64-mpx-inval-1

Running write_object_file after errors requires some tweaking to the
testsuite, since we then get extra errors reported from md_apply_fix.

gas/
	* write.h (subsegs_finish): Delete declaration.
	* write.c (subsegs_finish): Make static.
	(write_object_file): Call subsegs_finish from here.  Don't print
	warning and error count here..
	* as.c (main): ..do so here instead.  Remove dead code for "no
	object file generated".  Split out count strings to better support
	internationalisation.  Don't call subsegs_finish. Tidy setting of
	"keep_it".  Run write_object_file even after errors.
	(keep_it): Make static.
	* config/obj-elf.c (elf_frob_symbol): Remove assert.
	(elf_frob_file_before_adjust): Likewise.
gas/testsuite/
	* gas/elf/bad-group.s: Use %function.
	* gas/elf/bad-group.err: Expect correct line number.  Allow
	other errors.
	* gas/elf/bad-size.err: Allow other errors.  Match expected
	error somewhat more rigorously.
	* gas/i386/reloc32.l: Allow other errors.
	* gas/i386/mpx-inval-1.l: Match applied relocs.
	* gas/i386/x86-64-mpx-inval-1.l: Likewise, and nop padding.
	* gas/i386/x86-64-mpx-inval-2.l: Match nop padding, and allow
	other errors.
	* gas/macros/dot.s: Use .balign.
	* gas/macros/dot.l: Update alignment output.
	* gas/symver/symver6.l: Allow other errors.
2014-06-16 12:34:45 +09:30
Alan Modra 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
H.J. Lu 221fd5d598 Update copyright year to 2014
binutils/

	* version.c (print_version): Update copyright year to 2014.

gas/

	* as.c (parse_args): Update copyright year to 2014.

gold/

	* version.cc (print_version): Update copyright year to 2014.

ld/

	* ldver.c (ldversion): Update copyright year to 2014.

opcodes/

	* i386-gen.c (process_copyright): Update copyright year to 2014.
2014-01-08 05:48:12 -08:00
Richard Sandiford e8044f355d * configure.ac (mips*-*-bsd*, mips*-*-ultrix*, mips*-*-osf*)
(mips*-*-ecoff*, mips*-*-pe*, mips*-*-irix* [v4 and earlier])
	(mips*-*-lnews*, mips*-*-riscos*): Add gas and ld to noconfigdirs.
	* configure: Regenerate.

gas/
	* NEWS: Note removal of ECOFF support.
	* doc/as.texinfo (--emulation): Update for the removal of MIPS ECOFF.
	* Makefile.am (TARG_ENV_HFILES): Remove config/te-lnews.h.
	(MULTI_CFILES): Remove config/e-mipsecoff.c.
	* Makefile.in: Regenerate.
	* configure.in: Remove MIPS ECOFF references.
	(mips-sony-bsd*, mips-*-bsd*, mips-*-lnews*-ecoff, mips-*-*-ecoff):
	Delete cases.
	(mips-*-irix5*-*, mips*-*-linux*-*, mips*-*-freebsd*)
	(mips*-*-kfreebsd*-gnu, mips-*-*-elf): Fold into...
	(mips-*-*): ...this single case.
	(mipsbecoff, mipslecoff, mipsecoff): Remove emulations.  Expect
	MIPS emulations to be e-mipself*.
	* configure: Regenerate.
	* configure.tgt (mips-sony-bsd*, mips-*-ultrix*, mips-*-osf*)
	(mips-*-ecoff*, mips-*-pe*, mips-*-irix*, ips-*-lnews*, mips-*-riscos*)
	(mips-*-sysv*): Remove coff and ecoff cases.
	* as.c (mipsbecoff, mipslecoff, mipsecoff): Remove.
	* ecoff.c: Remove reference to MIPS ECOFF.
	* config/e-mipsecoff.c, config/te-lnews.h: Delete files.
	* config/tc-mips.c (ECOFF_LITTLE_FORMAT): Delete.
	(RDATA_SECTION_NAME, mips_target_form): Remove COFF and ECOFF cases.
	(mips_hi_fixup): Tweak comment.
	(append_insn): Require a howto.
	(mips_after_parse_args): Remove OBJ_MAYBE_ECOFF code.

gas/testsuite/
	* gas/all/gas.exp: Remove reference to mips-ecoff.
	* gas/mips/branch-misc-1.d, gas/mips/branch-misc-2.d,
	gas/mips/branch-misc-2-64.d, gas/mips/branch-misc-2pic.d,
	gas/mips/branch-misc-2pic-64.d, gas/mips/branch-swap.d: Remove
	skips for mips-*-ecoff.

ld/
	* NEWS: Document the removal of MIPS ECOFF targets.
	* ld.texinfo (--gpsize=@var{value}): Use MIPS ELF rather than
	MIPS ECOFF as an example of a target that supports small data.
	* ldmain.c (g_switch_value): Likewise.
	* configure.tgt (mips*-*-pe, mips*-dec-ultrix*, mips*-dec-osf*)
	(mips*-sgi-irix* [v4 and earlier], mips*el-*-ecoff*, mips*-*-ecoff*)
	(mips*-*-bsd*, mips*-*-lnews*): Remove cases.
	* Makefile.am (ALL_EMULATION_SOURCES): Remove emipsbig.c, emipsbsd.c,
	emipsidt.c, emipsidtl.c, emipslit.c, emipslnews.c and emipspe.c.
	(emipsbig.c, emipsbsd.c, emipsidt.c, emipsidtl.c, emipslit.c)
	(emipslnews.c, emipspe.c): Delete rules.
	* Makefile.in: Regenerate.
	* emulparams/mipsbig.sh, emulparams/mipsbsd.sh, emulparams/mipsidt.sh,
	emulparams/mipsidtl.sh, emulparams/mipslit.sh, emulparams/mipslnews.sh,
	emulparams/mipspe.sh, emultempl/mipsecoff.em: Delete.
	* emultempl/m68kcoff.em: Update comment to say that MIPS ECOFF support
	has now been removed.
	* emultempl/pe.em: Remove TARGET_IS_mipspe checks.
2013-06-22 16:44:16 +00:00
Nick Clifton b40bf0a255 * elflink.c (_bfd_elf_gc_mark_extra_sections): Remove mark from
fragmented .debug_line sections associated with unmarked code
	sections.

	* dwarf.c (read_debug_line_header): New function.  Reads in a
	header in a .debug_line section.
	(display_debug_lines_raw): Use new function.  Handle fragmentary
	.debug_line sections.
	(display_debug_lines_decoded): Likewise.
	* readelf.c (process_section_headers): Handle fragmenatry
	.debug_line sections.
	(display_debug_section): Likewise.

	* as.c (Options): Add -gdwarf-sections.
	(parse_args): Likewise.
	* as.h (flag_dwarf_sections): Declare.
	* dwarf2dbg.c (emit_fixed_inc_line_addr): Skip section changes.
	(process_entries): When -gdwarf-sections is enabled generate
	fragmentary .debug_line sections.
	(out_debug_line): Set the section for the .debug_line section end
	symbol.
	* doc/as.texinfo: Document -gdwarf-sections.
	* NEWS: Mention -gdwarf-sections.

	* gas/elf/dwarf2-3.d: Fix expected readelf output.

	* scripttempl/DWARF.sc: Add support for .debug_line.* and
	.debug_line_end.
2013-04-29 13:38:59 +00:00
H.J. Lu 34bca50861 Remove trailing white spaces on gas
* app.c: Remove trailing white spaces.
	* as.c: Likewise.
	* as.h: Likewise.
	* cond.c: Likewise.
	* dw2gencfi.c: Likewise.
	* dwarf2dbg.h: Likewise.
	* ecoff.c: Likewise.
	* input-file.c: Likewise.
	* itbl-lex.h: Likewise.
	* output-file.c: Likewise.
	* read.c: Likewise.
	* sb.c: Likewise.
	* subsegs.c: Likewise.
	* symbols.c: Likewise.
	* write.c: Likewise.
	* config/tc-i386.c: Likewise.
	* doc/Makefile.am: Likewise.
	* doc/Makefile.in: Likewise.
	* doc/c-aarch64.texi: Likewise.
	* doc/c-alpha.texi: Likewise.
	* doc/c-arc.texi: Likewise.
	* doc/c-arm.texi: Likewise.
	* doc/c-avr.texi: Likewise.
	* doc/c-bfin.texi: Likewise.
	* doc/c-cr16.texi: Likewise.
	* doc/c-d10v.texi: Likewise.
	* doc/c-d30v.texi: Likewise.
	* doc/c-h8300.texi: Likewise.
	* doc/c-hppa.texi: Likewise.
	* doc/c-i370.texi: Likewise.
	* doc/c-i386.texi: Likewise.
	* doc/c-i860.texi: Likewise.
	* doc/c-m32c.texi: Likewise.
	* doc/c-m32r.texi: Likewise.
	* doc/c-m68hc11.texi: Likewise.
	* doc/c-m68k.texi: Likewise.
	* doc/c-microblaze.texi: Likewise.
	* doc/c-mips.texi: Likewise.
	* doc/c-msp430.texi: Likewise.
	* doc/c-mt.texi: Likewise.
	* doc/c-s390.texi: Likewise.
	* doc/c-score.texi: Likewise.
	* doc/c-sh.texi: Likewise.
	* doc/c-sh64.texi: Likewise.
	* doc/c-tic54x.texi: Likewise.
	* doc/c-tic6x.texi: Likewise.
	* doc/c-v850.texi: Likewise.
	* doc/c-xc16x.texi: Likewise.
	* doc/c-xgate.texi: Likewise.
	* doc/c-xtensa.texi: Likewise.
	* doc/c-z80.texi: Likewise.
	* doc/internals.texi: Likewise.
2013-01-10 19:51:55 +00:00
H.J. Lu 6265840747 Update copyright year to 2013
binutils/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	* version.c (print_version): Update copyright year to 2013.

gas/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	* as.c (parse_args): Update copyright year to 2013.

ld/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	* ldver.c (ldversion): Update copyright year to 2013.

opcodes/

2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	* i386-gen.c (process_copyright): Update copyright year to 2013.
2013-01-02 17:15:38 +00:00
Simon Baldwin ef8e09a081 * as.c (dump_statistics): Compute data size as the delta between
current sbrk(0) and start_sbrk.
	* (main): Set start_sbrk to sbrk(0) on entry.
2012-10-22 11:13:25 +00:00
Alan Modra 39a45edc07 PR gas/14201
* sb.h (sb_max_power_two): Delete.
	(struct sb): Delete "item" and "pot".  Make "len" a size_t.  Add "max".
	(sb_element): Delete.
	(sb_add_char, sb_add_buffer, sb_skip_comma, sb_skip_write): Update
	prototypes.
	* sb.c (string_count, free_list): Delete.
	(sb_build, sb_kill, sb_check): Rewrite.
	(scrub_from_sb, sb_add_char, sb_add_string, sb_add_buffer,
	sb_skip_white, sb_skip_comma): Replace assorted int params,
	vars and return types with size_t.
	* input-scrub.c: Likewise.
	* macro.c: Likewise.
	* macro.h: Likewise.
	* as.c: Likewise.
	* as.h: Likewise.
	* input-file.h: Likewise.
	* input-file.c: Likewise.
	* read.c: Likewise.
	* app.c: ..or ptrdiff_t.
	* input-file.c (input_file_get): Use ferror.
	(input_file_give_next_buffer): Use input_file_get.
2012-06-07 12:47:23 +00:00
Alan Modra 576477a6ee Update copyright message year. 2012-01-17 00:07:04 +00:00
Iain Sandoe bcf0aac6f6 adjust mach-o default GAS sections.
gas:

	* as.c (perform_an_assembly_pass): Do not create text, data and bss
	sections for MACH-O.  Do not switch to the text section.
	* config/obj-macho.c (obj_mach_o_segT_from_bfd_name): Forward decl.
	(mach_o_begin): Startup with only text section unless suppressed.
	* config/obj-macho.h (obj_begin): define to mach_o_begin ().

gas/testsuite:

	* gas/mach-o/sections-1.d: Amend to recognize that bss is not emitted
	by default.
	* gas/mach-o/sections-2.d: New.
2011-12-29 10:53:10 +00:00