117739 Commits

Author SHA1 Message Date
GDB Administrator
e13d5f0b38 Automatic date update in version.in 2024-02-09 00:00:44 +00:00
Alan Modra
78f9e9faaa PR31208, strip can break ELF alignment requirements
In https://sourceware.org/pipermail/binutils/2007-August/053261.html
(git commit 3dea8fca8b86) I disabled a then new linker feature that
removed empty PT_LOAD headers in cases where a user specified program
headers, and for objcopy.  This can be a problem for objcopy/strip and
since objcopy operates on sections, any part of a PT_LOAD loading file
contents not covered by a section will be omitted anyway.

	PR 31208
	* elf.c (_bfd_elf_map_sections_to_segments): Pass remove_empty_load
	as true to elf_modify_segment_map for objcopy/strip.

(cherry picked from commit 7f26d260ef76a4cb2873a7815bef187005528c19)
2024-02-09 08:05:34 +10:30
Richard W.M. Jones
e19278f72b PR 31283 windmc: Parse input correctly on big endian hosts
On big endian hosts (eg. s390x) the windmc tool fails to parse even
trivial files:

  $ cat test.mc
  ;
  $ ./binutils/windmc ./test.mc
  In test.mc at line 1: parser: syntax error.
  In test.mc at line 1: fatal: syntax error.

The tool starts by reading the input as Windows CP1252 and then
converting it internally into an array of UTF-16LE, which it then
processes as an array of unsigned short (typedef unichar).

There are lots of ways this is wrong, but in the specific case of big
endian machines the little endian pairs of bytes are byte-swapped.

For example, the ';' character in the input above is first converted
to UTF16-LE byte sequence { 0x3b, 0x00 }, which is then cast to
unsigned short.  On a big endian machine the first unichar appears to
be 0x3b00.  The lexer is unable to recognize this as the comment
character ((unichar)';') and so parsing fails.

The simple fix is to convert the input to UTF-16BE on big endian
machines (and do the reverse conversion when writing the output).

Fixes: https://sourceware.org/bugzilla/show_bug.cgi?id=31283
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 3f8f9745c75b333515f399fc2908ede2ed8014e9)
2024-02-08 20:19:50 +10:30
GDB Administrator
55fcaab59c Automatic date update in version.in 2024-02-08 00:02:08 +00:00
GDB Administrator
28ded47e35 Automatic date update in version.in 2024-02-07 00:02:09 +00:00
Alan Modra
b76b898311 Link x86-64 mark-plt-1.so with --no-as-needed
Fixes
FAIL: Build mark-plt-1.so
where gcc is built with default --as-needed.

	* testsuite/ld-x86-64/x86-64.exp (Build mark-plt-1.so): Pass
	--no-as-needed.

(cherry picked from commit 60c95acdaca94eca79b81ec75bfab97826cc0271)
2024-02-06 17:33:58 +10:30
GDB Administrator
001a80d963 Automatic date update in version.in 2024-02-06 00:02:18 +00:00
GDB Administrator
57edd59833 Automatic date update in version.in 2024-02-05 00:01:19 +00:00
Xi Ruoyao
e92e2d654b LoongArch: gas: Fix the types of symbols referred with %le_*_r in the symtab
When a symbol is referred with %le_{hi20,lo12,add}_r, it's definitely a
TLS symbol and we should set its type to TLS in the symtab.  Otherwise
when building Perl with gcc-14 -flto, we get:

/usr/bin/ld: PL_current_context: TLS definition in
./miniperl.ltrans0.ltrans.o section .tbss mismatches non-TLS reference
in ./miniperl.ltrans1.ltrans.o

A minimal reproducer:

    $ cat t1.s
    .section .tbss
    .globl x
    x: .word 0
    $ cat t2.s
    f:
      lu12i.w $a0, %le_hi20_r(x)
      add.d   $a0, $a0, $tp, %le_add_r(x)
      li.w    $a1, 1
      st.w    $a1, $a0, %le_lo12_r(x)
    $ gas/as-new t1.s -o t1.o
    $ gas/as-new t2.s -o t2.o
    $ ld/ld-new t1.o t2.o
    ld/ld-new: x: TLS definition in t1.o section .tbss mismatches
    non-TLS reference in t2.o

