Commit Graph

105441 Commits

Author SHA1 Message Date
Andrew Burgess
8a4efb366f gdb/testsuite: check the correct Python variable in test
While squashing duplicate test names I spotted what looked like a copy
& paste error.  During this test a Python variable is created, and
then we call the type method on that variable.  In one case we create
a variable and then call the type method on a variable created for a
previous test.  I can see no reason why this should be what we want,
it doesn't line up with the comments in the test script, so I've
updated the test.  Note, the expected result doesn't change, just the
command issued (the test relates to stripping typedefs).

gdb/testsuite/ChangeLog:

	* gdb.python/lib-types.exp: Update the test to check the correct
	python variable.
2021-03-12 12:18:33 +00:00
Andrew Burgess
66bb1dd9cd gdb/testsuite: make test names unique in gdb.python/py-explore-cc.exp
Add additional text to some test names to make them unique.  In one
case, correct the test name (copy & paste error) to make it correctly
reflect what the test is doing.

gdb/testsuite/ChangeLog:

	* gdb.python/py-explore-cc.exp: Extend test names to make them
	unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
0125fabc7a gdb/testsuite: remove a duplicate test
I spotted a duplicate test name in this test script.  Turns out it's
an actual duplicate test.  Delete one copy of this test.

gdb/testsuite/ChangeLog:

	* gdb.python/py-lookup-type.exp: Remove duplicate test.
2021-03-12 12:18:33 +00:00
Andrew Burgess
79d041578d gdb/testsuite: make test names unique in gdb.python/py-symtab.exp
Extend the names of some tests to make them unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-symtab.exp: Extend test names to make them
	unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
e3e48d8fdb gdb/testsuite: make test names unique in gdb.python/py-prompt.exp
Use with_test_prefix to make test names unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-prompt.exp: Add with_test_prefix to make test
	names unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
2cb60e747b gdb/testsuite: make test names unique in gdb.python/py-block.exp
Extend some test names to make them unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-block.exp: Give tests unique names.
2021-03-12 12:18:33 +00:00
Andrew Burgess
8b12ded4e6 gdb/testsuite: make test names unique in gdb.python/py-pp-maint.exp
Extend the test names with additional text to make them unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-pp-maint.exp: Extend test names to make them
	unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
93598ea43d gdb/testsuite: make test names unique in gdb.python/py-explore.exp
Add a with_test_prefix to make test names unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-explore.exp: Add with_test_prefix to make test
	names unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
f35d6971cd gdb/testsuite: make test names unique in gdb.python/py-finish-breakpoint.exp
Make test names unique by just adding additional text to the test
names.  As this is a Python test that repeatedly imports the Python
script I've just numbered the test names in this case rather than
trying to come up with anything better, hence we have:

  import python scripts, 1
  import python scripts, 2
  ...
  import python scripts, 6

Not great, but hopefully good enough.  Everything else has a slightly
more descriptive test name.

gdb/testsuite/ChangeLog:

	* gdb.python/py-finish-breakpoint.exp: Make test names unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
22d3e7f629 gdb/testsuite: make test names unique in gdb.python/py-strfns.exp
Wrap some code in `with_test_prefix` to make test names unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-strfns.exp: Use with_test_prefix to make test
	names unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
5fc5a1b882 gdb/testsuite: make test names unique in gdb.python/py-format-string.exp
Make use of `proc_with_prefix` for every test_* proc in order to make
the test names unique within this test file.

gdb/testsuite/ChangeLog:

	* gdb.python/py-format-string.exp: Use proc_with_prefix to make
	test names unique.
2021-03-12 12:18:33 +00:00
Andrew Burgess
e3141a4d89 gdb/testsuite: make test names unique in gdb.python/py-mi.exp
Use with_test_prefix to make the test names unique.

gdb/testsuite/ChangeLog:

	* gdb.python/py-mi.exp: Use with_test_prefix to make test names
	unique.
