108896 Commits

Author SHA1 Message Date
c804c6f98d ld: Rewrite lang_size_relro_segment_1
1. Compute the desired PT_GNU_RELRO segment base and find the maximum
section alignment of sections starting from the PT_GNU_RELRO segment.
2. Find the first preceding load section.
3. Don't add the 1-page gap between the first preceding load section and
the relro segment if the maximum page size >= the maximum section
alignment.  Align the PT_GNU_RELRO segment first.  Subtract the maximum
page size if therer is still a 1-page gap.

	PR ld/28743
	PR ld/28819
	* ldlang.c (lang_size_relro_segment_1): Rewrite.
	* testsuite/ld-x86-64/pr28743-1.d: New file.
	* testsuite/ld-x86-64/pr28743-1.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr28743-1.
2022-01-26 05:27:56 -08:00
8357282156 gdb/testsuite: Ensure constant test name in gdb.base/break-interp.exp
When running the testsuite, I have lines similar to the following in the
gdb.sum file:

~~~
PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: first backtrace: p /x 0x7f283d2f0fd1
...
PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=NO: binpie=NO: INNER: first backtrace: p /x 0x7f00de0317a5
...
~~~

The address part of the command might change between execution of the
test, which adds noise to a diff between two .sum files.

This patch changes to test name to "p /x $pc" in order to have constant
test name.

Tested on x86_64-Linux.

Change-Id: I973c1237a084dd6d424276443cbf0920533c9a21
2022-01-26 04:38:33 -05:00
a80032197f Automatic date update in version.in 2022-01-26 00:00:19 +00:00
a8e9f25759 Always print the "host libthread-db" message to stdout
linux-thread-db.c has a bit of unusual code that unconditionally
prints a message, but decides whether to print to gdb_stdout or
gdb_stdlog based on a debug flag.  It seems better to me to simply
always print this; and this is the only spot in gdb where we
conditionally pass gdb_stdout to one of the f*_unfiltered functions.
2022-01-25 15:22:49 -07:00
d4396e0e97 Reduce explicit use of gdb_stdout
In an earlier version of the pager rewrite series, it was important to
audit unfiltered output calls to see which were truly necessary.

This is no longer necessary, but it still seems like a decent cleanup
to change calls to avoid explicitly passing gdb_stdout.  That is,
rather than using something like fprintf_unfiltered with gdb_stdout,
the code ought to use plain printf_unfiltered instead.

This patch makes this change.  I went ahead and converted all the
_filtered calls I could find, as well, for the same clarity.
2022-01-25 15:22:49 -07:00
244ac24b51 Sent timing stats to gdb_stdlog
This changes the time / space / symtab per-command statistics code to
send its output to gdb_stdlog rather than gdb_stdout.  This seems
slightly more correct to me.
2022-01-25 15:22:49 -07:00
1475b18b77 Send some error output to gdb_stderr
This changes some code to send some error messages to gdb_stderr
rather than gdb_stdout.
2022-01-25 15:22:49 -07:00
b6437be687 Fix a probem building the binutils on SPARC/amd64
PR 28816
	* elf/common.h (AT_SUN_HWCAP): Make definition conditional.