Unfortunately this was undetected before Binutils-2.42 release because
GCC < 14 does not use %le_*_r, and without LTO it's very rare to have a
TLS LE definition and its reference in two different translation units.
So this fix should be backported to Binutils-2.42 branch too.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
(cherry picked from commit 029e52bac7f3a6dd8b39f7f3d298b73174da806b)
2024-02-04 14:14:15 +08:00
GDB Administrator
953cc7c776 Automatic date update in version.in 2024-02-04 00:02:12 +00:00
GDB Administrator
598df828ee Automatic date update in version.in 2024-02-03 00:01:07 +00:00
H.J. Lu
42cde23736 x86: Disallow instructions with length > 15 bytes
It is a hard error when an instruction length exceeds the limit of 15
bytes:

[hjl@gnu-cfl-3 tmp]$ cat x.s
	.text
	xacquire lock addq $0x11223344, %fs:(,%eax)
[hjl@gnu-cfl-3 tmp]$ gcc -c x.s
x.s: Assembler messages:
x.s:2: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw x.o

x.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:	64 67 f2 f0 48 81 04 05 00 00 00 00 44 33 22 	xacquire lock (bad)
   f:	11                   	.byte 0x11
[hjl@gnu-cfl-3 tmp]$

and

[hjl@gnu-cfl-3 tmp]$ cat z.s
	addq $0xe0, %fs:0, %rdx
[hjl@gnu-cfl-3 tmp]$ as -o z.o z.s
z.s: Assembler messages:
z.s:1: Warning: instruction length of 16 bytes exceeds the limit of 15
[hjl@gnu-cfl-3 tmp]$ objdump -dw z.o

z.o:     file format elf64-x86-64

Disassembly of section .text:

0000000000000000 <.text>:
   0:	64 62 f4 ec 18 81 04 25 00 00 00 00 e0 00 00 	(bad)
	...
[hjl@gnu-cfl-3 pr31323]$

Instructions with length > 15 bytes are always invalid.  It is quite easy
to generate invalid instructions with APX now.  We should issue an error
when instruction length exceeds the limit of 15 bytes.

	PR gas/31323
	* config/tc-i386.c (output_insn): Issue an error when instruction
	length exceeds the limit of 15 bytes.
	* testsuite/gas/i386/oversized16.l: Updated.
	* testsuite/gas/i386/oversized64.l: Likewise.
	* testsuite/gas/i386/x86-64-apx-inval.l: New file.
	* testsuite/gas/i386/x86-64-apx-inval.s: Likewise.

(cherry picked from commit 46bd909328c3c8f3d6fc7a505b2fad1eea72d872)
2024-02-02 04:40:58 -08:00
GDB Administrator
7e4f6dd4e6 Automatic date update in version.in 2024-02-02 00:01:45 +00:00
GDB Administrator
5f2bbf9137 Automatic date update in version.in 2024-02-01 00:02:02 +00:00
Nick Clifton
ffb78e62bc Mention support for AMD/znver5 in GAS 2024-01-31 15:42:14 +00:00
Georg-Johann Lay
2fad36c3f5 PR31124: Addendum: Remove PROVIDE of __flmap_init_label, __flmap.
Supply these symbols as computed by the linker scripts, even when there are weak definitions.
PR 31124
    * scripttempl/avr.sc (__flmap, __flmap_init_label): Remove PROVIDE.
2024-01-31 11:24:22 +00:00
GDB Administrator
871087ea4a Automatic date update in version.in 2024-01-31 00:02:39 +00:00
Indu Bhagat
48942a586e gas: scfi: add missing ginsn-cofi-1 testcase files
Previous commit a58dc5427f0 intended to bring the following two commits
from master branch:

 91cdbed4d7b gas: scfi: untraceable control flow should be a hard error
 16cbeae1b27 x86: testsuite: scfi: adjust COFI testcase

But missed adding the testcase files. Fix the failure by adding the
missing files.

gas/testsuite/
	* gas/scfi/x86_64/ginsn-cofi-1.l: New test.
	* gas/scfi/x86_64/ginsn-cofi-1.s: Likewise.