2021-03-12 12:18:33 +00:00
Clément Chigot
1b2cb8e2ee aix: implement TLS relocation for gas and ld
Add support for TLS in XCOFF. Amongst the things done by this commit:
 - Update XCOFF auxialiary header to match new version and allow TLS
   sections.
 - Add TLS sections (.tdata and .tbss) support in gas and ld.
 - Add support for the TLS relocations in gas and ld.
   Two different types BFD_RELOC are created for PPC and PPC64 as
   the size is a pointer, thus distinct in 32 or 64bit.

The addresses given by ld to .tdata and .tbss is a bit special. In
XCOFF, these addresses are actually offsets from the TLS pointer
computed at runtime. AIX assembly and linker does the same. In
top of that, the .tdata must be before .data (this is mandatory for AIX
loader). Thus, the aix ld script is recomputing "." before .data to restore
its original value. There might be a simpler way, but this one is working.

Optimisation linked to TLS relocations aren't yet implemented.

bfd/
	* reloc.c (BFD_RELOC_PPC_TLS_LE, BFD_RELOC_PPC_TLS_IE,
	BFD_RELOC_PPC_TLS_M, BFD_RELOC_PPC_TLS_ML, BFD_RELOC_PPC64_TLS_GD,
	BFD_RELOC_PPC64_TLS_LD, BFD_RELOC_PPC64_TLS_LE,
	BFD_RELOC_PPC64_TLS_IE, BFD_RELOC_PPC64_TLS_M,
	BFD_RELOC_PPC64_TLS_ML): New relocations.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* coff-rs6000.c (xcoff_calculate_relocation): Call
	xcoff_reloc_type_tls for TLS relocations.
	(xcoff_howto_table): Implement TLS relocations.
	(_bfd_xcoff_reloc_type_lookup): Add cases TLS relocations.
	(xcoff_reloc_type_tls): New function.
	* coff64-rs6000.c (xcoff_calculate_relocation): Likewise.
	(xcoff_howto_table): Likewise.
	(_bfd_xcoff_reloc_type_lookup): Likewise.
	* coffcode.h (sec_to_styp_flags): Handle TLS sections.
	(styp_to_sec_flags): Likewise.
	(coff_compute_section_file_positions): Avoid file offset
	optimisation for .data when the previous section is .tdata.
	(coff_write_object_contents): Handle TLS sections.
	* coffswap.h (coff_swap_aouthdr_out): Add support for
	new fields in aouthdr.
	* libxcoff.h (xcoff_reloc_type_tls): Add prototype.
	* xcofflink.c (xcoff_link_add_symbols): Handle XMC_UL.
	(xcoff_need_ldrel_p): Add cases for TLS relocations.
	(xcoff_create_ldrel): Add l_symndx for TLS sections.
