Commit Graph

108121 Commits

Author SHA1 Message Date
Mike Frysinger
b50f433498 opcodes: d10v: simplify header includes
This file doesn't use anything from bfd (sysdep.h), so drop that
include.  This avoids an implicit dependency on the generated
config.h which can be problematic for build-time tools.

Also swap stdio.h for stddef.h.  This file isn't doing or using
any I/O structures, but it does need NULL.
2021-11-02 22:57:52 -04:00
Alan Modra
a442059f66 PR28523, ld.bfd created undefined symbols on ppc64
This patch removes any fake (linker created) function descriptor
symbol if its code entry symbol isn't dynamic, to ensure bogus dynamic
symbols are not created.  The change to func_desc_adjust requires that
it be run only once, which means ppc64_elf_tls_setup can't call it for
just a few selected symbols.

	PR 28523
	* elf64-ppc.c (func_desc_adjust): If a function entry sym is
	not dynamic and has no plt entry, hide any associated fake
	function descriptor symbol.
	(ppc64_elf_edit): Move func_desc_adjust iteration over syms to..
	(ppc64_elf_tls_setup): ..here.
2021-11-03 10:46:29 +10:30
GDB Administrator
b480ee76e4 Automatic date update in version.in 2021-11-03 00:00:18 +00:00
Tom de Vries
a50bdb99af [gdb/tdep, rs6000] Don't skip system call in skip_prologue
I ran into a case where a breakpoint on _exit never triggered, because it was
set past the end of the _exit prologue, past the end of the exit_group system
call (which does not return).

More concretely, the breakpoint was set at the last insn show here:
...
Dump of assembler code for function _exit:
   0x00007ffff7e42ea0 <+0>:     12 00 4c 3c     addis   r2,r12,18
   0x00007ffff7e42ea4 <+4>:     60 43 42 38     addi    r2,r2,17248
   0x00007ffff7e42ea8 <+8>:     00 00 00 60     nop
   0x00007ffff7e42eac <+12>:    f8 ff e1 fb     std     r31,-8(r1)
   0x00007ffff7e42eb0 <+16>:    78 1b 7f 7c     mr      r31,r3
   0x00007ffff7e42eb4 <+20>:    f0 ff c1 fb     std     r30,-16(r1)
   0x00007ffff7e42eb8 <+24>:    ea 00 00 38     li      r0,234
   0x00007ffff7e42ebc <+28>:    a0 8b 22 e9     ld      r9,-29792(r2)
   0x00007ffff7e42ec0 <+32>:    78 fb e3 7f     mr      r3,r31
   0x00007ffff7e42ec4 <+36>:    14 6a c9 7f     add     r30,r9,r13
   0x00007ffff7e42ec8 <+40>:    02 00 00 44     sc
   0x00007ffff7e42ecc <+44>:    26 00 00 7c     mfcr    r0
   0x00007ffff7e42ed0 <+48>:    00 10 09 74     andis.  r9,r0,4096
...

Fix this by treating system calls the same as branches in skip_prologue:
by default, don't skip, such that the breakpoint is set at 0x00007ffff7e42eb8
instead.