2024-01-30 00:41:37 -08:00
GDB Administrator
7586594c48 Automatic date update in version.in 2024-01-30 00:02:25 +00:00
Alan Modra
6d329337f6 PR31314, chew crashing on use of uninitialized value
The "drop" call in wrap_comment already increments pc.  Defining DOCDD
in proto.str is a warning fix.

	PR 31314
	* chew.c (wrap_comment): Don't increment pc.
	* proto.str (DOCDD): Define.

(cherry picked from commit e175a2fc60cb9709c4461cdd8596ae05e529d67b)
2024-01-30 09:48:18 +10:30
Nick Clifton
3f56050d62 Set version number to 2.42.0 and re-enable development 2024-01-29 16:01:42 +00:00
Nick Clifton
c7f28aad0c Update version number to 2.42 binutils-2_42 2024-01-29 14:51:43 +00:00
Indu Bhagat
a58dc5427f x86: testsuite: scfi: adjust COFI testcase and gas: scfi: untraceable control flow should be a hard error 2024-01-29 14:22:06 +00:00
Nick Clifton
e1106084f6 Updated French translations for GOLD and LD 2024-01-29 11:31:52 +00:00
Nick Clifton
e28726c4fd LoongArch: update test cases about TLS 2024-01-29 11:22:39 +00:00
GDB Administrator
70d424aaf8 Automatic date update in version.in 2024-01-29 00:01:47 +00:00
GDB Administrator
317288354a Automatic date update in version.in 2024-01-28 00:01:20 +00:00
GDB Administrator
7d6e8abd80 Automatic date update in version.in 2024-01-27 00:01:30 +00:00
mengqinggang
3988bf614f Backport commits 969f5c0e1 (LoongArch: gas: Add support for s9 register) and a0aa6f4ab (LoongArch: ld: Add support for TLS LE symbol with addend) to 2.42 branch. 2024-01-26 10:50:57 +00:00
GDB Administrator
75558017d5 Automatic date update in version.in 2024-01-26 00:01:13 +00:00
Andrew Carlotti
ab35d4b9c2 gas: Update NEWS
Groups entries by architecture, and update AArch64 content.
2024-01-25 15:32:28 +00:00
Andrew Carlotti
a0440fd9f7 aarch64: Update Architecture Extensions documentation
Restructure the architecture extensions table, add a new table for architecture
version dependencies, add missing architecture extensions, and improve some
extension descriptions.
2024-01-25 14:45:40 +00:00
mengqinggang
7231da9099 LoongArch: gas: Start a new frag after instructions that can be relaxed
For R_LARCH_TLS_{LE_HI20_R,LE_ADD_R,LD_PC_HI20,GD_PC_HI20, DESC_PC_HI20}
relocations, start a new frag to get correct eh_frame Call Frame Information
FDE DW_CFA_advance_loc info.
2024-01-25 09:24:26 +08:00
mengqinggang
a519d29e22 LoongArch: gas: Don't define LoongArch .align
Gcc may generate "\t.align\t%d,54525952,4\n" before commit
b20c7ee066cb7d952fa193972e8bc6362c6e4063. To write 54525952 (NOP) to object
file, we call s_align_ptwo (-4). It result in alignment padding must be a
multiple of 4 if .align has second parameter.

Use default s_align_ptwo for .align.
2024-01-25 09:24:09 +08:00
Xi Ruoyao
54cdc63d58 LoongArch: Fix some test failures about TLS desc and TLS relaxation
There are two issues causing 11 test failures:

1. The TLS desc tests are matching the entire disassemble of a linked
   executable.  But if ld is configured --enable-default-hash-style=gnu
   (note that most modern distros use this option), the layout of the
   linked executables will be different and the immediate operands in
   the linked executables will also be different.  So we add
   "--hash-style=both" for these tests to cancel the effect of
   --enable-default-hash-style=gnu, like [x86_64 mark-plt tests].
2. By default objdump disassemble uses [pseudo-instructions] so "addi.w"
   is outputed as "li.w", causing mismatches in TLS relaxation tests.
   We can turn off the pseudo-instruction usage in objdump using "-M
   no-aliases" to fix them.