gas/
	* config/tc-ppc.c (ppc_xcoff_text_section, ppc_xcoff_data_section,
	(ppc_xcoff_bss_section, ppc_xcoff_tdata_section,
	(ppc_xcoff_tbss_section): New variables.
	(ppc_text_subsegment, ppc_text_csects, ppc_data_subgments,
	(ppc_data_csects): Removed.
	(ppc_xcoff_section_is_initialized, ppc_init_xcoff_section,
	ppc_xcoff_parse_cons): New functions.
	(md_being): Initialize XCOFF sections.
	(ppc_xcoff_suffix): Add support for TLS relocations
	(fixup_size, md_apply_fix): Add support for new BFD_RELOC.
	(ppc_change_csect): Handle XMC_TL, XMC_UL.  Correctly, add XMC_BS
	to .bss section.  Handle new XCOFF section variables.
	(ppc_comm): Likewise.
	(ppc_toc): Likewise.
	(ppc_symbol_new_hook): Likewise.
	(ppc_frob_symbol): Likewise.
	(ppc_fix_adjustable): Add tbss support.
	* config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): New define.
	(ppc_xcoff_parse_cons): Add prototype.
	(struct ppc_xcoff_section): New structure.
ld/
	* emultempl/aix.em: Ensure .tdata section is removed
	if empty, even with -r flag.
	* scripttempl/aix.sc: Handle TLS sections.
	* testsuite/ld-powerpc/aix52.exp: Add new tests.
	* testsuite/ld-powerpc/aix-tls-reloc-32.d: New test.
	* testsuite/ld-powerpc/aix-tls-reloc-64.d: New test.
	* testsuite/ld-powerpc/aix-tls-reloc.ex: New test.
	* testsuite/ld-powerpc/aix-tls-reloc.s: New test.
	* testsuite/ld-powerpc/aix-tls-section-32.d: New test.
	* testsuite/ld-powerpc/aix-tls-section-64.d: New test.
	* testsuite/ld-powerpc/aix-tls-section.ex: New test.
	* testsuite/ld-powerpc/aix-tls-section.s: New test.
include/
	* coff/internal.h (struct internal_aouthdr): Add new fields.
	* coff/rs6000.h (AOUTHDRÃ): Add new fields.
	* coff/rs6k64.h (struct external_filehdr): Likewise.
	* coff/xcoff.h (_TDATA), _TBSS): New defines
	(RS6K_AOUTHDR_TLS_LE, RS6K_AOUTHDR_RAS, RS6K_AOUTHDR_ALGNTDATA,
	RS6K_AOUTHDR_SHR_SYMTAB, RS6K_AOUTHDR_FORK_POLICY,
	RS6K_AOUTHDR_FORK_COR): New defines.
	(XMC_TU): Removed.
	(XMC_UL): New define.
2021-03-12 22:47:33 +10:30
Clément Chigot
4a403be0c1 aix: implement R_TOCU and R_TOCL relocations
Implement support for largetoc on XCOFF.
R_TOCU and R_TOCL are referenced by the new BFD defines:
BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO.
A new toc storage class is added XMC_TE.

In order to correctly handle R_TOCU, the logic behind
xcoff_reloc_type_toc is changed to compute the whole TOC offset
instead of just the difference between the "link" offset and the
"assembly" offset.

In gas, add a function to transform addis format used by AIX
"addis RT, D(RA)" into the ELF format "addis RT, RA, SI".

bfd/
	* reloc.c (BFD_RELOC_PPC_TOC16_HI, BFD_RELOC_PPC_TOC16_LO):
	New relocations.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* coff-rs6000.c (xcoff_calculate_relocation): Call
	xcoff_reloc_type_toc for R_TOCU and R_TOCL.
	(xcoff_howto_table): Remove src_mask for TOC relocations.
	Add R_TOCU and R_TOCL howtos.
	(_bfd_xcoff_reloc_type_lookup): Add cases for
	BFD_RELOC_PPC_TOC16_HI and BFD_RELOC_PPC_TOC16_LO.
	(xcoff_reloc_type_toc): Compute the whole offset.
	Implement R_TOCU and R_TOCL.
	* coff64-rs6000.c (xcoff64_calculate_relocation):
	Likewise.
	(xcoff64_howto_table): Likewise.
	(xcoff64_reloc_type_lookup): Likewise.
gas/
	* config/tc-ppc.c (ppc_xcoff_suffix): New function.
	(MAP, MAP32, MAP64): New macros for XCOFF.
	(ppc_xcoff_fixup_addis): New function.
	(ppc_is_toc_sym): Handle XMC_TE.
	(fixup_size): Add cases for BFD_RELOC_PPC_TOC16_HI and
	BFD_RELOC_PPC_TOC16_LO.
	(md_assemble): Call ppc_xcoff_fixup_addis for XCOFF.
	(ppc_change_csect): Handle XMC_TE.
	(ppc_tc): Enable .tc symbols to have only a XMC_TC or XMC_TE
	storage class.
	(ppc_symbol_new_hook): Handle XMC_TE.
	(ppc_frob_symbol): Likewise.
	(ppc_fix_adjustable): Likewise.
	(md_apply_fix): Handle BFD_RELOC_PPC_TOC16_HI and
	BFD_RELOC_PPC_TOC16_LO.
ld/
	* scripttempl/aix.sc: Add .te to .data section.
	* testsuite/ld-powerpc/aix52.exp: Add test structure for AIX7+.
	Add aix-largetoc-1 test.
	* testsuite/ld-powerpc/aix-largetoc-1-32.d: New test.
	* testsuite/ld-powerpc/aix-largetoc-1-64.d: New test.
	* testsuite/ld-powerpc/aix-largetoc-1.ex: New test.
	* testsuite/ld-powerpc/aix-largetoc-1.s: New test.
2021-03-12 22:47:23 +10:30
Clément Chigot
2c1bef53de aix: correct HOWTO table and add missing relocations
Since the last time AIX HOWTO table was modified, IBM has now
released an official documentation about XCOFF relocations.
This commit corrects the wrong ones and add some missing.
For now, the "custom" relocations made for xcoff_rtype2howto have
been kept.
The new relocations are still set as EMPTY_HOWTO because they will
be implemented in later commits.

In xcoff[64]_ppc_relocate_section, instead of recreating howto
from scratch, it's better to use the existing howto from the
table and fixing it according to r_size field.

bfd/
	* coff-rs6000.c (xcoff_calculate_relocation): Correct and
	add new relocations.
	(xcoff_howto_table): Likewise.
	(xcoff_rtype2howto): Increase r_type maximum value.
	(xcoff_ppc_relocate_section): Reuse predefined HOWTOs instead
	of create a new one from scratch.  Enable only some relocations
	to have a changing r_size.
	* coff64-rs6000.c (xcoff64_calculate_relocation): Likewise.
	(xcoff64_howto_table): Likewise.
	(xcoff64_rtype2howto): Likewise.
	(xcoff64_ppc_relocate_section): Likewise.
	* libxcoff.h (XCOFF_MAX_CALCULATE_RELOCATION): Fix value.
binutils/
	* od-xcoff.c: Replace RTB by TRL entry.
include/
	* coff/xcoff.h (R_RTB): Remove.
	(R_TRL): Fix value.
2021-03-12 22:08:20 +10:30
Clément Chigot
0c929e83c1 bfd: move xcoff64_ppc_relocate_section after the HOWTO table
This will be needed for later commits, as xcoff64_ppc_relocate_section
will use the HOWTO table unlike now.

	* coff64-rs6000.c (xcoff64_ppc_relocate_section): Move.
2021-03-12 13:09:21 +10:30
Clément Chigot
6d4d932867 bfd: use default coff_write_object_contents for XCOFF64
There is no need for XCOFF64 to have is own write_object_contents.

	* coff64-rs6000.c (xcoff64_write_object_contents): Remove.
	* coffcode.h (coff_write_object_contents): Add bfd_mach_ppc_620
	support for o_cputype field.  Avoid creating an empty a.out header
	for XCOFF64.
2021-03-12 13:04:00 +10:30
Clément Chigot
8aa2d0236a bfd: add missing smclass when creating csect for xcoff64
* coff64-rs6000.c (xcoff64_create_csect_from_smclas): Add
	missing smclass.
2021-03-12 13:00:11 +10:30
Alan Modra
78c84bf926 Re: x86: correct decoding of nop/reserved space (0f18 ... 0x1f)
* i386-dis.c (print_insn <PREFIX_IGNORED>): Correct typo.
2021-03-12 10:41:34 +10:30
Alan Modra
68cb21837f PE image base fallout
Fixes x86_64-w64-mingw32 tests that failed with the recent diagnosis
for out of range RVA, and a couple of other gc-sections tests that failed
for other reasons.

	* testsuite/ld-gc/gc.exp: Pass "-image-base 0" to ld for PE, and
	arrange to define __main for some run_dump_test tests.
	* testsuite/ld-gc/pr13683.d: Accept more symbols.
	* testsuite/ld-gc/pr14265.d: Likewise, and ordering.
	* testsuite/ld-scripts/crossref.exp: Pass "-image-base 0" to ld for PE.
	* testsuite/ld-srec/srec.exp: Likewise.
	* testsuite/lib/ld-lib.exp (ld_link_defsyms): Use is_pecoff_format.
2021-03-12 10:41:34 +10:30
GDB Administrator
1e1e17e5e2 Automatic date update in version.in 2021-03-12 00:00:19 +00:00
Jan Beulich
fd1fd06186 x86: re-order logic in OP_XMM()
Instead of excluding an increasing number of modes in the initial if(),
check the special modes first.
2021-03-11 16:21:48 +01:00
Jan Beulich
ac7a231133 x86: drop a few redundant EVEX-related checks
vex.b can only be set when vex.evex is also set. Similarly vex.evex can
only be set when need_vex is also set.
2021-03-11 16:21:19 +01:00
Jan Beulich
da944c8a70 x86: remove stray uses of xmmq_mode
xmmq_mode is documented to not allow for broadcast - don't include it in
respective checks in OP_E_memory().
2021-03-11 16:20:37 +01:00
Nelson Chu
ebdcad3fdd RISC-V: Improve multiple relax passes problem.
According to the commit abd20cb637, an
intersting thing is that - the more relax passes, the more chances of
relaxations are reduced [1].  Originally, we set the boolean `again`
to TRUE once the code is actually deleted, and then we run the relaxations
repeatedly if `again` is still TRUE.  But `again` only works for the
relax pass itself, and won't affect others.  That is - we can not use
`again` to re-run the relax pass when we already enter into the following
passes (can not run the relax passes backwards).  Besides, we must seperate
the PCREL relaxations into two relax passes for some reasons [2], it make
us lose some relax opportunities.

This patch try to fix the problem, and the basic idea was come from Jim
Wilson - we use a new boolean, restart_relax, to determine if we need to
run the whole relax passes again from 0 to 2.  Once we have deleted the
code between relax pass 0 to 2, the restart_relax will be set to TRUE,
we should run the whole relaxations again to give them more chances to
shorten the code.  We will only enter into the relax pass 3 when the
restart_relax is FALSE, since we can't relax anything else once we start
to handle the alignments.

I have passed the gcc/binutils regressions by riscv-gnu-toolchain, and
looks fine for now.

[1] https://sourceware.org/pipermail/binutils/2020-November/114223.html
[2] https://sourceware.org/pipermail/binutils/2020-November/114235.html

bfd/
    * elfnn-riscv.c (riscv_elf_link_hash_table): New boolean restart_relax,
    used to check if we need to run the whole relaxations from relax pass 0
    to 2 again.
    (riscv_elf_link_hash_table_create): Init restart_relax to FALSE.
    (_bfd_riscv_relax_align): Remove obsolete sec_flg0 set.
    (_bfd_riscv_relax_delete): Set again to TRUE if we do delete the code.
    (bfd_elfNN_riscv_restart_relax_sections): New function.  Called by
    after_allocation to check if we need to run the whole relaxations again.
    (_bfd_riscv_relax_section): We will only enter into the relax pass 3 when
    the restart_relax is FALSE; At last set restart_relax to TRUE if again is
    TRUE, too.
    * elfxx-riscv.h (bfd_elf32_riscv_restart_relax_sections): Declaration.
    (bfd_elf64_riscv_restart_relax_sections): Likewise.
ld/
    * emultempl/riscvelf.em (after_allocation): Run ldelf_map_segments many
    times if riscv_restart_relax_sections returns TRUE.
    * testsuite/ld-riscv-elf/restart-relax.d: New testcase.  Before applying
    this patch, the call won't be relaxed to jal; But now we have more chances
    to do relaxations.
    * testsuite/ld-riscv-elf/restart-relax.s: Likewise.
    * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
2021-03-11 17:27:13 +08:00
GDB Administrator
0b9f3e5463 Automatic date update in version.in 2021-03-11 00:00:17 +00:00
Tom Tromey
7056f312d0 Use bool for "parse_completion"
Some spots in GDB already use bool for "parse_completion", but a few
were still using int.  This patch updates these to bool.

I'm checking this in.

gdb/ChangeLog
2021-03-10  Tom Tromey  <tromey@adacore.com>

	* parser-defs.h (parser_state): Change completion to bool.
	<parse_completion>: Likewise.
	* ada-lang.h (ada_find_operator_symbol, ada_resolve_funcall)
	(ada_resolve_variable, ada_resolve_function): Update.
	* ada-lang.c (ada_find_operator_symbol): Change
	parse_completion to bool.
	(ada_resolve_funcall, ada_resolve_variable)
	(ada_resolve_function): Likewise.
2021-03-10 11:50:09 -07:00
Jan Beulich
b763d508db x86/Intel: correct AVX512 S/G disassembly
Commit 6ff00b5e12 ("x86/Intel: correct permitted operand sizes for
AVX512 scatter/gather") brought the assembler side of AVX512 S/G insn
handling in line with AVX2's, but the disassembler side was forgotten.
This has the benefit of
- allowing to fold a number of table entries,
- rendering a few #define-s and enumerators unused.
2021-03-10 08:20:29 +01:00
Jan Beulich
32e31ad7da x86: re-arrange enumerator and table entry order
Some of the enumerators have ended up misplaced under the general
current ordering scheme. Move them (and their table entries) around
accordingly. Add a couple of blank lines as separators when close to
code being touched anyway. Also drop the odd 0F from 0FXOP (there's no
"0f" involved there anywhere) infixes where the respective enum gets
played with anyway.
2021-03-10 08:19:43 +01:00
Jan Beulich
85ba7507f6 x86: reuse further VEX entries for EVEX
When the VEX.L=1 decode matches that of both EVEX.L'L=1 and EVEX.L'L=2
(typically when all three are invalid) the (smaller) VEX table entry can
be reused by EVEX, instead of duplicating data. (Note that XM and XMM as
well as EXxmm_md and EXd are equivalent at least for the purposes here.)
2021-03-10 08:19:11 +01:00
Jan Beulich
066f82b96a x86: reuse VEX entries for EVEX vperm{q,pd}
By matching VEX decode order (L before W), some EVEX entries can refer
back to VEX ones instead of carrying duplicates.
2021-03-10 08:18:24 +01:00
Jan Beulich
fc681dd6a1 x86: re-arrange order of decode for various EVEX opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.

This also adds a PREFIX_DATA 7531c61332 ("x86: simplify decode of
opcodes valid with (embedded) 66 prefix only") missed to apply to
vbroadcastf64x4.
2021-03-10 08:16:54 +01:00
Jan Beulich
13954a3119 x86: re-arrange order of decode for various mask reg opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:16:24 +01:00
Jan Beulich
14d10c6ccc x86: re-arrange order of decode for various VEX opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:15:46 +01:00
Jan Beulich
00ec187565 x86: re-arrange order of decode for various legacy opcodes
The order of decodes influences the overall number of table entries.
Reduce table size quite a bit by first decoding few-alternatives
attributes common to all valid leaves.
2021-03-10 08:15:10 +01:00
Jan Beulich
319419837c x86: correct decoding of nop/reserved space (0f18 ... 0x1f)
All encodings not used in this range are (reserved) NOPs. Hence their
decoding should be fully consistent. For this to work the PREFIX_IGNORED
logic needs slightly extending, such that the attribute will also
- have an effect when used inside prefix_table[], yet without always
  falling back to using slot 0,
- cause prefixes marked as ignored while decoding through prefix_table[]
  to no longer be considered decoded, when encountered in a subsequent
  decoding step.

In adjacent code also drop meaningless PREFIX_OPCODE.
2021-03-10 08:14:11 +01:00
Jan Beulich
67b0f68480 bfd: strip symbols not representable in COFF/PE symbol table
The offset-within-section field in the symbol table entry is only 32
bits wide, so rather than emitting bogus entries omit them, and issue
a diagnostic identifying the issue.

This requires adjusting the PR/22267 test to no longer produce symbols
with out of range values on 64-bit BFD. This also depends on
adjustments to testsuite/ld-scripts/map-address.* made by an earlier
patch. The purpose of the test can very well be achieved nevertheless.
2021-03-10 08:12:37 +01:00
GDB Administrator
3044062c34 Automatic date update in version.in 2021-03-10 00:00:22 +00:00
Alan Modra
2dfa8341e0 ELF DWARF in PE output
* elf.c (bfd_elf_generic_reloc): Make references between debug
	sections use section relative values.
2021-03-10 09:53:51 +10:30
Tom Tromey
ccdc02ed07 Fix function call regression in new evaluator
The internal AdaCore test suite revealed a bug in the new evaluator.
A hunk of evaluate_funcall was not correctly transcribed.  This was
not caught in my original testing because the feature in question was
apparently not tested in gdb.

This patch fixes the oversight.  The idea here is that ordinary
function calls should use the function's formal parameter types as the
expected types of subexpressions.

Regression tested on x86-64 Fedora 32.

gdb/ChangeLog
2021-03-09  Tom Tromey  <tromey@adacore.com>

	* eval.c (operation::evaluate_funcall): Use function formal
	parameter types when evaluating.

gdb/testsuite/ChangeLog
2021-03-09  Tom Tromey  <tromey@adacore.com>

	* gdb.base/cast-call.exp: New file.
	* gdb.base/cast-call.c: New file.
2021-03-09 07:36:26 -07:00
Jan Beulich
5dc75cf325 ld: adjust PE base relocations testcase
mcore-pe and sh-pe pointed out that the testcase added by 6fa7408d72
("ld: don't generate base relocations in PE output for absolute
symbols") wasn't quite generic enough yet. Copy entry point stuff from
another test and increase alignment to also cover targets with a page
size lower than 4k.

Despite all of this the test needs to be xfail-ed for mcore, as this
target isn't included in the set getting DLL_SUPPORT enabled in
emultempl/pe.em, and hence no base relocations get generated there
(yet).
2021-03-09 12:40:13 +01:00
Andrew Burgess
fbb1aaceba gdb: fix field names of GDB's type main_type structure
In commit:

  commit 5b7d941b90
  Date:   Fri Jan 22 12:21:09 2021 -0500

      gdb: add owner-related methods to struct type

two fields of struct maint_type were renamed.  'flag_objfile_owned'
became 'm_flag_objfile_owned' and 'owner' became 'm_owner'.  Update
our python helper script to take this into account.

I've added a basic test that uses the self-test framework to load the
pretty printers, and print a type.

The test relies on stopping in GDB's `value_print` function.

gdb/ChangeLog:

	* gdb-gdb.py.in (StructMainTypePrettyPrinter) <owner_to_string>:
	Updated fields names flag_objfile_owned to m_flag_objfile_owned,
	and owner to m_owner.

gdb/testsuite/ChangeLog:

	* gdb.gdb/python-helper.exp: New file.
2021-03-09 11:03:26 +00:00
Felix Willgerodt
611aa09d99 gdb/fortran: Add 'LOC' intrinsic support.
LOC(X) returns the address of X as an integer:
https://gcc.gnu.org/onlinedocs/gfortran/LOC.html

Before:
(gdb) p LOC(r)
No symbol "LOC" in current context.

After:
(gdb) p LOC(r)
$1 = 0xffffdf48

gdb/ChangeLog:
2021-03-09  Felix Willgerodt  <felix.willgerodt@intel.com>

        * f-exp.h (eval_op_f_loc): Declare.
        (expr::fortran_loc_operation): New typedef.
        * f-exp.y (exp): Handle UNOP_FORTRAN_LOC after parsing an
        UNOP_INTRINSIC.
        (f77_keywords): Add LOC keyword.
        * f-lang.c (eval_op_f_loc): New function.
        * std-operator.def (UNOP_FORTRAN_LOC): New operator.

gdb/testsuite/ChangeLog:
2020-03-09  Felix Willgerodt  <felix.willgerodt@intel.com>

        * gdb.fortran/intrinsics.exp: Add LOC tests.
2021-03-09 11:34:55 +01:00
Andrew Burgess
eef32f5998 gdb/fotran: add support for the 'shape' keyword
Add support for the SHAPE keyword to GDB's Fortran expression parser.

gdb/ChangeLog:

	* f-exp.h (eval_op_f_array_shape): Declare.
	(fortran_array_shape_operation): New type.
	* f-exp.y (exp): Handle UNOP_FORTRAN_SHAPE after parsing
	UNOP_INTRINSIC.
	(f77_keywords): Add "shape" keyword.
	* f-lang.c (fortran_array_shape): New function.
	(eval_op_f_array_shape): New function.
	* std-operator.def (UNOP_FORTRAN_SHAPE): New operator.

gdb/testsuite/ChangeLog:

	* gdb.fortran/shape.exp: New file.
	* gdb.fortran/shape.f90: New file.
2021-03-09 09:51:23 +00:00
Andrew Burgess
7ba155b370 gdb/fortran: add support for 'SIZE' keyword
Add support for the 'SIZE' keyword to the Fortran expression parser.
This returns the number of elements either in an entire array (passing
a single argument to SIZE), or in a particular dimension of an
array (passing two arguments to SIZE).

At this point I have not added support for the optional third argument
to SIZE, which controls the exact integer type of the result.

gdb/ChangeLog:

	* f-exp.y (eval_op_f_array_size): Declare 1 and 2 argument forms
	of this function.
	(expr::fortran_array_size_1arg): New type.
	(expr::fortran_array_size_2arg): Likewise.
	* f-exp.y (exp): Handle FORTRAN_ARRAY_SIZE after parsing
	UNOP_OR_BINOP_INTRINSIC.
	(f77_keywords): Add "size" keyword.
	* f-lang.c (fortran_array_size): New function.
	(eval_op_f_array_size): New function, has a 1 arg and 2 arg form.
	* std-operator.def (FORTRAN_ARRAY_SIZE): New operator.

gdb/testsuite/ChangeLog:

	* gdb.fortran/size.exp: New file.
	* gdb.fortran/size.f90: New file.
2021-03-09 09:51:23 +00:00
Andrew Burgess
e14816a8ba gdb/fortran: add support for RANK keyword
gfortran supports the RANK keyword, see:

  https://gcc.gnu.org/onlinedocs/gfortran/RANK.html#RANK

this commit adds support for this keyword to GDB's Fortran expression
parser.

gdb/ChangeLog:

	* f-exp.h (eval_op_f_rank): Declare.
	(expr::fortran_rank_operation): New typedef.
	* f-exp.y (exp): Handle UNOP_FORTRAN_RANK after parsing an
	UNOP_INTRINSIC.
	(f77_keywords): Add "rank" keyword.
	* f-lang.c (eval_op_f_rank): New function.
	* std-operator.def (UNOP_FORTRAN_RANK): New operator.

gdb/testsuite/ChangeLog:

	* gdb.fortran/rank.exp: New file.
	* gdb.fortran/rank.f90: New file.
2021-03-09 09:45:18 +00:00
Jan Beulich
742732c7f0 x86: fold some prefix related attributes into a single one
RepPrefixOk, HLEPrefixOk, and NoTrackPrefixOk can't be specified
together, so can share an enum-like field. IsLockable can be inferred
from HLE setting and hence only needs specifying when neither of them
is present.
2021-03-09 08:54:32 +01:00
Jan Beulich
e93a3b27b2 x86-64: make SYSEXIT handling similar to SYSRET's
Despite SYSEXIT being an Intel-only insn in long mode, its behavior
there is similar to SYSRET's: Depending on REX.W execution continues in
either 64-bit or compatibility mode. Hence distinguishing by suffix is
as necessary here as it is there.
2021-03-09 08:53:38 +01:00
Jan Beulich
87fa7d568d bfd: don't silently wrap or truncate PE image section RVAs
In PE images section addresses get expressed as addresses relative to
the image base. Therefore the VA of a section must be no less than the
image base, and after subtraction of the image base the resulting value
should fit in 32 bits. (The issue is particularly obvious to notice when
sections, perhaps because of ELF assumptions, get placed at VA 0 by
default. Debugging info sections as well as .comment, when input files
are ELF, are a good example. All such sections need proper mentioning in
the linker script to avoid this warning.)

There are a number of test cases which previously produced bogus images,
yet still declared the test a success. Like done for other tests
already, force a zero image base for these. This then also allows (and
requires) dropping again xfail-s which 39a7b38fac ("Fix linker tests
to work with 16-bit targets") had added to ld-scripts/default-script*.d
(originally as skip-s). This also depends on similar adjustments to
testsuite/ld-scripts/map-address.* made by an earlier patch.

For ld-scripts/print-memory-usage.* I suppose xcoff could be dropped
from the exclusion list by suppressing garbage collection, just like
already done in e.g. (as seen in the diff here) ld-scripts/data.*, but I
didn't want to make unrelated adjustments.
2021-03-09 08:52:32 +01:00
GDB Administrator
500e7d4cb3 Automatic date update in version.in 2021-03-09 00:00:25 +00:00