This removes ineffectual and wrong code caching section names in
gas/stabs.c. Code like
seg = subseg_new (name, 0);
...
if (seg->name == name)
seg->name = xstrdup (name);
with the idea of being able to unconditionally free "name" later no
longer works. "name" is referenced by the section hash table as well
as in the section->name field. It would be possible to use
"bfd_rename_section (stdoutput, seg, xstrdup (name))", but instead I
opted for a fairly straight-forward approach of adding extra
parameters to two functions to indicate section name strings should be
freed if possible.
PR 23938
* read.h (get_stab_string_offset): Update prototype.
* stabs.c (get_stab_string_offset): Add free_stabstr_secname
parameter. Free stabstr_secname if unused as section name.
Don't xstrdup name when used.
(s_stab_generic): Remove forward declaration. Add
stab_secname_obstack_end param. Reference notes obstack via
macros. Delete cached_secname. Adjust get_stab_string_offset
call. Free stab_secname if unused as section name.
(s_stab): Adjust s_stab_generic call.
(s_xstab): Likewise. Delete saved_secname and saved_strsecname.
* config/obj-elf.c (obj_elf_init_stab_section): Adjust
get_stab_string_offset call.
* config/obj-coff.c (obj_coff_init_stab_section): Likewise.
* config/obj-som.c (obj_som_init_stab_section): Likewise.
* testsuite/gas/all/pr23938.s: New test.
* testsuite/gas/all/gas.exp: Run it.
Implement the '.nop SIZE[, CONTROL]' assembler directive, which emits
SIZE bytes filled with no-op instructions. SIZE is absolute expression.
The optional CONTROL byte controls how no-op instructions should be
generated. If the comma and @var{control} are omitted, CONTROL is
assumed to be zero.
For Intel 80386 and AMD x86-64 targets, CONTROL byte specifies the size
limit of a single no-op instruction. The valid values of CONTROL byte
are between 0 and 8 for 16-bit mode, between 0 and 10 for 32-bit mode,
between 0 and 11 for 64-bit mode. When 0 is used, the no-op size limit
is set to the maximum supported size.
2 new relax states, rs_space_nop and rs_fill_nop, are added to enum
_relax_state, which are similar to rs_space and rs_fill, respectively,
but they fill with no-op instructions, instead of a single byte. A
target backend must override the default md_generate_nops to generate
proper no-op instructions. Otherwise, an error of unimplemented .nop
directive will be issued whenever .nop directive is used.
* NEWS: Mention .nop directive.
* as.h (_relax_state): Add rs_space_nop and rs_fill_nop.
* read.c (potable): Add .nop.
(s_nop): New function.
* read.h (s_nop): New prototype.
* write.c (cvt_frag_to_fill): Handle rs_space_nop and
rs_fill_nop.
(md_generate_nops): New function.
(relax_segment): Likewise.
(write_contents): Use md_generate_nops for rs_fill_nop.
* config/tc-i386.c (alt64_11): New.
(alt64_patt): Likewise.
(md_convert_frag): Handle rs_space_nop.
(i386_output_nops): New function.
(i386_generate_nops): Likewise.
(i386_align_code): Call i386_output_nops.
* config/tc-i386.h (i386_generate_nops): New.
(md_generate_nops): Likewise.
* doc/as.texinfo: Document .nop directive.
* testsuite/gas/i386/i386.exp: Run .nop directive tests.
* testsuite/gas/i386/nop-1.d: New file.
* testsuite/gas/i386/nop-1.s: Likewise.
* testsuite/gas/i386/nop-2.d: Likewise.
* testsuite/gas/i386/nop-2.s: Likewise.
* testsuite/gas/i386/nop-3.d: Likewise.
* testsuite/gas/i386/nop-3.s: Likewise.
* testsuite/gas/i386/nop-4.d: Likewise.
* testsuite/gas/i386/nop-4.s: Likewise.
* testsuite/gas/i386/nop-5.d: Likewise.
* testsuite/gas/i386/nop-5.s: Likewise.
* testsuite/gas/i386/nop-6.d: Likewise.
* testsuite/gas/i386/nop-6.s: Likewise.
* testsuite/gas/i386/nop-bad-1.l: Likewise.
* testsuite/gas/i386/nop-bad-1.s: Likewise.
* testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* testsuite/gas/i386/x86-64-nop-2.d: Likewise.
* testsuite/gas/i386/x86-64-nop-3.d: Likewise.
* testsuite/gas/i386/x86-64-nop-4.d: Likewise.
* testsuite/gas/i386/x86-64-nop-5.d: Likewise.
* testsuite/gas/i386/x86-64-nop-6.d: Likewise.
* 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.
PR 22324
* read.c (s_rept): Use size_t type for count parameter.
(do_repeat): Change type of count parameter to size_t.
Issue an error is the count parameter is negative.
(do_repeat_with_expression): Likewise.
* read.h: Update prototypes for do_repeat and
do_repeat_with_expression.
* doc/as.texinfo (Rept): Document that a zero count is allowed but
negative counts are not.
* config/tc-rx.c (rx_rept): Use size_t type for count parameter.
* config/tc-tic54x.c (tic54x_loop): Cast count parameter to size_t
type.
* testsuite/gas/macros/end.s: Add a test using a negative repeat
count.
* testsuite/gas/macros/end.l: Add expected error message.
* read.c (temp_ilp): New function. Installs a temporary input
line pointer.
(restore_ilp): New function. Restores the original input line
pointer.
* read.h (temp_ilp): Prototype.
(restore_ilp): Prototype.
* stabs.c (dot_func_p): Use bfd_boolean type.
(generate_asm_file): Use temp_ilp and restore_ilp.
(stabs_generate_asm_lineno): Likewise.
(stabs_generate_asm_endfunc): Likewise.
gas * read.c (finish_bundle): Avoid recording a negative alignment.
(do_align): Use unsigned values for n, len and max. Only create
a frag if the alignment requirement is greater than the minimum
byte alignment. Avoid recording a negative alignment.
(s_align): Use unsigned values where appropriate.
(bss_alloc): Use an unsigned value for the alignment.
(sizeof_sleb128): Add a comment noting that we encode one octet
per byte, regardless of the value of OCTETS_PER_BYTE_POWER.
(emit_leb129_expr): Abort if the emitted encoding was longer than
expected.
* read.h (output_leb128): Update prototype.
(sizeof_leb128): Update prototype.
(bss_alloc): Update prototype.
* write.c (record_alignment): Use an unsigned value for the
alignment. Do not record alignments less than the minimum
alignment for a byte.
* write.h (record_alignment): Update prototype.
When runtime patching code (like e.g. done by the Linux kernel) there
may be cases where the set of stack frame alterations differs between
unpatched and patched code. Consequently the corresponding unwind data
needs patching too. Locating the right places within an FDE, however,
is rather cumbersome without a way to insert labels in the resulting
section. Hence this patch introduces a new directive, .cfi_label. Note
that with the way CFI data gets emitted currently (at the end of the
assembly process) this can't support local FB- and dollar-labels.
gas/
2015-01-12 Jan Beulich <jbeulich@suse.com>
* gas/dw2gencfi.c (cfi_add_label, dot_cfi_label): New.
(cfi_pseudo_table): Add "cfi_label".
(output_cfi_insn): Handle CFI_label.
(select_cie_for_fde): Als terminate CIE when encountering
CFI_label.
* dw2gencfi.h (cfi_add_label): Declare.
(struct cfi_insn_data): New member "sym_name".
(CFI_label): New.
* read.c (read_symbol_name): Drop "static".
* read.h (read_symbol_name): Declare.
gas/testsuite/
2015-01-12 Jan Beulich <jbeulich@suse.com>
gas/cfi/cfi-label.d, gas/cfi/cfi-label.s: New.
gas/cfi/cfi.exp: Run new tests.
* config/obj-elf.h (obj_elf_vendor_attribute): ... here.
* read.c (potable): Remove "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): Delete, move
to config/obj-elf.c.
(s_vendor_attribute): Delete, move to obj_elf_vendor_attribute
in config/obj-elf.c.
(s_gnu_attribute): Delete, move to obj_elf_gnu_attribute in
config/obj-elf.c.
* config/obj-elf.c (elf_pseudo_table): Add "gnu_attribute".
(skip_whitespace, skip_past_char, skip_past_comma): New, moved
from read.c.
(obj_elf_vendor_attribute): New, moved from s_vendor_attribute
in read.c.
(obj_elf_gnu_attribute): New, moved from s_gnu_attribute in
read.c.
* config/tc-arm.c (s_arm_eabi_attribute): Rename
s_vendor_attribute to obj_elf_vendor_attribute.
* config/tc-tic6x.c (s_tic6x_c6xabi_attribute): Likewise.
2012-03-12 Roland McGrath <mcgrathr@google.com>
* config/tc-arm.c (arm_frag_max_var): New function.
* config/tc-arm.h: Declare it.
(md_frag_max_var): New macro.
* config/tc-i386.c (i386_frag_max_var): New function.
* config/tc-i386.h: Declare it.
(md_frag_max_var): New macro.
* doc/as.texinfo (Bundle directives): New node.
(Pseudo Ops): Add it to the menu.
* NEWS: Mention new feature.
* read.c [md_frag_max_var] (HANDLE_BUNDLE): New macro.
[HANDLE_BUNDLE] (bundle_align_p2): New variable.
[HANDLE_BUNDLE] (bundle_lock_frchain, bundle_lock_frag): New variables.
[HANDLE_BUNDLE] (start_bundle, pending_bundle_size, finish_bundle):
New functions.
(assemble_one): New function if [HANDLE_BUNDLE], #define directly
to md_assembly if not.
(read_a_source_file): Call assemble_one in place of md_assemble.
(read_a_source_file) [HANDLE_BUNDLE]: Check for unterminated
.bundle_lock at end of processing.
[HANDLE_BUNDLE] (s_bundle_align_mode, s_bundle_lock, s_bundle_unlock):
New functions.
[HANDLE_BUNDLE] (potable): Add their entries.
* read.h: Declare new functions.
gas/testsuite/
2012-03-12 Roland McGrath <mcgrathr@google.com>
* gas/i386/bundle-bad.s: New file.
* gas/i386/bundle-bad.d: New file.
* gas/i386/bundle-bad.l: New file.
* gas/i386/i386.exp: Run it.
* gas/arm/bundle.s: New file.
* gas/arm/bundle.d: New file.
* gas/arm/bundle-lock.s: New file.
* gas/arm/bundle-lock.d: New file.
* gas/i386/bundle.s: New file.
* gas/i386/bundle.d: New file.
* gas/i386/x86-64-bundle.s: New file.
* gas/i386/x86-64-bundle.d: New file.
* gas/i386/bundle-lock.s: New file.
* gas/i386/bundle-lock.d: New file.
* gas/i386/i386.exp: Run them.
gas/
* config/tc-arm.c (attributes_set_explicitly): New array.
(s_arm_eabi_attribute): Check return value from s_vendor_attribute.
(cpu_arch): Add ARM_ARCH_V5T.
(aeabi_set_attribute_int): New function.
(aeabi_set_attribute_string): New function.
(aeabi_set_public_attributes): Set attributes according to the user's
intentions, rather than the actual state of the binary.
Use aeabi_set_attribute_int and aeabi_set_attribute_string instead of
bfd_elf_add_proc_attr_int and bfd_elf_add_proc_attr_string.
Support WMMXv2. Use attribute names instead of numbers.
* read.c (s_vendor_attribute): Change return type to int.
Return the tag number that was set.
* read.h (s_vendor_attribute): Change return type to int.
gas/testsuite/
* gas/arm/attr-cpu-directive.d: New file.
* gas/arm/attr-cpu-directive.s: New file.
* gas/arm/attr-default.d: New file.
* gas/arm/attr-march-all.d: New file.
* gas/arm/attr-march-armv1.d: New file.
* gas/arm/attr-march-armv2.d: New file.
* gas/arm/attr-march-armv2a.d: New file.
* gas/arm/attr-march-armv2s.d: New file.
* gas/arm/attr-march-armv3.d: New file.
* gas/arm/attr-march-armv3m.d: New file.
* gas/arm/attr-march-armv4.d: New file.
* gas/arm/attr-march-armv4t.d: New file.
* gas/arm/attr-march-armv4txm.d: New file.
* gas/arm/attr-march-armv4xm.d: New file.
* gas/arm/attr-march-armv5.d: New file.
* gas/arm/attr-march-armv5t.d: New file.
* gas/arm/attr-march-armv5te.d: New file.
* gas/arm/attr-march-armv5tej.d: New file.
* gas/arm/attr-march-armv5texp.d: New file.
* gas/arm/attr-march-armv5txm.d: New file.
* gas/arm/attr-march-armv6-m.d: New file.
* gas/arm/attr-march-armv6.d: New file.
* gas/arm/attr-march-armv6j.d: New file.
* gas/arm/attr-march-armv6k.d: New file.
* gas/arm/attr-march-armv6kt2.d: New file.
* gas/arm/attr-march-armv6t2.d: New file.
* gas/arm/attr-march-armv6z.d: New file.
* gas/arm/attr-march-armv6zk.d: New file.
* gas/arm/attr-march-armv6zkt2.d: New file.
* gas/arm/attr-march-armv6zt2.d: New file.
* gas/arm/attr-march-armv7-a.d: New file.
* gas/arm/attr-march-armv7-m.d: New file.
* gas/arm/attr-march-armv7-r.d: New file.
* gas/arm/attr-march-armv7.d: New file.
* gas/arm/attr-march-armv7a.d: New file.
* gas/arm/attr-march-armv7m.d: New file.
* gas/arm/attr-march-armv7r.d: New file.
* gas/arm/attr-march-iwmmxt.d: New file.
* gas/arm/attr-march-iwmmxt2.d: New file.
* gas/arm/attr-march-xscale.d: New file.
* gas/arm/attr-mcpu.d: New file.
* gas/arm/attr-mfpu-arm1020e.d: New file.
* gas/arm/attr-mfpu-arm1020t.d: New file.
* gas/arm/attr-mfpu-arm1136jf-s.d: New file.
* gas/arm/attr-mfpu-arm1136jfs.d: New file.
* gas/arm/attr-mfpu-arm7500fe.d: New file.
* gas/arm/attr-mfpu-fpa.d: New file.
* gas/arm/attr-mfpu-fpa10.d: New file.
* gas/arm/attr-mfpu-fpa11.d: New file.
* gas/arm/attr-mfpu-fpe.d: New file.
* gas/arm/attr-mfpu-fpe2.d: New file.
* gas/arm/attr-mfpu-fpe3.d: New file.
* gas/arm/attr-mfpu-maverick.d: New file.
* gas/arm/attr-mfpu-neon-fp16.d: New file.
* gas/arm/attr-mfpu-neon.d: New file.
* gas/arm/attr-mfpu-softfpa.d: New file.
* gas/arm/attr-mfpu-softvfp+vfp.d: New file.
* gas/arm/attr-mfpu-softvfp.d: New file.
* gas/arm/attr-mfpu-vfp.d: New file.
* gas/arm/attr-mfpu-vfp10-r0.d: New file.
* gas/arm/attr-mfpu-vfp10.d: New file.
* gas/arm/attr-mfpu-vfp3.d: New file.
* gas/arm/attr-mfpu-vfp9.d: New file.
* gas/arm/attr-mfpu-vfpv2.d: New file.
* gas/arm/attr-mfpu-vfpv3-d16.d: New file.
* gas/arm/attr-mfpu-vfpv3.d: New file.
* gas/arm/attr-mfpu-vfpxd.d: New file.
* gas/arm/attr-order.d: Update Tag_ARM_ISA_use and Tag_THUMB_ISA_use.
* gas/arm/attr-override-cpu-directive.d: New file.
* gas/arm/attr-override-cpu-directive.s: New file.
* gas/arm/attr-override-mcpu.d: New file.
* gas/arm/attr-override-mcpu.s: New file.
* gas/arm/blank.s: New file.
* gas/arm/eabi_attr_1.d: Update Tag_ARM_ISA_use and Tag_THUMB_ISA_use.
ld/testsuite/
* ld-arm/attr-merge-3.attr: Update following gas change.
* ld-arm/attr-merge-2.attr: Update Tag_ARM_ISA_use and
Tag_THUMB_ISA_use following gas changes.
* ld-arm/attr-merge-4.attr: Likewise.
* ld-arm/attr-merge-5.attr: Likewise.
* ld-arm/attr-merge-arch-1.attr: Likewise.
* ld-arm/attr-merge-arch-2.attr: Likewise.
* ld-arm/attr-merge-unknown-2.d: Likewise.
* ld-arm/attr-merge-unknown-2r.d: Likewise.
* ld-arm/attr-merge-unknown-3.d: Likewise.
* ld-arm/attr-merge-wchar-00-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-00.d: Likewise.
* ld-arm/attr-merge-wchar-02-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-02.d: Likewise.
* ld-arm/attr-merge-wchar-04-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-04.d: Likewise.
* ld-arm/attr-merge-wchar-20-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-20.d: Likewise.
* ld-arm/attr-merge-wchar-22-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-22.d: Likewise.
* ld-arm/attr-merge-wchar-24-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-40-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-40.d: Likewise.
* ld-arm/attr-merge-wchar-42-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-44-nowarn.d: Likewise.
* ld-arm/attr-merge-wchar-44.d: Likewise.
* ld-arm/attr-merge.attr: Likewise.
* dwarf2dbg.c (out_sleb128): Delete.
(size_fixed_inc_line_addr, emit_fixed_inc_line_addr): New.
(out_fixed_inc_line_addr): Delete.
(relax_inc_line_addr, dwarf2dbg_estimate_size_before_relax): Call new
size_fixed_inc_line_addr if DWARF2_USE_FIXED_ADVANCE_PC is set.
(dwarf2dbg_convert_frag): Likewise for emit_fixed_inc_line_addr.
(process_entries): Remove calls to out_fixed_inc_line_addr. When
DWARF2_USE_FIXED_ADVANCE_PC is set, call relax_inc_line_addr.
* read.h (emit_expr_fix): New prototype.
* read.c (emit_expr): Move code to emit_expr_fix and use it here.
(emit_expr_fix): New.
testsuite/
* gas/lns/lns.exp: Run new lns-big-delta test for targets that set
DWARF2_USE_FIXED_ADVANCE_PC.
* gas/lns/lns-big-delta.s: New.
* gas/lns/lns-big-delta.d: New.
2005-05-17 Jan Beulich <jbeulich@novell.com>
* read.c (_find_end_of_line): New.
(find_end_of_line): New.
(HANDLE_CONDITIONAL_ASSEMBLY): Use it.
(read_a_source_file): Use it.
(s_globl): Use it.
(s_macro): Use it.
(get_line_sb): Use it.
(s_errwarn): Replace discard_rest_of_line by ignore_rest_of_line.
(s_comm_internal): Likewise.
(s_lsym): Likewise.
(s_macro): Likewise.
(s_ignore): Use ignore_rest_of_line.
* read.h (find_end_of_line): Prototype.
(discard_rest_of_line): Remove prototype. #define to
ignore_rest_of_line.
gas/testsuite/
2005-05-17 Jan Beulich <jbeulich@novell.com>
* gas/mmix/err-byte1.s: Adjust expected error text on line 10.
2005-01-31 Jan Beulich <jbeulich@novell.com>
* macro.c (do_formals): Adjust to no longer accept empty parameter
names.
(define_macro): Adjust to no longer accept empty macro name, garbage
following the parameters, or macros that were previously defined.
* read.c (s_bad_end): Declare.
(potable): Add endm. Handler for endr and endm is s_bad_end.
(s_bad_end): Rename from s_bad_endr. Adjust to handle both .endm
and .endr.
* read.h (s_bad_endr): Remove.
gas/testsuite/
2005-01-31 Jan Beulich <jbeulich@novell.com>
* gas/macros/badarg.[ls]: New.
* gas/macros/end.[ls]: New.
* gas/macros/redef.[ls]: New.
* gas/macros/macros.exp (run_list_test): Copy from elsewhere.
Run new tests.
* dwarf2dbg.c (DWARF2_ADDR_SIZE): Remove trailing ';'
* read.h (SKIP_WHITESPACE): Turn into an expression.
* read.c (read_a_source_file): A pseudo is removed by having a
NULL handler.
testsuite:
* gas/macros/test2.s: Lowercase it.
(s_comm): Split out code to..
(s_comm_internal): ..here. Tidy error returns. Rearrange so that
"name" from input line may be used in more places. Merge code
testing for valid size from elf_common. Merge code from
s_lcomm_internal. Call comm_parse_extra.
(bss_alloc): New function, split out of s_lcomm_internal and
elf_common.
(parse_align): Likewise.
(s_lcomm_internal): Rewrite.
(s_lcomm, s_lcomm_bytes): Use s_comm_internal.
* read.h (bss_alloc, parse_align, s_comm_internal): Declare.
* config/obj-elf.c (elf_common): Split out code to..
(elf_common_parse): ..here. Remove code common to s_comm_internal,
parse_align and bss_alloc. Rearrange and Tidy.
* config/tc-alpha.h (TC_IMPLICIT_LCOMM_ALIGNMENT): Define.
(get_absolute_expression): ..here.
* read.h (get_absolute_expr): Declare.
* config/obj-elf.c (elf_common): Use offsetT for "temp" and "size".
Trim size to arch bits_per_address, and test for negative input
via get_absolute_expr.
* dwarf2dbg.c: Enabled only if BFD_ASSEMBLER is defined.
* read.h (outputting_stabs_line_debug): Change it to int.
* stabs.c (outputting_stabs_line_debug): Likewise.