[x86_64 mark-plt tests]: 16666ccc91295d1568c5c2cb0e7600694840dfd9
[pseudo-instructions]: 17f9439038257b1de0c130a416a9a7645c653cb0

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-01-25 09:23:49 +08:00
mengqinggang
d895955b8b LoongArch: Do not emit R_LARCH_RELAX for two register macros
For two register macros (e.g. la.local $t0, $t1, symbol) used in extreme code
model, do not emit R_LARCH_RELAX relocations.
2024-01-25 09:22:46 +08:00
GDB Administrator
ef8574fc33 Automatic date update in version.in 2024-01-25 00:03:06 +00:00
Andrew Carlotti
bb1ab9d4ab aarch64: Eliminate unused variable warnings with -DNDEBUG 2024-01-24 12:16:03 +00:00
GDB Administrator
8699aa4f64 Automatic date update in version.in 2024-01-24 00:02:16 +00:00
Andrew Carlotti
9144007382 aarch64: Include +predres2 in -march=armv8.9-a
This matches the dependencies in the architecture, in LLVM, and even in the
original Binutils commit message that mistakenly included it only in armv9.4-a.
2024-01-23 17:36:35 +00:00
Xi Ruoyao
e92613559c [PATCH v2] gas/NEWS, ld/NEWS: Announce LoongArch changes in 2.42 2024-01-23 15:59:12 +00:00
Jan Beulich
c59f83461f x86/APX: also amend the PUSH2/POP2 testcase
Commit f530d5f1bab6 ("Update x86/APX: VROUND{P,S}{S,D} can generally be
encoded") took care of only half of the remaining issue. Add #pass here
as well.
2024-01-23 08:13:55 +01:00
GDB Administrator
b4dc314a61 Automatic date update in version.in 2024-01-23 00:02:50 +00:00
Vladimir Mezentsev
26f557af69 Fix 31252 gprofng causes testsuite parallel jobs fail
Before running our tests, we made a fake installation into ./tmpdir.
This installation changes libopcodes.la in the build area.
Gas testing may fail if gas and gprofng tests are run in parallel.

I create a script to run gprofng. Inside this script, LD_LIBRARY_PATH,
GPROFNG_SYSCONFDIR are set.
putenv_libcollector_ld_misc() first uses $GPROFNG_PRELOAD_LIBDIRS to create
directories for SP_COLLECTOR_LIBRARY_PATH ($SP_COLLECTOR_LIBRARY_PATH is used
to set up LD_PRELOAD).

gprofng/ChangeLog
2024-01-19  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

	PR gprofng/31252
	PR gprofng/30808
	* src/envsets.cc (putenv_libcollector_ld_misc): Use
	$GPROFNG_PRELOAD_LIBDIRS first to build SP_COLLECTOR_LIBRARY_PATH.
	* testsuite/config/default.exp: Create a script to run gprofng.
	* testsuite/lib/display-lib.exp: Fix typo.
2024-01-22 11:02:15 -08:00
Nick Clifton
5266e76caf Updated Serbian translations for th bfd, gold and opcodes directories 2024-01-22 17:26:00 +00:00
GDB Administrator
d411590fef Automatic date update in version.in 2024-01-22 00:01:20 +00:00
GDB Administrator
7859f402ad Automatic date update in version.in 2024-01-21 00:01:19 +00:00
GDB Administrator
bbdf007db7 Automatic date update in version.in 2024-01-20 00:00:41 +00:00
H.J. Lu
075f13476a Update x86/APX: VROUND{P,S}{S,D} can generally be encoded
Append "#pass" to APX tests for targets which pad text sections with NOPs.

	* testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: Append
	"#pass".
	* testsuite/gas/i386/x86-64-apx-evex-promoted.d: Likewise.

(cherry picked from commit f530d5f1bab6eb5adc65f422ef811fb278a21a4b)
2024-01-19 06:45:35 -08:00
Jan Beulich
383775145a x86/APX: VROUND{P,S}{S,D} can generally be encoded
VRNDSCALE{P,S}{S,D} is the AVX512 generalization of these AVX insns. As
long as the immediate has the top 4 bits clear, they are equivalent to
the earlier VEX-encoded insns, and hence can be used to permit use of
eGPR-s in the memory operand. Since this is the normal way of using
these insns, also alter the resulting diagnostic to complain about the
immediate, not the eGPR use.
2024-01-19 13:25:56 +01:00