aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-02-08Run clang-format.shusers/simark/clang-formatSimon Marchi1273-118737/+107713
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
2023-02-08Add .clang-format and clang-format.shSimon Marchi5-1/+409
Add .clang-format from [1] and script to easily make a mass reformat. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=30098 Change-Id: Ibc8dc7f33fa1226dc67c59e4ccd0d624685e0316
2023-02-08Remove block.h includes from some tdep filesTom Tromey5-5/+0
A few tdep files include block.h but do not need to. This patch removes the inclusions. I checked that this worked correctly by examining the resulting .Po file to make sure that block.h was not being included by some other route.
2023-02-08Don't include block.h from expop.hTom Tromey2-6/+8
expop.h needs block.h for a single inline function. However, I don't think most of the check_objfile functions need to be defined in the header (just the templates). This patch moves the one offending function and removes the include.
2023-02-08Simplify interp::exec / interp_exec - let exceptions propagatePedro Alves7-64/+30
This patch implements a simplication that I suggested here: https://sourceware.org/pipermail/gdb-patches/2022-March/186320.html Currently, the interp::exec virtual method interface is such that subclass implementations must catch exceptions and then return them via normal function return. However, higher up the in chain, for the CLI we get to interpreter_exec_cmd, which does: for (i = 1; i < nrules; i++) { struct gdb_exception e = interp_exec (interp_to_use, prules[i]); if (e.reason < 0) { interp_set (old_interp, 0); error (_("error in command: \"%s\"."), prules[i]); } } and for MI we get to mi_cmd_interpreter_exec, which has: void mi_cmd_interpreter_exec (const char *command, char **argv, int argc) { ... for (i = 1; i < argc; i++) { struct gdb_exception e = interp_exec (interp_to_use, argv[i]); if (e.reason < 0) error ("%s", e.what ()); } } Note that if those errors are reached, we lose the original exception's error code. I can't see why we'd want that. And, I can't see why we need to have interp_exec catch the exception and return it via the normal return path. That's normally needed when we need to handle propagating exceptions across C code, like across readline or ncurses, but that's not the case here. It seems to me that we can simplify things by removing some try/catch-ing and just letting exceptions propagate normally. Note, the "error in command" error shown above, which only exists in the CLI interpreter-exec command, is only ever printed AFAICS if you run "interpreter-exec console" when the top level interpreter is already the console/tui. Like: (gdb) interpreter-exec console "foobar" Undefined command: "foobar". Try "help". error in command: "foobar". You won't see it with MI's "-interpreter-exec console" from a top level MI interpreter: (gdb) -interpreter-exec console "foobar" &"Undefined command: \"foobar\". Try \"help\".\n" ^error,msg="Undefined command: \"foobar\". Try \"help\"." (gdb) nor with MI's "-interpreter-exec mi" from a top level MI interpreter: (gdb) -interpreter-exec mi "-foobar" ^error,msg="Undefined MI command: foobar",code="undefined-command" ^done (gdb) in both these cases because MI's -interpreter-exec just does: error ("%s", e.what ()); You won't see it either when running an MI command with the CLI's "interpreter-exec mi": (gdb) interpreter-exec mi "-foobar" ^error,msg="Undefined MI command: foobar",code="undefined-command" (gdb) This last case is because MI's interp::exec implementation never returns an error: gdb_exception mi_interp::exec (const char *command) { mi_execute_command_wrapper (command); return gdb_exception (); } Thus I think that "error in command" error is pretty pointless, and since it simplifies things to not have it, the patch just removes it. The patch also ends up addressing an old FIXME. Change-Id: I5a6432a80496934ac7127594c53bf5221622e393 Approved-By: Tom Tromey <tromey@adacore.com> Approved-By: Kevin Buettner <kevinb@redhat.com>
2023-02-08Avoid FAILs in gdb.compileTom Tromey2-8/+55
Many gdb.compile C++ tests fail for me on Fedora 36. I think these are largely bugs in the plugin, though I didn't investigate too deeply. Once one failure is seen, this often cascades and sometimes there are many timeouts. For example, this can happen: (gdb) compile code var = a->get_var () warning: Could not find symbol "_ZZ9_gdb_exprP10__gdb_regsE1a" for compiled module "/tmp/gdbobj-0xdI6U/out2.o". 1 symbols were missing, cannot continue. I think this is probably a plugin bug because, IIRC, in theory these symbols should be exempt from a lookup via gdb. This patch arranges to catch any catastrophic failure and then simply exit the entire .exp file.
2023-02-08Don't let .gdb_history file cause failuresTom Tromey1-0/+4
I had a .gdb_history file in my testsuite directory in the build tree, and this provoked a failure in gdbhistsize-history.exp. It seems simple to prevent this file from causing a failure.
2023-02-08Merge fixup_section and fixup_symbol_sectionTom Tromey2-70/+45
fixup_symbol_section delegates all its work to fixup_section, so merge the two. Because there is only a single caller to fixup_symbol_section, we can also remove some of the introductory logic. For example, this will never be called with a NULL objfile any more. The LOC_BLOCK case can be removed, because such symbols are handled by the buildsym code now. Finally, a symbol can only appear in a SEC_ALLOC section, so the loop is modified to skip sections that do not have this flag set.
2023-02-08Remove most calls to fixup_symbol_sectionTom Tromey5-36/+10
Nearly every call to fixup_symbol_section in gdb is incorrect, and if any such call has an effect, it's purely by happenstance. fixup_section has a long comment explaining that the call should only be made before runtime section offsets are applied. And, the loop in this code (the fallback loop -- the minsym lookup code is "ok") is careful to remove these offsets before comparing addresses. However, aside from a single call in dwarf2/read.c, every call in gdb is actually done after section offsets have been applied. So, these calls are incorrect. Now, these calls could be made when the symbol is created. I considered this approach, but I reasoned that the code has been this way for many years, seemingly without ill effect. So, instead I chose to simply remove the offending calls.
2023-02-08Set section index when setting a symbol's blockTom Tromey1-0/+1
When a symbol's block is set, the block has the runtime section offset applied. So, it seems to me that the symbol implicitly is in the same section as the block. Therefore, this patch sets the symbol's section index at this same spot.
2023-02-08Remove compunit_symtab::m_block_line_sectionTom Tromey6-29/+6
The previous patch hard-coded SECT_OFF_TEXT into the buildsym code. After this, it's clear that there is only one caller of compunit_symtab::set_block_line_section, and it always passes SECT_OFF_TEXT. So, remove compunit_symtab::m_block_line_section and use SECT_OFF_TEXT instead.
2023-02-08Do not pass section index to end_compunit_symtabTom Tromey10-46/+32
Right now, the section index passed to end_compunit_symtab is always SECT_OFF_TEXT. Remove this parameter and simply always use SECT_OFF_TEXT.
2023-02-08Set section indices when symbols are madeTom Tromey4-11/+43
Most places in gdb that create a new symbol will apply a section offset to the address. It seems to me that the choice of offset here is also an implicit choice of the section. This is particularly true if you examine fixup_section, which notes that it must be called before such offsets are applied -- meaning that if any such call has an effect, it's purely by accident. This patch cleans up this area by tracking the section index and applying it to a symbol when the address is set. This is done for nearly every case -- the remaining cases will be handled in later patches.
2023-02-08Use default section indexes in fixup_symbol_sectionTom Tromey2-8/+17
If fixup_section does not find a matching section, it arbitrarily chooses the first one. However, it seems better to make this default depend on the type of the symbol -- i.e., default data symbols to .data and text symbols to .text. I've also made fixup_section static, as it only has one caller.
2023-02-08Simplify checks of cooked_indexTom Tromey1-12/+14
This changes the cooked_index_functions to avoid an extra null check now that checked_static_cast allows a null argument. Approved-By: Simon Marchi <simon.marchi@efficios.com>
2023-02-08[gdb/testsuite] Use maint ignore-probes in gdb.base/longjmp.expTom de Vries1-138/+157
Test-case gdb.base/longjmp.exp handles both the case that there is a libc longjmp probe, and the case that there isn't. However, it only tests one of the two cases. Use maint ignore-probes to test both cases, if possible. Tested on x86_64-linux.
2023-02-08[gdb/testsuite] Use maint ignore-probes in gdb.base/solib-corrupted.expTom de Vries1-12/+14
Test-case gdb.base/solib-corrupted.exp only works for a glibc without probes interface, otherwise we run into: ... XFAIL: gdb.base/solib-corrupted.exp: info probes UNTESTED: gdb.base/solib-corrupted.exp: GDB is using probes ... Fix this by using maint ignore-probes to simulate the absence of the relevant probes. Also, it requires glibc debuginfo, and if not present, it produces an XFAIL: ... XFAIL: gdb.base/solib-corrupted.exp: make solibs looping UNTESTED: gdb.base/solib-corrupted.exp: no _r_debug symbol has been found ... This is incorrect, because an XFAIL indicates a known problem in the environment. In this case, there is no problem: the environment is functioning as expected when glibc debuginfo is not installed. Fix this by using UNSUPPORTED instead, and make the message less cryptic: ... UNSUPPORTED: gdb.base/solib-corrupted.exp: make solibs looping \ (glibc debuginfo required) ... Finally, with glibc debuginfo present, we run into: ... (gdb) PASS: gdb.base/solib-corrupted.exp: make solibs looping info sharedlibrary^M warning: Corrupted shared library list: 0x7ffff7ffe750 != 0x0^M From To Syms Read Shared Object Library^M 0x00007ffff7dd4170 0x00007ffff7df4090 Yes /lib64/ld-linux-x86-64.so.2^M (gdb) FAIL: gdb.base/solib-corrupted.exp: corrupted list \ (shared library list corrupted) ... due to commit 44288716537 ("gdb, testsuite: extend gdb_test_multiple checks"). Fix this by rewriting into gdb_test_multiple and using -early. Tested on x86_64-linux, with and without glibc debuginfo installed.
2023-02-07gprofng: fix SIGSEGV when processing unusual dwarfVladimir Mezentsev2-14/+22
gprofng/ChangeLog 2023-02-07 Vladimir Mezentsev <vladimir.mezentsev@oracle.com> PR gprofng/30093 * src/Dwarf.cc: add nullptr check. * src/DwarfLib.cc: Likewise.
2023-02-08Re: Resetting section vma after _bfd_dwarf2_find_nearest_lineAlan Modra1-1/+1
f.bfd_ptr is set too early to be a reliable indicator of good debug info. * dwarf2.c (_bfd_dwarf2_slurp_debug_info): Correct test for debug info being previously found.
2023-02-08Automatic date update in version.inGDB Administrator1-1/+1
2023-02-07gdb: fix display of thread condition for multi-location breakpointsAndrew Burgess5-22/+136
This commit addresses the issue in PR gdb/30087. If a breakpoint with multiple locations has a thread condition, then the 'info breakpoints' output is a little messed up, here's an example of the current output: (gdb) break foo thread 1 Breakpoint 2 at 0x401114: foo. (3 locations) (gdb) break bar thread 1 Breakpoint 3 at 0x40110a: file /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32. (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y <MULTIPLE> thread 1 stop only in thread 1 2.1 y 0x0000000000401114 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 2.2 y 0x0000000000401146 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 2.3 y 0x0000000000401168 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 3 breakpoint keep y 0x000000000040110a in bar at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32 thread 1 stop only in thread 1 Notice that, at the end of the location for breakpoint 3, the 'thread 1' condition is printed, but this is then repeated on the next line with 'stop only in thread 1'. In contrast, for breakpoint 2, the 'thread 1' appears randomly, in the "What" column, though slightly offset, non of the separate locations have the 'thread 1' information. Additionally for breakpoint 2 we also get a 'stop only in thread 1' line. There's two things going on here. First the randomly placed 'thread 1' for breakpoint 2 is due to a bug in print_one_breakpoint_location, where we check the variable part_of_multiple instead of header_of_multiple. If I fix this oversight, then the output is now: (gdb) break foo thread 1 Breakpoint 2 at 0x401114: foo. (3 locations) (gdb) break bar thread 1 Breakpoint 3 at 0x40110a: file /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32. (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y <MULTIPLE> stop only in thread 1 2.1 y 0x0000000000401114 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1 2.2 y 0x0000000000401146 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1 2.3 y 0x0000000000401168 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 thread 1 3 breakpoint keep y 0x000000000040110a in bar at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32 thread 1 stop only in thread 1 The 'thread 1' condition is now displayed at the end of each location, which makes the output the same for single location breakpoints and multi-location breakpoints. However, there's still some duplication here. Both breakpoints 2 and 3 include a 'stop only in thread 1' line, and it feels like the additional 'thread 1' is redundant. In fact, there's a comment to this very effect in the code: /* FIXME: This seems to be redundant and lost here; see the "stop only in" line a little further down. */ So, lets fix this FIXME. The new plan is to remove all the trailing 'thread 1' markers from the CLI output, we now get this: (gdb) break foo thread 1 Breakpoint 2 at 0x401114: foo. (3 locations) (gdb) break bar thread 1 Breakpoint 3 at 0x40110a: file /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c, line 32. (gdb) info breakpoints Num Type Disp Enb Address What 2 breakpoint keep y <MULTIPLE> stop only in thread 1 2.1 y 0x0000000000401114 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 2.2 y 0x0000000000401146 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 2.3 y 0x0000000000401168 in foo at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:25 3 breakpoint keep y 0x000000000040110a in bar at /tmp/src/gdb/testsuite/gdb.base/thread-bp-multi-loc.c:32 stop only in thread 1 All of the above points are also true for the Ada 'task' breakpoint condition, and the changes I've made also update how the task information is printed, though in the case of the Ada task there was no 'stop only in task XXX' line printed, so I've added one of those. Obviously it can't be quite that easy. For MI backwards compatibility I've retained the existing code (but now only for MI like outputs), which ensures we should generate backwards compatible output. I've extended an Ada test to cover the new task related output, and updated all the tests I could find that checked for the old output. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30087 Approved-By: Pedro Alves <pedro@palves.net>
2023-02-07Fix documentation of the 'n' symbol type displayed by nm.Nick Clifton2-1/+7
PR 30080 * doc/binutils.texi (nm): Update description of the 'n' symbol type.
2023-02-07[gdb/testsuite] Improve untested message in gdb.ada/finish-var-size.expTom de Vries1-4/+1
I came across: ... UNTESTED: gdb.ada/finish-var-size.exp: GCC too told for this test ... The message only tells us that the compiler version too old, not what compiler version is required. Fix this by rewriting using required: ... UNSUPPORTED: gdb.ada/finish-var-size.exp: require failed: \ expr [gcc_major_version] >= 12 ... Tested on x86_64-linux.
2023-02-07Automatic date update in version.inGDB Administrator1-1/+1
2023-02-06gdb: adjust comment on target_desc_info::from_user_pSimon Marchi1-1/+1
Remove the stale reference to INFO, which is now "this target description info" now. Change-Id: I35dbdb089048ed7cfffe730d3134ee391b176abf
2023-02-06gdb/doc: extend the documentation for the 'handle' commandAndrew Burgess1-7/+8
The documentation for the 'handle' command does not cover all of the features of the command, and in one case, is just wrong. The user can specify 'all' as signal name, the documentation implies that this will change the behaviour of all signals, in reality, this changes all signals except SIGINT and SIGTRAP (the signals used by GDB). I've updated the docs to list this limitation. The 'handle' command also allows the user to specify multiple signals for a single command, e.g. 'handle SIGFPE SIGILL nostop pass print', however the documentation doesn't describe this, so I've updated the docs to describe this feature.
2023-02-06ppc32 and "LOAD segment with RWX permissions"Alan Modra4-5/+25
When using a bss-plt we'll always trigger the RWX warning, which disturbs gcc test results. On the other hand, there may be reason to want the warning when gcc is configured with --enable-secureplt. So turning off the warning entirely for powerpc might not be the best solution. Instead, we'll turn off the warning whenever a bss-plt is generated, unless the user explicitly asked for the warning. bfd/ * elf32-ppc.c (ppc_elf_select_plt_layout): Set no_warn_rwx_segments on generating a bss plt, unless explicity enabled by the user. Also show the bss-plt warning when --warn-rwx-segments is given without --bss-plt. include/ * bfdlink.h (struct bfd_link_info): Add user_warn_rwx_segments. ld/ * lexsup.c (parse_args): Set user_warn_rwx_segments. * testsuite/ld-elf/elf.exp: Pass --secure-plt for powerpc to the rwx tests.
2023-02-06[gdb/testsuite] Fix gdb.threads/schedlock.exp on fast cpuTom de Vries1-4/+7
Occasionally, I run into: ... (gdb) PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ set scheduler-locking on continue^M Continuing.^M PASS: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ continue (with lock) [Thread 0x7ffff746e700 (LWP 1339) exited]^M No unwaited-for children left.^M (gdb) Quit^M (gdb) FAIL: gdb.threads/schedlock.exp: schedlock=on: cmd=continue: \ stop all threads (with lock) (timeout) ... What happens is that this loop which is supposed to run "just short of forever": ... /* Don't run forever. Run just short of it :) */ while (*myp > 0) { /* schedlock.exp: main loop. */ MAYBE_CALL_SOME_FUNCTION(); (*myp) ++; } ... finishes after 0x7fffffff iterations (when a signed wrap occurs), which on my system takes only about 1.5 seconds. Fix this by: - changing the pointed-at type of myp from signed to unsigned, which makes the wrap defined behaviour (and which also make the loop run twice as long, which is already enough to make it impossible for me to reproduce the FAIL. But let's try to solve this more structurally). - changing the pointed-at type of myp from int to long long, making the wrap unlikely. - making sure the loop runs forever, by setting the loop condition to 1. - making sure the loop still contains different lines (as far as debug info is concerned) by incrementing a volatile counter in the loop. - making sure the program doesn't run forever in case of trouble, by adding an "alarm (30)". Tested on x86_64-linux. PR testsuite/30074 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30074
2023-02-06gdb: error if 'thread' or 'task' keywords are overusedAndrew Burgess6-2/+42
When creating a breakpoint or watchpoint, the 'thread' and 'task' keywords can be used to create a thread or task specific breakpoint or watchpoint. Currently, a thread or task specific breakpoint can only apply for a single thread or task, if multiple threads or tasks are specified when creating the breakpoint (or watchpoint), then the last specified id will be used. The exception to the above is that when the 'thread' keyword is used during the creation of a watchpoint, GDB will give an error if 'thread' is given more than once. In this commit I propose making this behaviour consistent, if the 'thread' or 'task' keywords are used more than once when creating either a breakpoint or watchpoint, then GDB will give an error. I haven't updated the manual, we don't explicitly say that these keywords can be repeated, and (to me), given the keyword takes a single id, I don't think it makes much sense to repeat the keyword. As such, I see this more as adding a missing error to GDB, rather than making some big change. However, I have added an entry to the NEWS file as I guess it is possible that some people might hit this new error with an existing (I claim, badly written) GDB script. I've added some new tests to check for the new error. Just one test needed updating, gdb.linespec/keywords.exp, this test did use the 'thread' keyword twice, and expected the breakpoint to be created. Looking at what this test was for though, it was checking the use of '-force-condition', and I don't think that being able to repeat 'thread' was actually a critical part of this test. As such, I've updated this test to expect the error when 'thread' is repeated.
2023-02-06Resetting section vma after _bfd_dwarf2_find_nearest_lineAlan Modra1-42/+33
There are failure paths in _bfd_dwarf2_slurp_debug_info that can result in altered section vmas. Also, when setting ET_REL section vmas it's not too difficult to handle cases where the original vma was non-zero, so do that too. This patch was really in response to an addr2line buffer overflow processing a fuzzed mips relocatable object file. The file had a number of .debug_info sections with relocations that included lo16 and hi16 relocs, and in that order. At least one section VMA was non-zero. This resulted in processing of DWARF info twice, once via the call to _bfd_dwarf2_find_nearest_line in _bfd_mips_elf_find_nearest_line, and because that failed leaving VMAs altered, the second via the call in _bfd_elf_find_nearest_line. The first call left entries on mips_hi16_list pointing at buffers allocated during the first call, the second call processed the mips_hi16_list after the buffers had been freed. (At least when running with asan and under valgrind. Under gdb with a non-asan addr2line the second call allocated exactly the same buffer and the bug didn't show.) Now I don't really care too much what happens with fuzzed files, but the logic in _bfd_dwarf2_find_nearest_line is meant to result in only one read of .debug_info, not multiple reads of the same info when there are errors. This patch fixes that problem. * dwarf2.c (struct adjusted_section): Add orig_vma. (unset_sections): Reset vma to it. (place_sections): Handle non-zero vma too. Save orig_vma. (_bfd_dwarf2_slurp_debug_info): Tidy. Correct outdated comment. On error returns after calling place_sections, call unset_sections. (_bfd_dwarf2_find_nearest_line_with_alt): Simplify call to unset_sections.
2023-02-06[PR 30082] Pass $JANSSON_LIBS and $ZSTD_LIBS to ld-bootstrap/bootrap.expRomain Geissler3-2/+4
2023-02-06Automatic date update in version.inGDB Administrator1-1/+1
2023-02-05Automatic date update in version.inGDB Administrator1-1/+1
2023-02-04gdb/testsuite: don't try to set non-stop mode on a running targetAndrew Burgess1-71/+67
The test gdb.threads/thread-specific-bp.exp tries to set non-stop mode on a running target, something which the manual makes clear is not allowed. This commit restructures the test a little, we now set the non-stop mode as part of the GDBFLAGS, so the mode will be set before GDB connects to the target. As a consequence I'm able to move the with_test_prefix out of the check_thread_specific_breakpoint proc. The check_thread_specific_breakpoint proc is now called within a loop. After this commit the gdb.threads/thread-specific-bp.exp test still has some failures, this is because of an issue GDB currently has printing "Thread ... exited" messages. This problem should be addressed by this patch: https://sourceware.org/pipermail/gdb-patches/2022-December/194694.html when it is merged.
2023-02-04ld: pru: Add optional section alignmentsDimitar Dimitrov1-3/+11
The Texas Instruments SoCs with AARCH64 host processors have stricter alignment requirements than ones with ARM32 host processors. It's not only the requirement for resource_table to be aligned to 8. But also any loadable segment size must be a multiple of 4 [1]. The current PRU default linker script may output a segment size not aligned to 4, which would cause firmware load failure on AARCH64 hosts. Fix this by using COMMONPAGESIZE and MAXPAGESIZE to signify respectively the section memory size requirement and the resource table section's start address alignment. This would avoid penalizing the ARM32 hosts, for which the default values (1 and 1) are sufficient. For AARCH64 hosts, the alignments would be overwritten from GCC spec files using the linker command line, e.g.: -z common-page-size=4 -z max-page-size=8 [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/pru_rproc.c?h=v6.1#n555 ld/ChangeLog: * scripttempl/pru.sc (_data_end): Remove the alignment. (.data): Align output section size to COMMONPAGESIZE. (.resource_table): Ditto. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2023-02-04ld: pru: Merge the bss input sections into dataDimitar Dimitrov2-11/+15
The popular method to load PRU firmware is through the remoteproc Linux kernel driver. In order to save a few bytes from the firmware, the PRU CRT0 is spared from calling memset for the bss segment [1]. Instead the host loader is supposed to zero out the bss segment. This is important for PRU, which typically has only 8KB for instruction memory. The legacy non-mainline PRU host driver relied on the default behaviour of the kernel core remoteproc [2]. That default is to zero out the loadable memory regions not backed by file storage (i.e. the bss sections). This worked for the libgloss' CRT0. But the PRU loader merged in mainline Linux explicitly changes the default behaviour [3]. It no longer is zeroing out memory regions. Hence the bss sections are not initialized - neither by CRT0, nor by the host loader. This patch fixes the issue by aligning the GNU LD default linker script with the mainline Linux kernel expectation. Since the mainline kernel driver is submitted by the PRU manufacturer itself (Text Instruments), we can consider that as defining the ABI. This change has been tested on Beaglebone AI-64 [4]. Static counter variables in the firmware are now always starting from zero, as expected. There was only one new toolchain test failure in orphan3.d, due to reordering of the output sections. I believe this is a harmless issue. I could not rewrite the PASS criteria to ignore the output section ordering, so I have disabled that test case for PRU. [1] https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/pru/crt0.S;h=b3f0d53a93acc372f461007553e7688ca77753c9;hb=HEAD#l40 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/remoteproc_elf_loader.c?h=v6.1#n228 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/pru_rproc.c?h=v6.1#n641 [4] https://beagleboard.org/ai-64 ld/ChangeLog: * scripttempl/pru.sc (.data): Merge .bss input sections into the .data output section. * testsuite/ld-elf/orphan3.d: Disable for PRU. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2023-02-04Automatic date update in version.inGDB Administrator1-1/+1
2023-02-03bpf: fix error conversion from long unsigned int to unsigned int ↵Guillermo E. Martinez4-28/+32
[-Werror=overflow] Regenerating BPF target using the maintainer mode emits: .../opcodes/bpf-opc.c:57:11: error: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709486335’ to ‘4294902015’ [-Werror=overflow] 57 | 64, 64, 0xffffffffffff00ff, { { F (F_IMM32) }, { F (F_OFFSET16) }, { F (F_SRCLE) }, { F (F_OP_CODE) }, { F (F_DSTLE) }, { F (F_OP_SRC) }, { F (F_OP_CLASS) }, { 0 } } The use of a narrow size to handle the mask CGEN in instruction format is causing this error. Additionally eBPF `call' instructions constructed by expressions using symbols (BPF_PSEUDO_CALL) emits annotations in `src' field of the instruction, used to identify BPF target endianness. cpu/ * bpf.cpu (define-call-insn): Remove `src' field from instruction mask. include/ *opcode/cge.h (CGEN_IFMT): Adjust mask bit width. opcodes/ * bpf-opc.c: Regenerate.
2023-02-03gdb: make target_desc_info_from_user_p a method of target_desc_infoSimon Marchi4-17/+6
Move the implementation over to target_desc_info. Remove the target_desc_info forward declaration in target-descriptions.h, it's no longer needed. Change-Id: Ic95060341685afe0b73af591ca6efe32f5e7e892
2023-02-03gdb: remove copy_inferior_target_desc_infoSimon Marchi4-21/+3
This function is now trivial, we can just copy inferior::tdesc_info where needed. Change-Id: I25185e2cd4ba1ef24a822d9e0eebec6e611d54d6
2023-02-03gdb: remove get_tdesc_infoSimon Marchi1-18/+10
Remove this function, since it's now a trivial access to inferior::tdesc_info. Change-Id: I3e88a8214034f1a4163420b434be11f51eef462c
2023-02-03gdb: change inferior::tdesc_info to non-pointerSimon Marchi4-23/+4
I initially made this field a unique pointer, to have automatic memory management. But I then thought that the field didn't really need to be allocated separately from struct inferior. So make it a regular non-pointer field of inferior. Remove target_desc_info_free, as it's no longer needed. Change-Id: Ica2b97071226f31c40e86222a2f6922454df1229
2023-02-03gdb: move target_desc_info to inferior.hSimon Marchi2-26/+23
In preparation for the following patch, where struct inferior needs to "see" struct target_desc_info, move target_desc_info to the header file. I initially moved the structure to target-descriptions.h, and later made inferior.h include target-descriptions.h. This worked, but it then occured to me that target_desc_info is really an inferior property that involves a target description, so I think it makes sense to have it in inferior.h. Change-Id: I3e81d04faafcad431e294357389f3d4c601ee83d
2023-02-03gdb: use assignment to initialize variable in tdesc_parse_xmlSimon Marchi1-1/+1
Since allocate_target_description returns a target_desc_up, use assignment to initialize the description variable. Change-Id: Iab3311642c09b95648984f305936f4a4cde09440
2023-02-03x86: drop LOCK from XCHG when optimizingJan Beulich6-6/+24
Like with segment overrides on LEA, optimize away such a redundant instruction prefix.
2023-02-03x86-64: respect {nooptimize} when building VEX prefixJan Beulich3-1/+7
Swapping operands for commutative insns occurs outside of optimize_encoding() and hence needs explicit checking for a request to avoid any optimizations.
2023-02-03x86: respect {nooptimize} for LEAJan Beulich8-2/+16
Dropping a meaningless segment prefix occurs outside of optimize_encoding() and hence needs explicit checking for a request to avoid any optimizations.
2023-02-03x86-64: respect MOVABS when choosing alternative encodingsJan Beulich1-1/+2
The alternative encoding is valid for MOV, but there's no such thing for MOVABS.
2023-02-03RISC-V: don't disassemble unrecognized insns as .byteJan Beulich4-49/+39
Insn width granularity being 16 bits, producing byte granular output isn't very useful. With there being a way to specific otherwise unknown insns to the assembler, use that same representation (to be precise: its <length>,<encoding> flavor) for disassembly.
2023-02-03Add ECOFF Symbolic Header sanity checksAlan Modra1-4/+17
Anti-fuzzer measures. The checks don't ensure the various elements in the header are distinct, but that isn't important as far as making sure we don't overrun the buffer containing all the elements. Also, we now don't care about offsets where the corresponding count is zero. * ecoff.c (_bfd_ecoff_slurp_symbolic_info): Sanity check offsets in debug->symbolic_header.