Tested on ppc64le-linux, on a power 8 machine.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28527
2021-11-02 19:08:49 +01:00
Tom de Vries
d74dfa8f63 [gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-cases
On powerpc64le-linux, with test-case gdb.arch/powerpc-addpcis.exp I run into
SIGILL:
...
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: get hexadecimal valueof "$r3"
stepi^M
^M
Program terminated with signal SIGILL, Illegal instruction.^M
The program no longer exists.^M
(gdb) PASS: gdb.arch/powerpc-addpcis.exp: set r4
...
because it's a power9 insn, and I'm running on a power8 machine.

Fix this by handling the SIGILL.  Likewise in gdb.arch/powerpc-lnia.exp.

Tested on powerpc64le-linux.
2021-11-02 18:55:32 +01:00
Andrew Burgess
bd25c6eef8 gdb/sim: update my email address
gdb:

	* MAINTAINERS (Global Maintainers): Update my address.
	(Responsible Maintainers): Likewise.
	(Write After Approval): Likewise.

sim:

	* MAINTAINERS (Global Maintainers): Update my address.
2021-11-02 09:20:24 +00:00
Tom de Vries
c47860a4ba [gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pie
When running test-case gdb.base/step-indirect-call-thunk.exp with target board
unix/-m32/-fPIE/-pie, I run into:
...
(gdb) stepi^M
0x5655552e      22      {                /* inc.1 */^M
(gdb) stepi^M
0x56555530      22      {                /* inc.1 */^M
(gdb) stepi^M
0x565555f7 in __x86.get_pc_thunk.ax ()^M
(gdb) FAIL: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

In contrast, with unix/-m32 we have instead:
...
(gdb) stepi^M
0x08048407      22      {                /* inc.1 */^M
(gdb) stepi^M
23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
0x0804840c      23        return x + 1;  /* inc.2 */^M
(gdb) stepi^M
24      }                /* inc.3 */^M
(gdb) stepi^M
0x08048410      24      }                /* inc.3 */^M
(gdb) stepi^M
0x0804848f in __x86_return_thunk ()^M
(gdb) PASS: gdb.base/step-indirect-call-thunk.exp: stepi into return thunk
...

The test-case doesn't expect to run into __x86.get_pc_thunk.ax, which is a
PIC helper function for x86_64-linux.

Fix this by insn-stepping through it.

Likewise in a few other test-cases.

Tested on x86_64-linux.
2021-11-02 09:27:48 +01:00
GDB Administrator
317db249c7 Automatic date update in version.in 2021-11-02 00:00:17 +00:00
Alan Modra
09348c7665 ARM: match armeb output for unwind-pacbti-m test
* testsuite/gas/arm/unwind-pacbti-m.d: Match armeb output.
2021-11-02 09:59:17 +10:30
Bruno Larsen
2047d95b89 [gdb/doc]: Updated manpages to be consistent with help
Updated manpages to be consistent with help information provided by the
binary. The main changes are:

* Making all long-form options have '--', instead of a single '-';
* added most of the missing options to the manpage;
* removed the information about using '+' instead of '-', since it
  doesn't seem to be supported anymore.

This also fixes 2 upstream bugs:
* https://sourceware.org/bugzilla/show_bug.cgi?id=23965; by adding
--args to the manpage
* https://sourceware.org/bugzilla/show_bug.cgi?id=10619; by adding the
double dashes
2021-11-01 10:47:19 -03:00
Alan Modra
c908dea26f macho-o archive sanity checks
Anti-fuzzing checks.

	* mach-o.c (bfd_mach_o_fat_archive_p): Sanity check entry offset
	and size against file size.
2021-11-01 22:30:33 +10:30
Alan Modra
c27cdb4c53 objcopy buffer overflow
"tocopy" in this code was an int, which when the size to be copied was
larger than MAXINT could result in tocopy being negative.  A negative
value of course is less than BUFSIZE, but when converted to
bfd_size_type is extremely large.

	PR 995
	* objcopy.c (copy_unknown_object): Correct calculation of "tocopy".
	Use better variable types.
2021-11-01 22:30:33 +10:30
Przemyslaw Wirkus
3197e593d8 arm: add armv9-a architecture to -march
Update also include:
	+ New value of Tag_CPU_arch EABI attribute (22) is added.
	+ Updated missing Tag_CPU_arch EABI attributes.
	+ Updated how we combine archs 'v4t_plus_v6_m' as this mechanism
	  have to handle new Armv9 as well.

Regression tested on `arm-none-eabi` cross Binutils and no issues.

bfd/

	* archures.c: Define bfd_mach_arm_9.
	* bfd-in2.h (bfd_mach_arm_9): Define bfd_mach_arm_9.
	* cpu-arm.c: Add 'armv9-a' option to -march.
	* elf32-arm.c (using_thumb2_bl): Update assert check.
	(arch_has_arm_nop): Add TAG_CPU_ARCH_V9.
	(bfd_arm_get_mach_from_attributes): Add case for TAG_CPU_ARCH_V9.
	Update assert.
	(tag_cpu_arch_combine): Updated table.
	(v9): New table..

binutils/

	* readelf.c (arm_attr_tag_CPU_arch): Update with

elfcpp/

	* arm.h: Update TAG_CPU_ARCH_ enums with correct values.

gas/

	* NEWS: Update docs.
	* config/tc-arm.c (get_aeabi_cpu_arch_from_fset): Return Armv9-a
	for -amarch=all.
	(aeabi_set_public_attributes): Update assert.
	* doc/c-arm.texi: Update docs.
	* testsuite/gas/arm/armv9-a_arch.d: New test.
	* testsuite/gas/arm/attr-march-all.d: Update test with v9.

include/

	* elf/arm.h Update TAG_CPU_ARCH_ defines with correct values.
	* opcode/arm.h (ARM_EXT3_V9A): New macro.
	(ARM_ARCH_NONE): Updated with arm_feature_set.core size.
	(FPU_NONE): Updated.
	(ARM_ANY): Updated.
	(ARM_ARCH_UNKNOWN): New macro.
	(ARM_FEATURE_LOW): Updated.
	(ARM_FEATURE_CORE): Updated.
	(ARM_FEATURE_CORE_LOW): Updated.
	(ARM_FEATURE_CORE_HIGH): Updated.
	(ARM_FEATURE_COPROC): Updated.
	(ARM_FEATURE): Updated.
	(ARM_FEATURE_ALL): New macro.

opcodes/

	* arm-dis.c (select_arm_features): Support bfd_mach_arm_9.
	Also Update bfd_mach_arm_unknown to use new macro ARM_ARCH_UNKNOWN.
2021-11-01 10:51:03 +00:00
Mike Frysinger
94c9216c03 sim: iq2000: reduce -Wno-error scope
Clean up the warnings in sim-if, then reduce the -Werror disable to
the files that still aren't clean that now that we require GNU make
and can set variables on a per-object basis.
2021-11-01 00:58:05 -04:00
Mike Frysinger
2871d4d7f3 sim: lm32: reduce -Wno-error scope
Clean up some warnings in dv-lm32cpu, and all in sim-if, then reduce
the -Werror disable to the files that still aren't clean that now that
we require GNU make and can set variables on a per-object basis.
2021-11-01 00:56:52 -04:00
Mike Frysinger
97ebc24886 sim: frv: reduce -Wno-error scope
Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.
2021-11-01 00:56:35 -04:00
Mike Frysinger
5d2b3c53a5 sim: m32r: reduce -Wno-error scope
Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.
2021-11-01 00:56:08 -04:00
Mike Frysinger
6391b286b1 sim: mips: reduce -Wno-error scope
Fix a few printf warnings in sim-main.c, and then we're left with only
one file in here still generating warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
2021-11-01 00:55:27 -04:00
Mike Frysinger
d0d7f2a742 sim: erc32: reduce -Wno-error scope
Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
2021-11-01 00:55:02 -04:00
Mike Frysinger
c79eb8d991 sim: cris: reduce -Wno-error scope
Only two files in here still generates warnings, so reduce the -Werror
disable to that now that we require GNU make and can set variables on
a per-object basis.
2021-11-01 00:54:36 -04:00
Mike Frysinger
cd37cffed6 sim: sh: reduce -Wno-error scope
Only one file in here still generates warnings, so reduce the -Werror
disable to that alone now that we require GNU make and can set variables
on a per-object basis.
2021-11-01 00:53:38 -04:00
Mike Frysinger
5c15e06faf sim: or1k: build with -Werror
The only warnings left in this port are a few maybe-uninitialized,
but we don't abort the build for them, so turn on -Werror everywhere.
2021-11-01 00:52:52 -04:00
Mike Frysinger
0eecf48fd4 sim: igen: minor build output alignment fix
The custom echo was off by one space relative to all the others.
2021-11-01 00:27:49 -04:00
Mike Frysinger
8009a84cfd sim: ppc: fix the printf fix for 32-bit systems
The time delta is a 64-bit value too.
2021-11-01 00:25:13 -04:00
Mike Frysinger
06969ac449 sim: m68hc11: clean up pointer casts
The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an integer.  Fix up the
casts to avoid using (long) to cast to/from pointers since there
is no guarantee that's the right size.
2021-11-01 00:07:15 -04:00
Mike Frysinger
6dc840d69d sim: d10v: clean up pointer casts
Use %p to print pointers instead of trying to cast them to longs.
2021-11-01 00:05:15 -04:00
Mike Frysinger
f0bef2e9a7 sim: bfin: cast pointers using uintptr_t
We can't assume that sizeof(long) == sizeof(void*), so change all
these casts over to uintptr_t.
2021-10-31 23:55:51 -04:00
Mike Frysinger
fad7f13ae1 sim: ppc: clean up printf format handling
Don't blindly cast every possible type to (long).  Change to the right
printf format specifier whether it be a 64-bit type or a pointer.
2021-10-31 23:49:13 -04:00
Mike Frysinger
7b83db6a74 sim: ppc: switch core types to stdint.h types
There's no need to define these ourselves anymore, so switch to the
stdint.h types.  This will be important when we start using PRI*
defines with printf formats.
2021-10-31 23:48:16 -04:00
Mike Frysinger
ad2511744f sim: mn10300: clean up pointer casts
The void *data field is used to past arbitrary data between event
handlers, and these are using it to pass an enum.  Fix up the casts
to avoid using (long) to cast to/from pointers since there is no
guarantee that's the right size.
2021-10-31 23:21:36 -04:00
Mike Frysinger
c704d6e7ee sim: events: clean up trace casts
Don't blindly cast every possible type to (long).  Change to the right
printf format specifier whether it be a 64-bit type or a pointer.
2021-10-31 23:05:45 -04:00
Mike Frysinger
f098231806 sim: ppc: handle \r in igen inputs [PR sim/28476]
Make sure we consume & ignore \r bytes in inputs in case the file
encodings are from a non-LF systems (e.g. Windows).
2021-10-31 22:35:41 -04:00
Mike Frysinger
fc3579da2e sim: ppc: constify strings in igen tooling 2021-10-31 22:34:02 -04:00
GDB Administrator
e7360783ae Automatic date update in version.in 2021-11-01 00:00:19 +00:00
Tom Tromey
6e195444fb Fix latent bug in DWARF test case
On my branch that replaces the DWARF psymtab reader,
dw2-stack-boundary.exp started failing.  However, when I look at the
output in gdb.log, it is correct:

    file /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary
    Reading symbols from /home/tromey/gdb/build/gdb/testsuite/outputs/gdb.dwarf2/dw2-stack-boundary/dw2-stack-boundary...
    During symbol reading: location description stack overflow
    During symbol reading: location description stack underflow

What happens to cause the failure is that the two branches in
gdb_test_multiple appear in this order:

    -re "\r\nDuring symbol reading: location description stack underflow" {
    [...]
    -re "\r\nDuring symbol reading: location description stack overflow" {

The first one will match the above, without causing the second one to
ever match -- leading to a spurious failure.

Anchoring the regexps seems to fix the problem, and works for the
current gdb as well.
2021-10-31 11:35:28 -06:00
Tom Tromey
2a8f1f4744 Fix unittest.exp failure due to 'set debuginfod' addition
The 'set debuginfod' change caused a regression in unittest.exp:

    Running selftest help_doc_invariants.
    help doc broken invariant: command 'info set debuginfod' help doc first line is not terminated with a '.' character
    help doc broken invariant: command 'set debuginfod' help doc first line is not terminated with a '.' character
    help doc broken invariant: command 'show debuginfod' help doc first line is not terminated with a '.' character
    Self test failed: self-test failed at ../../binutils-gdb/gdb/unittests/command-def-selftests.c:100

This patch fixes the problem.  I'm checking it in.
2021-10-31 11:34:06 -06:00
Mike Frysinger
c26c6bc0a5 sim: ppc: use silent build rules here too
The ppc codebase is unique and doesn't leverage common/, so have to
add silent rules to it specifically.
2021-10-31 05:26:57 -04:00
Mike Frysinger
5231e3f242 sim: rl78: drop obsolete manual dependency rules
We have GNU make generate these for us automatically now, so there's
no need to manually specify any deps.
2021-10-31 05:09:09 -04:00
Mike Frysinger
f9bfc01578 sim: drop unused targ-vals.h includes
This is used in a few places where it's not needed.  Drop the include
to avoid the build-time generated header file as we move to drop it.
2021-10-31 04:53:22 -04:00
Mike Frysinger
cd3ee89d38 sim: unify callback.o building
Now that the use of TARGET_xxx defines have been removed, we can move
this to the common logic so we only build it once for multi-targets.
2021-10-31 04:51:44 -04:00
Mike Frysinger
670817b947 sim: nltvals: pull target open flags out into a dedicated source file
Like we just did for pulling out the errno & signal maps, pull out the
open flag map into a dedicated common file.  All newlib ports are using
the same map which makes it easy.
2021-10-31 04:51:44 -04:00
Mike Frysinger
b868a2393b sim: nltvals: localize TARGET_<open> defines
Code should not be using these directly, instead they should be
resolving these dynamically via the open_map.  Rework the common
callback code that was using the defines to use symbolic names
instead, and localize some of the defines in the ARM code (since
it's a bit unclear how many different APIs it supports currently),
then remove the defines out of the header so no new code can rely on
them.
2021-10-31 04:50:44 -04:00
Mike Frysinger
88c8370b25 sim: nltvals: pull target signal out into a dedicated source file
Like we just did for pulling out the errno map, pull out the signal
map into a dedicated common file.  All newlib ports are using the
same signal map which makes it easy.
2021-10-31 04:39:13 -04:00
Mike Frysinger
a7e40a9931 sim: nltvals: pull target errno out into a dedicated source file
The current system maintains a list of target errno constants in the
nltvals.def file, then runs a build-time tool to turn that into a C
file.  This list of errno values is the same for all arches, so we
don't need the arch-specific flexibility.  Further, these are only
for newlib/libgloss environments, which makes it confusing to support
other userland runtimes (like Linux).  Let's simplify to make this
easier to understand & build.  We don't namespace the variables yet,
but sets up the framework for it.

Create a new target-newlib-errno.c template file.  The template file
is hand written, but the inline map is still automatically generated.

This allows us to move it to the common set of objects so it's only
built once in a multi-target build.

Now we can remove the output from the gentmap build-time tool since
it's checked into the tree.

Then we stop including the errno lists in nltvals.def since nothing
uses it.
2021-10-31 04:31:28 -04:00
Mike Frysinger
f9cd2be59c sim: erc32: use silent build rules with sis linkage 2021-10-31 04:19:41 -04:00
Mike Frysinger
5b3c2b9f3b sim: erc32: fix a few more build warnings
Tweak the if indentation & brace style to avoid ambiguous warnings.

Add ATTRIBUTE_UNUSED to UART functions that aren't used when FAST_UART
is defined (which is the default).
2021-10-31 04:18:58 -04:00
Orgad Shaneh
4ab6404b1c sim: erc32: fix signedness compatibility and redefinition warnings 2021-10-31 04:11:38 -04:00
Mike Frysinger
65dcce8f79 sim: add arch-specific conditional logic
This will make it easy to include arch-specific logic (build files)
as we migrate ports to the common top level build.
2021-10-31 02:03:16 -04:00
Mike Frysinger
68c2129ae6 sim: v850: delete old gencode logic
The v850 port used to have a gencode helper, but it was deleted long
ago.  Clean up the settings that no longer make sense w/out it.
2021-10-31 01:49:17 -04:00
Mike Frysinger
2213e33dd2 sim: common: merge multiple clean commands
This provides a minor speedup when cleaning in a multi-target build.
2021-10-31 01:17:10 -04:00