README for GNU development tools This directory contains various GNU compilers, assemblers, linkers, debuggers, etc., plus their support routines, definitions, and documentation. If you are receiving this as part of a GDB release, see the file gdb/README. If with a binutils release, see binutils/README, and so on. That'll give you info about this package -- supported targets, how to use it, how to report bugs, etc. It is now possible to automatically configure and build a variety of tools with one command. To build all of the tools contained herein, run the ``configure'' script here, e.g.: ./configure make To install them (by default in /usr/local/bin, /usr/local/lib, etc), then do: make install (If the configure script can't determine your type of computer, give it the name as an argument, for instance ``./configure sun4''. You can use the script ``config.sub'' to test whether a name is recognized; if it is, config.sub translates it to a triplet specifying CPU, vendor, and OS.) If you have more than one compiler on your system, it is often best to explicitly set CC in the environment before running configure, and to also set CC when running make. For example (assuming sh/bash/ksh): CC=gcc ./configure make A similar example using csh: setenv CC gcc ./configure make Much of the code and documentation enclosed is copyright by the Free Software Foundation, Inc. See the file COPYING or COPYING.LIB in the various directories, for a description of the GNU General Public License terms under which you can copy the files. REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info on where and how to report problems.
Remove the local symbol ldh definitions with hidden visibility from the
relax-call36-*.s tests. The hidden visibility is meaningless for local
defined symbols and makes the test cases error.
Allow people to build GCC with multilib support even without
--enable-targets=all in binutils configuration.
This fixes a potential problem with merging non-visibility bits in
st_other. Non-visibilty bits in st_other have an architecture
dependent meaning, so they cannot just be copied from a foreign ELF
object file. I think the safest thing to do in this situation is
ignore non-visibility st_other bits. That's what this patch does.
PR 34062
* elflink.c (elf_merge_st_other): Replace abfd param with
obfd and ibfd parameters. Do not call
elf_backend_merge_symbol_attribute when input xvec differs
from output xvec.
(_bfd_elf_merge_symbol, _bfd_elf_add_default_symbol),
(elf_link_add_object_symbols),
(_bfd_elf_copy_link_hash_symbol_type): Pass both output bfd
and input bfd to elf_merge_st_other.
This renames "abfd" function parameters to "obfd" when that parameter
is always the output bfd, and to "dynobj" when it is always the input
object used to attach dynamic sections. "bed" variables which are set
to the output bfd or dynobj backend data are renamed to "obed". (The
dynobj xvec must be the same as the output xvec, or bad things
happen.) The idea is to make the use of bfd* parameter a little more
obvious when reading the source.
This fixes a bug with the .note.spu_name section flags, which were
made SEC_LOAD without SEC_ALLOC. That combination doesn't really make
sense and led to odd layout behaviour. In addition .note.spu_name
now uses the normal note alignment, with some tweaks to keep its file
offset 16 byte aligned. This tends to work better in the testsuite
when the standard scripts are not used and the note is merged with
other notes.
bfd/
* elf32-spu.c (spu_elf_create_sections): Remove SEC_LOAD from
.note.spu_name, and align to 4 bytes.
(spu_elf_fake_sections): Tweak .note.spu_name output section
alignment for layout.
(spu_elf_final_write_processing): New function.
(elf_backend_final_write_processing): Define.
binutils/
* testsuite/binutils-all/objcopy.exp (pr25662): Don't xfail spu.
ld/
* testsuite/ld-elf/orphan-region.d: Don't xfail spu.
* testsuite/ld-elf/pr23658-1e.d: Likewise.
* testsuite/ld-scripts/provide-8.d: Likewise.
* testsuite/ld-spu/ovl.d: Remove commented out old matches.
Adjust expected overlay file offset.
* testsuite/ld-spu/ovl2.d: Likewise.
I noticed that the 'maint test-remote-args' command, implemented by
the test_remote_args_command function in remote.c, contains this code:
static void
test_remote_args_command (const char *args, int from_tty)
{
std::vector<std::string> split_args = gdb::remote_args::split (args);
... etc ...
The problem here is that gdb::remote_args::split expects a std::string,
and so ends up creating a std::string from ARGS. However, ARGS can be
NULL, e.g. if a user does this:
(gdb) maint test-remote-args
This ends up creating a std::string from a NULL pointer, which is
undefined behaviour.
Fix this by adding a check to test_remote_args_command, and throwing
an error if ARGS is NULL. Add a new test to verify this case.
Additionally, fix a typo in the header comment for
test_remote_args_command.
Approved-By: Tom Tromey <tom@tromey.com>
FEAT_LRCPC3 introduces various load/store instructions with release
consistency for cases where ordering is required. This patch teaches GDB
to decode these instructions for recording and reversing.
The gdb.reverse/aarch64-lrcpc3.exp testcase verifies that the
instructions are recorded and correctly reversed. In particular, there
are some interesting cases to note:
* ldapur/stlur are SIMD instructions, but are not decoded in the simd
function.
* There are writeback cases to cover too. These were taken from the
binutils testcases: gas/testsuite/gas/aarch64/rcpc3.s.
The full testsuite was done on aarch64-none-linux-gnu without LRCPC3.
The gdb.arch and gdb.reverse tests were run on Shrinkwrap with LRCPC3
support.
Please note:
1) There is no support for LRCPC and LRCPC2 instructions
2) LRCPC3 is gated with +rcpc3 in GCC/binutils and LLVM.
Approved-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Another comment marker doxygen supports is "/**<". Replace it with "/*".
Suggested-By: Kevin Buettner <kevinb@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34186
Remove doxygen \page marker in gdb/gdbtypes.h.
Approved-By: Kevin Buettner <kevinb@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34186
Doxygen supports a multi-line comment marker '/**'. In GDB we're using
something slightly similar: '/* *' [1].
Drop this and just use '/*'.
Result of:
...
$ find gdb* -type f -name "*.[ch]" -o -name "*.def" \
| egrep -v /testsuite/ \
| xargs sed -i 's%/\* \* %/* %'
...
and manually reverting the change in the comment for BINOP_MUL in
gdb/std-operator.def.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34186
Approved-By: Kevin Buettner <kevinb@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
[1] https://sourceware.org/gdb/wiki/DoxygenForGDB
We have some form of doxygen support, allowing to run "make doxy" in
build/gdb/doc, but in the result I didn't find any references to gdbsupport
(moved to top-level in 2019), so I'm assuming this is unmaintained for a long
time now.
Remove it.
Reviewed-by: Kevin Buettner <kevinb@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34186
This patch converts dw2-const.exp to use the DWARF assembler rather
than a .S file. The conversion was largely done using the script from
contrib.
Following a suggestion from Tom de Vries, this version sets addr_size
to 8. This makes the test pass with -m32 as well.
Approved-By: Tom de Vries <tdevries@suse.de>
I found a few files in gdb/contrib that were missing a copyright notice.
In codespell-ignore-words.txt, it was trivial to add, but I found a
codespell issue stating that it's not explicitly support, so I added a note
about that.
In codespell-dictionary.txt, I had to resort to a hack, using an "empty word"
rewrite rule:
...
-># Comment here.
...
Also, I found that empty lines are not allowed in codespell-dictionary.txt. I
filed an issue about these two problems [1].
Since these two files were added in 2025, I've used 2025-2026 as copyright
years.
Tested by running "pre-commit run --all-files".
[1] https://github.com/codespell-project/codespell/issues/3901
Fix typos in gdb/doc and replace "SME" with "sme" in
gdb/contrib/codespell-ignore-words.txt, and add "wither" and "stap".
Fix typos in gdb/stubs, and add "parm" to
gdb/contrib/codespell-ignore-words.txt.
Fix typos in gdb/features.
Fix typos in gdb/nat, and add "fpr" to gdb/contrib/codespell-ignore-words.txt.
Fix typos in gdb/contrib.
The codespell settings are currently in gdb/contrib/setup.cfg.
There's a goal to move settings of Python tools used for gdb to
gdb/pyproject.toml.
Do so, and update the args entries in .pre-commit-config.yaml:
...
- args: [--config, gdb/contrib/setup.cfg]
+ args: [--toml, gdb/pyproject.toml]
...
It's necessary to point codespell as used in pre-commit to the pyproject.toml
file, because:
- pre-commit uses codespell with the repository root as working directory
- codespell currently only supports discovery of configuration files in the
working directory. There's an issue open to support hierarchical
pyproject.toml files [1].
Likewise, it's necessary to point codespell on the CLI to the pyproject.toml
file:
...
$ codespell --toml gdb/pyproject.toml
...
Now that the codespell settings are in gdb/pyproject.toml, codespell will
automatically discover it when running codespell in the gdb directory.
However, that's not useful, because the paths in gdb/pyproject.toml are
relative to the repository root. Hopefully, that will be fixed once codespell
supports hierarchical toml files.
In the mean time, we could fix this by moving the settings to a pyproject.toml
file in the repository root. But we have been avoiding this sofar (to keep
project-related things out of the repository root as much as possible), so we
continue having this pre-existing issue.
[1] https://github.com/codespell-project/codespell/issues/3737
The current definition of codespell:ignore-begin/end is greedy and
consequently in this example:
...
/* codespell:ignore-begin */
/* Ignore this: usuable. */
/* codespell:ignore-end */
/* Don't ignore this: usuable. */
/* codespell:ignore-begin */
/* Ignore that: usuable. */
/* codespell:ignore-end */
...
the "Don't ignore this" line will be ignored.
Fix this by making the definition non-greedy.
This patch is aimed at fixing "FAIL: eqv involving dot" and any
similar problems in real code when generating DWARF.
* config/obj-macho.c (obj_mach_o_frob_label),
(obj_mach_o_frob_symbol): Ignore more debug symbols.
(obj_mach_o_set_subsections): Ignore SEC_DEBUGGING sections.
(obj_mach_o_force_reloc_sub_same),
(obj_mach_o_force_reloc_sub_local),
(obj_mach_o_force_reloc): Add seg param. Return false when
processing debug sections.
* config/obj-macho.h: Update prototypes.
* config/tc-i386.h <OBJ_MACHO>: Smuggle section being
processed by TC_FORCE_RELOCATION* to obj_macho_o functions.
The macho gas support starts a new frag at non-local labels,
identifying the frag with the label symbol as a "subsection". Relocs
are needed when referencing labels in a different subsection, to
support relaxation. There is a problem when reloc symbols are reduced
to a section symbol plus offset (see write.c:adjust_reloc_syms), as
this loses the subsection. Not reducing symbols like this is not a
good option as it results in a large number of symbols, some with
weird internal gas names. So instead this patch finds the original
frag for any fx_addsy reduced to a section symbol.
Test results are:
+FAIL: .org test 1
-FAIL: i386 opcodes
-FAIL: i386 opcodes (Intel disassembly)
-FAIL: i386 opcodes (w/ suffix)
-FAIL: i386 intel (AT&T disassembly)
-FAIL: i386 intel
-FAIL: Check -madd-bnd-prefix
-FAIL: x86-64 RTM insns
-FAIL: x86-64 RTM insns (Intel disassembly)
-FAIL: Check -madd-bnd-prefix (x86-64)
The reason ".org test 1" fails is the -gdwarf2 .debug_aranges
generates two temp symbols and uses them for the start and size of
each range, the size being calculated by "end" - "beg" (see
out_debug_aranges). For the test, "beg" is before any source symbol
is emitted so has subsection NULL. "end" has a subsection but lost
that when the fixup was converted to a section symbol plus offset.
So prior to this change obj_mach_o_in_different_subsection returned
false. Now that the lost subsection is recovered for "end" it returns
true, and results in "Error: can't resolve .text - L0^A$".
* config/obj-macho.c (obj_mach_o_in_different_subsection):
Add parameters. Get frag containing section sym plus offset.
(obj_mach_o_force_reloc_sub_same): Adjust to suit
obj_mach_o_in_different_subsection change.
(obj_mach_o_force_reloc_sub_local): Likewise.
(obj_mach_o_force_reloc): Likewise.
* testsuite/gas/i386/insn-32.d: Don't xfail darwin.
* write.c (get_frag_for_address): New function, extracted from..
(get_frag_for_reloc): ..here.
* write.h (get_frag_for_address): Declare.
Commit cc28c46227cd caused testsuite regressions on i386-darwin:
i386-darwin +FAIL: i386 intel-ok (directive)
i386-darwin +FAIL: i386 intel-ok (cmdline option)
Reduced testcase:
.intel_syntax noprefix
mov eax, [offset x] - [1]
This triggers an obj_mach_o_check_before_writing error, because x
is indeed undefined. However, the error is nonsense because fx_subsy
is the absolute value 1, and that should just result in a relocation
against x with an addend of -1.
What's more, obj_mach_o_check_before_writing runs before symbols
are resolved. At that point undefined symbols may be wrapped in an
expression symbol. Expression symbols are S_IS_DEFINED, which is
why the error did not trigger until commit cc28c46227cd simplified
away the expression symbol wrapper. So obj_mach_o_check_before_writing
is ineffective in some cases and overly restrictive in others. If
something like it is necessary the correct place to do so is after
fixups have been simplified. In fact there is a sufficient check in
write.c:fixup_segment but the macho support disables it by defining
TC_VALIDATE_FIX_SUB to 1.
This patch reverts commit 16a87420985f (see
https://sourceware.org/pipermail/binutils/2012-February/075591.html),
and removes the define of TC_VALIDATE_FIX_SUB for macho. I'm sure it
is wrong to whitewash fixups by using TC_VALIDATE_FIX_SUB in this way.
Any fx_subsy that is left at that point will be ignored by the x86
md_apply_fix and tc_gen_reloc functions, except for a few special
cases. That will result in incorrect relocations.
The patch also corrects obj_mach_o_force_reloc_sub_local. Since this
is a predicate testing whether fx_subsy can be eliminated (and the
fixup made pc-relative) it ought to be testing for fx_subsy in the
same subsection as the fixup frag. This cures "FAIL: i386 sub".
* config/obj-macho.c (obj_mach_o_check_before_writing): Delete.
(obj_mach_o_pre_output_hook): Delete.
(obj_mach_o_in_different_subsection): Make static. Return bool.
(obj_mach_o_force_reloc_sub_same): Return bool.
(obj_mach_o_force_reloc_sub_local): Rewrite to check fx_subsy.
(obj_mach_o_force_reloc): Return bool.
* config/obj-macho.h (md_pre_output_hook): Don't define.
(obj_mach_o_in_different_subsection): Delete.
(obj_mach_o_force_reloc, obj_mach_o_force_reloc_sub_same),
(obj_mach_o_force_reloc_sub_local): Update.
* config/tc-i386.h (TC_VALIDATE_FIX_SUB <OBJ_MACH_O>): Likewise.