2022-01-25 17:33:03 +00:00
042a82e5ee bfd: Regenerate Makefile.in
* Makefile.in: Regenerate.
2022-01-25 08:54:36 -08:00
7d9d9c1078 gold: drop old cygnus install hack
The gold subdir doesn't actually have a manual, so this hack doesn't
do anything.  Plus the automake cygnus option was removed years ago
by Simon in d0ac1c44885daf68f631befa37e ("Bump to autoconf 2.69 and
automake 1.15.1").  So delete it here.
2022-01-24 19:58:33 -05:00
9a84a44d5d gas: drop old cygnus install hack
This was needed when gas was using the automake cygnus option, but
this was removed years ago by Simon in d0ac1c44885daf68f631befa37e
("Bump to autoconf 2.69 and automake 1.15.1").  So delete it here.
The info pages are already & still installed by default w/out it.
2022-01-24 19:58:33 -05:00
823f6c5f05 Automatic date update in version.in 2022-01-25 00:00:17 +00:00
94fd627d46 bfd: Update doc/local.mk
PR binutils/28807
	* Makefile.in: Regenerate.
	* doc/local.mk (AM_MAKEINFOFLAGS): Add -I "$(srcdir)/%D%" -I %D%.
	(TEXI2DVI): New.
	(%D%/bfd.texi): Removed.
	(doc/bfd/index.html): Remove -I$(srcdir).  Replace bfd.texi with
	%D%/bfd.texi.
2022-01-24 12:56:48 -08:00
fdf55097a3 bfd/doc: Fix racy build failure from missing mkdir
bfd/
	* doc/local.mk (%D%/bfdver.texi): Add mkdir command.
2022-01-24 12:38:50 -08:00
2f279a64a2 Fix a proble building the libiberty library with gcc-12.
PR 28779
	* regex.c: Suppress -Wuse-after-free.
2022-01-24 17:56:23 +00:00
965c919f98 gdb/doc: improve description for Window.click on Python TUI windows
The description of the Window.click method doesn't mention where the
coordinates are anchored (it's the top left corner).

This minor tweak just mentions this point.
2022-01-24 15:33:55 +00:00
5fe73d4624 Update Bulgarian, French, Romaniam and Ukranian translation for some of the sub-directories 2022-01-24 14:22:49 +00:00
2b1ca85cf8 Automatic date update in version.in 2022-01-24 00:00:15 +00:00
f10522c0e7 Simplify some Rust expression-evaluation code
A few Rust operations do a bit of work in their 'evaluate' functions
and then call another function -- but are also the only caller.  This
patch simplifies this code by removing the extra layer.

Tested on x86-64 Fedora 34.  I'm checking this in.
2022-01-23 12:52:44 -07:00
451c003d5f bfd: Partially revert commit 0e3839bde6f
Partially revert

commit 0e3839bde6f93e1e3eefce815be3636e3d81054d
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Jan 23 07:29:27 2022 -0800

    bfd: Properly install library and header files

	PR binutils/28807
	* Makefile.am: Revert bfdlib_LTLIBRARIES and bfdinclude_HEADERS
	changes.
	* Makefile.in: Regenerate.
2022-01-23 10:40:46 -08:00
0e3839bde6 bfd: Properly install library and header files
Rename bfdlib_LTLIBRARIES and bfdinclude_HEADERS to lib_LTLIBRARIES and
include_HEADERS to fix the missing installed library and header files in
bfd caused by

commit bd32be01c997f686ab0b53f0640eaa0aeb61fbd3
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Fri Dec 3 00:23:20 2021 -0500

    bfd: merge doc subdir up a level

	PR binutils/28807
	* Makefile.am (bfdlib_LTLIBRARIES): Renamed to ...
	(lib_LTLIBRARIES): This.
	(bfdinclude_HEADERS): Renamed to ...
	(include_HEADERS): This.
	* Makefile.in: Regenerate.
	* doc/local.mk (install): Removed.
2022-01-23 07:29:27 -08:00
ad69b6b861 Regenerate Makefile.in files with automake 1.15.1
Regenerate Makefile.in files with the unmodified automake 1.15.1 to
remove

runstatedir = @runstatedir@

bfd/

	* Makefile.in: Regenerate.

binutils/

	* Makefile.in: Regenerate.

gas/

	* Makefile.in: Regenerate.

gold/

	* Makefile.in: Regenerate.
	* testsuite/Makefile.in: Likewise.

gprof/

	* Makefile.in: Regenerate.

ld/

	* Makefile.in: Regenerate.

opcodes/

	* Makefile.in: Regenerate.
2022-01-23 06:59:20 -08:00
31b0378d53 Regenerate configure files with autoconf 2.69
Regenerate configure files with the unmodified autoconf 2.69 to remove

  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]

bfd/

	* configure: Regenerate.

binutils/

	* configure: Regenerate.

gas/

	* configure: Regenerate.

gold/

	* configure: Regenerate.

gprof/

	* configure: Regenerate.

ld/

	* configure: Regenerate.

opcodes/

	* configure: Regenerate.
2022-01-23 05:27:01 -08:00
35638469cb Automatic date update in version.in 2022-01-23 00:00:12 +00:00
bd32be01c9 bfd: merge doc subdir up a level
This avoids a recursive make into the doc subdir and speeds up the
build slightly.  It also allows for more parallelism.
2022-01-22 16:47:35 -05:00
cb803d3749 bfd: rename core.texi to corefile.texi
This is a generated file name from a correspondingly named C file.
Rename it to avoid unique build rules since there's no difference
to the generated manual.
2022-01-22 16:07:16 -05:00
3dd8e5b615 bfd: replace doc header generation with pattern rules
This unifies boilerplate rules for most files with pattern rules.
2022-01-22 16:06:53 -05:00
58de646be2 Allow inferring tmp_prefix from the dll name from a def file. 2022-01-22 14:31:22 +00:00
cc5e40736d Adjust default page sizes for haiku arm.
* configure.tgt (arm-haiku): Fix typo.
	* emulparams/armelf_haiku.su (MAXPAGESIZE): Use the default value.
	(COMMONPAGESIZE): Likewise.
2022-01-22 14:18:34 +00:00
5f7a57f131 Update release makeing script with new release numbers 2022-01-22 13:26:54 +00:00
f908e960c5 Change version number to 2.38.50 and regenerate files 2022-01-22 12:39:28 +00:00
a74e1cb344 Add markers for 2.38 branch 2022-01-22 12:08:55 +00:00
cb2562f553 RISC-V: create new frag after alignment.
PR 28793:

The alignment may be removed in linker. We need to create new frag after
alignment to prevent the assembler from computing static offsets.

gas/
	* config/tc-riscv.c (riscv_frag_align_code): Create new frag.
2022-01-22 17:20:18 +08:00
5b4ea8a740 Automatic date update in version.in 2022-01-22 00:00:12 +00:00
ed09c325ec gdb: include gdbsupport/buildargv.h in ser-mingw.c
Fixes:

      CXX    ser-mingw.o
    /home/simark/src/binutils-gdb/gdb/ser-mingw.c: In function ‘int pipe_windows_open(serial*, const char*)’:
    /home/simark/src/binutils-gdb/gdb/ser-mingw.c:870:3: error: ‘gdb_argv’ was not declared in this scope
      870 |   gdb_argv argv (name);
          |   ^~~~~~~~

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28802
Change-Id: I7f3e8ec5f9ca8582d587545fdf6b69901259f199
2022-01-21 11:34:30 -05:00
e901223d53 Updated Serbian translation for the ld sub-directory 2022-01-21 15:42:18 +00:00
b13d7831eb gdb/doc: fill in two missing @r
I noticed two places in the docs where we appear to be missing @r.
makeinfo seems to do the correct things despite these being
missing (at least, I couldn't see any difference in the pdf or info
output), but it doesn't hurt to have the @r in place.
2022-01-21 12:49:48 +00:00
ec7194506d drop old unused stamp-h.in file
This was needed by ancient versions of automake, but that hasn't been
the case since at least automake-1.5, so punt this from the tree.
2022-01-21 03:11:47 -05:00
7bf5587873 gdbsupport/gdb_regex.cc: replace defs.h include with common-defs.h
This was forgotten when gdb_regex was moved from gdb to gdbsupport.

Change-Id: I73b446f71861cabbf7afdb7408ef9d59fa64b804
2022-01-20 22:58:21 -05:00
df9d50bb22 Automatic date update in version.in 2022-01-21 00:00:15 +00:00
6d263fe46e Avoid bad breakpoints with --gc-sections
We found a case where --gc-sections can cause gdb to set an invalid
breakpoint.  In the included test case, gdb will set a breakpoint with
two locations, one of which is 0x0.

The code in lnp_state_machine::check_line_address is intended to
filter out this sort of problem, but in this case, the entire CU is
empty, causing unrelocated_lowpc==0x0 -- which circumvents the check.

It seems to me that if a CU is empty like this, then it is ok to
simply ignore the line table, as there won't be any locations anyway.
2022-01-20 07:22:23 -07:00
dd8a5a84a7 Automatic date update in version.in 2022-01-20 00:00:18 +00:00
101d68a9fa Add `set print array-indexes' tests for C/C++ arrays
Add `set print array-indexes' tests for C/C++ arrays, complementing one
for Fortran arrays.
2022-01-19 21:55:10 +00:00
5d4c63a635 Respect `set print array-indexes' with Fortran arrays
Add `set print array-indexes' handling for Fortran arrays.  Currently
the setting is ignored and indices are never shown.

Keep track of the most recent index handled so that any outstanding
repeated elements printed when the limit set by `set print elements' is
hit have the correct index shown.

Output now looks like:

(gdb) set print array-indexes on
(gdb) print array_1d
$1 = ((-2) = 1, (-1) = 1, (0) = 1, (1) = 1, (2) = 1)
(gdb) set print repeats 4
(gdb) set print elements 12
(gdb) print array_2d
$2 = ((-2) = ((-2) = 2, <repeats 5 times>) (-1) = ((-2) = 2, <repeats 5 times>) (0) = ((-2) = 2, (-1) = 2, ...) ...)
(gdb)

for a 5-element vector and a 5 by 5 array filled with the value of 2.
2022-01-19 21:55:10 +00:00
6b4338c868 Add `set print repeats' tests for C/C++ arrays
Add `set print repeats' tests for C/C++ arrays, complementing one for
Fortran arrays and covering the different interpretation of the `set
print elements' setting in particular where the per-dimension count of
the elements handled is matched against the trigger rather than the
total element count as with Fortran arrays.
2022-01-19 21:55:10 +00:00
476f77a94c Respect `set print repeats' with Fortran arrays
Implement `set print repeats' handling for Fortran arrays.  Currently
the setting is ignored and always treated as if no limit was set.

Unlike the generic array walker implemented decades ago the Fortran one
is a proper C++ class.  Rather than trying to mimic the old walker then,
which turned out a bit of a challenge where interacting with the `set
print elements' setting, write it entirely from scratch, by adding an
extra specialization handler method for processing dimensions other than
the innermost one and letting the specialization class call the `walk_1'
method from the handler as it sees fit.  This way repeats can be tracked
and the next inner dimension recursed into as a need arises only, or
unconditionally in the base class.

Keep track of the dimension number being handled in the class rather as
a parameter to the walker so that it does not have to be passed across
by the specialization class.

Use per-dimension element count tracking, needed to terminate processing
early when the limit set by `set print elements' is hit.  This requires
extra care too where the limit triggers exactly where another element
that is a subarray begins.  In that case rather than recursing we need
to terminate processing or lone `(...)' would be printed.  Additionally
if the skipped element is the last one in the current dimension we need
to print `...' by hand, because `continue_walking' won't print it at the
upper level, because it can see the last element has already been taken
care of.

Preserve the existing semantics of `set print elements' where the total
count of the elements handled is matched against the trigger level which
is unlike with the C/C++ array printer where the per-dimension element
count is used instead.

Output now looks like:

(gdb) set print repeats 4
(gdb) print array_2d
$1 = ((2, <repeats 5 times>) <repeats 5 times>)
(gdb) set print elements 12
(gdb) print array_2d
$2 = ((2, <repeats 5 times>) (2, <repeats 5 times>) (2, 2, ...) ...)
(gdb)

for a 5 by 5 array filled with the value of 2.

Amend existing test cases accordingly that rely on the current incorrect
behavior and explicitly request that there be no limit for printing
repeated elements there.

Add suitable test cases as well covering sliced arrays in particular.

Co-Authored-By: Andrew Burgess <andrew.burgess@embecosm.com>
2022-01-19 21:55:10 +00:00
2ddd4c6082 fbsd-nat: Add include for gdb_argv. 2022-01-19 08:30:38 -08:00
8ffb6df2aa PowerPC64 DT_RELR ELFv1
More fun with R_PPC64_NONE found in .opd.  Fixed by the
allocate_dynrelocs and ppc64_elf_size_dynamic_sections changes, and
since we are doing ifunc, opd and SYMBOL_REFERENCES_LOCAL tests later,
don't duplicate that work in check_relocs.

	* elf64-ppc.c (ppc64_elf_check_relocs): Remove opd and ifunc
	conditions for rel_count.
	(dec_dynrel_count): Likewise.
	(allocate_dynrelocs): Test for opd and ifunc when allocating
	relative relocs.
	(ppc64_elf_size_dynamic_sections): Likewise.
2022-01-19 16:45:45 +10:30
edca615ac1 PowerPC64 DT_RELR local PLT
Similarly to the local GOT case.

	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
	space for PLT relocs against local syms when enable_dt_relr.
2022-01-19 16:45:45 +10:30
8f22c9532b PowerPC64 DT_RELR local GOT
Fixes another case where we end up with superfluous R_PPC64_NONE.

	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Don't allocate
	space for GOT relocs against non-TLS local syms when enable_dt_relr.
	(ppc64_elf_layout_multitoc): Likewise.
2022-01-19 16:45:45 +10:30