aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-11-03asan: dlltool buffer overflow: embedded NUL in stringAlan Modra3-19/+7
yyleng gives the pattern length, xstrdup just copies up to the NUL. So it is quite possible writing at an index of yyleng-2 overflows the xstrdup allocated string buffer. xmemdup quite handily avoids this problem, even writing the terminating NUL over the trailing quote. Use it in ldlex.l too where we'd already had a report of this problem and fixed it by hand, and to implement xmemdup0 in gas. binutils/ * deflex.l (single and double quote strings): Use xmemdup. gas/ * as.h (xmemdup0): Use xmemdup. ld/ PR 20906 * ldlex.l (double quote string): Use xmemdup.
2021-11-03sim: mloop: mark a few conditionally used funcs as unusedMike Frysinger2-3/+4
These are marked inline, so building w/gcc at higher optimization levels will automatically discard them. But building with -O0 will trigger unused function warnings, so fix that. The common before/after cover functions in the common mloop generator are not used by all architecture ports. Doesn't seem to be a hard requirement, so marking them optional (i.e. unused) is fine. The cris execute function is conditionally used depending on the fast-build mode settings, so mark it unused too.
2021-11-03asan: assert (addr_ranges) <= (start)Alan Modra1-10/+9
That assert would be more obvious if it were reported as "addr_ranges <= end_ranges". Fix that by using the obvious variable in the final loop. Stop the assertion by using a signed comparison: It's possible for the rounding up of the arange pointer to exceed the end of the block when the block size is fuzzed. * dwarf.c (display_debug_aranges): Use "end_ranges" in loop displaying ranges rather that "start". Simplify rounding up to 2*address_size boundary. Use signed comparison in loop.
2021-11-02sim: hoist cgen mloop rules up to common buildsMike Frysinger17-199/+707
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization. We have to extend the genmloop.sh logic a bit to allow outputting to a subdir since it always assumed cwd was the right place. We leave the cgen maintainer rules in the subdirs for now as they aren't normally run, and they rely on cgen logic that has not yet been generalized.
2021-11-02sim: hoist mn10300 & v850 igen rules up to common buildsMike Frysinger7-153/+386
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization. We leave the mips rules in place as they depend on complicated arch-specific configure logic that needs to be untangled first.
2021-11-02sim: hoist gencode & opc2c build rules up to common buildsMike Frysinger12-119/+625
These rules don't depend on the target compiler settings, so hoist the build logic up to the common builds for better parallelization.
2021-11-02opcodes: d10v: simplify header includesMike Frysinger1-2/+1
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-03PR28523, ld.bfd created undefined symbols on ppc64Alan Modra1-16/+14
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-03Automatic date update in version.inGDB Administrator1-1/+1
2021-11-02[gdb/tdep, rs6000] Don't skip system call in skip_prologueTom de Vries1-0/+6
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[gdb/testsuite] Handle SIGILL in two gdb.arch powerpc test-casesTom de Vries2-2/+26
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-02gdb/sim: update my email addressAndrew Burgess2-4/+4
gdb: * MAINTAINERS (Global Maintainers): Update my address. (Responsible Maintainers): Likewise. (Write After Approval): Likewise. sim: * MAINTAINERS (Global Maintainers): Update my address.
2021-11-02[gdb/testsuite] Fix stepi test-cases with unix/-m32/-fPIE/-pieTom de Vries5-4/+31
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-02Automatic date update in version.inGDB Administrator1-1/+1
2021-11-02ARM: match armeb output for unwind-pacbti-m testAlan Modra1-3/+3
* testsuite/gas/arm/unwind-pacbti-m.d: Match armeb output.
2021-11-01[gdb/doc]: Updated manpages to be consistent with helpBruno Larsen1-36/+111
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-01macho-o archive sanity checksAlan Modra1-0/+11
Anti-fuzzing checks. * mach-o.c (bfd_mach_o_fat_archive_p): Sanity check entry offset and size against file size.
2021-11-01objcopy buffer overflowAlan Modra1-12/+9
"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-01arm: add armv9-a architecture to -marchPrzemyslaw Wirkus14-26/+131
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-01sim: iq2000: reduce -Wno-error scopeMike Frysinger2-5/+5
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-01sim: lm32: reduce -Wno-error scopeMike Frysinger3-5/+5
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-01sim: frv: reduce -Wno-error scopeMike Frysinger1-2/+2
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-01sim: m32r: reduce -Wno-error scopeMike Frysinger1-2/+2
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-01sim: mips: reduce -Wno-error scopeMike Frysinger2-8/+8
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-01sim: erc32: reduce -Wno-error scopeMike Frysinger1-2/+2
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-01sim: cris: reduce -Wno-error scopeMike Frysinger1-2/+2
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-01sim: sh: reduce -Wno-error scopeMike Frysinger1-2/+2
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-01sim: or1k: build with -WerrorMike Frysinger1-3/+0
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-01sim: igen: minor build output alignment fixMike Frysinger1-1/+1
The custom echo was off by one space relative to all the others.
2021-11-01sim: ppc: fix the printf fix for 32-bit systemsMike Frysinger1-1/+1
The time delta is a 64-bit value too.
2021-11-01sim: m68hc11: clean up pointer castsMike Frysinger1-3/+3
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-01sim: d10v: clean up pointer castsMike Frysinger1-6/+6
Use %p to print pointers instead of trying to cast them to longs.
2021-10-31sim: bfin: cast pointers using uintptr_tMike Frysinger28-61/+61
We can't assume that sizeof(long) == sizeof(void*), so change all these casts over to uintptr_t.
2021-10-31sim: ppc: clean up printf format handlingMike Frysinger9-117/+116
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-31sim: ppc: switch core types to stdint.h typesMike Frysinger1-12/+11
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-31sim: mn10300: clean up pointer castsMike Frysinger2-9/+9
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-31sim: events: clean up trace castsMike Frysinger1-72/+83
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-31sim: ppc: handle \r in igen inputs [PR sim/28476]Mike Frysinger1-8/+16
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-31sim: ppc: constify strings in igen toolingMike Frysinger13-50/+51
2021-11-01Automatic date update in version.inGDB Administrator1-1/+1
2021-10-31Fix latent bug in DWARF test caseTom Tromey1-2/+2
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-31Fix unittest.exp failure due to 'set debuginfod' additionTom Tromey1-2/+2
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-31sim: ppc: use silent build rules here tooMike Frysinger3-50/+50
The ppc codebase is unique and doesn't leverage common/, so have to add silent rules to it specifically.
2021-10-31sim: rl78: drop obsolete manual dependency rulesMike Frysinger1-15/+0
We have GNU make generate these for us automatically now, so there's no need to manually specify any deps.
2021-10-31sim: drop unused targ-vals.h includesMike Frysinger6-7/+0
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-31sim: unify callback.o buildingMike Frysinger3-1/+22
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-31sim: nltvals: pull target open flags out into a dedicated source fileMike Frysinger6-45/+106
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-31sim: nltvals: localize TARGET_<open> definesMike Frysinger3-25/+40
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-31sim: nltvals: pull target signal out into a dedicated source fileMike Frysinger6-65/+157
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-31sim: nltvals: pull target errno out into a dedicated source fileMike Frysinger7-147/+384
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.