Commit Graph

117556 Commits

Author SHA1 Message Date
GDB Administrator
4ce6d9f327 Automatic date update in version.in 2024-02-22 00:01:53 +00:00
GDB Administrator
303aeec545 Automatic date update in version.in 2024-02-21 00:01:41 +00:00
GDB Administrator
3907b93e92 Automatic date update in version.in 2024-02-20 00:01:09 +00:00
GDB Administrator
b12e61f981 Automatic date update in version.in 2024-02-19 00:01:30 +00:00
GDB Administrator
0f0fc784d7 Automatic date update in version.in 2024-02-18 00:00:45 +00:00
GDB Administrator
909abfc52e Automatic date update in version.in 2024-02-17 00:01:08 +00:00
H.J. Lu
553c7f61b7 x86: Display -msse-check= default as none
Display -msse-check= default as none for "as --help" since its default
is none, not warning.

	PR gas/31389
	* config/tc-i386.c (md_show_usage): Change -msse-check= default
	to none.

(cherry picked from commit 7a6a03c499)
2024-02-15 16:16:07 -08:00
GDB Administrator
79dae30d25 Automatic date update in version.in 2024-02-16 00:00:49 +00:00
GDB Administrator
7151e88a59 Automatic date update in version.in 2024-02-15 00:01:40 +00:00
GDB Administrator
518453a7fc Automatic date update in version.in 2024-02-14 00:01:19 +00:00
Peter Bergner
4f7d1d2d5e PowerPC: Add support for Power11 options
binutils/
	* doc/binutils.texi (PowerPC -M option): Mention power11 and pwr11.

gas/
	* config/tc-ppc.c: (md_show_usage): Mention -mpower11 and -mpwr11.
	* doc/c-ppc.texi: Likewise.

opcodes/
	* ppc-dis.c (ppc_opts): Add "power11" and "pwr11" entries.
	(powerpc_init_dialect): Default to "power11".

(cherry picked from commit 4199cf1e15)
2024-02-13 17:02:36 -06:00
GDB Administrator
7ce9bdab58 Automatic date update in version.in 2024-02-13 00:01:27 +00:00
GDB Administrator
a47235bd94 Automatic date update in version.in 2024-02-12 00:01:04 +00:00
GDB Administrator
79b6fe3b31 Automatic date update in version.in 2024-02-11 00:00:47 +00:00
H.J. Lu
3c1f1c3578 x86-64: Add R_X86_64_CODE_6_GOTTPOFF
For

	add	%reg1, name@gottpoff(%rip), %reg2

and

	add	name@gottpoff(%rip), %reg1, %reg2

add

 #define R_X86_64_CODE_6_GOTTPOFF		50

if the instruction starts at 6 bytes before the relocation offset.
They are similar to R_X86_64_GOTTPOFF.  Linker can covert GOTTPOFF to

	add	$name@tpoff, %reg1, %reg2

Rewrite fx_tcbit, fx_tcbit2 and fx_tcbit3 usage to generate
R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX, R_X86_64_CODE_4_GOTPCRELX,
R_X86_64_CODE_4_GOTTPOFF, R_X86_64_CODE_4_GOTPC32_TLSDESC and
R_X86_64_CODE_6_GOTTPOFF.

NB: There is no need to check BFD_RELOC_X86_64_CODE_4_GOTTPOFF in
md_assemble since there is only BFD_RELOC_X86_64_GOTTPOFF at this
stage, which will be converted to BFD_RELOC_X86_64_CODE_4_GOTTPOFF
or BFD_RELOC_X86_64_CODE_6_GOTTPOFF in i386_validate_fix.

5 relocations:

 #define R_X86_64_CODE_5_GOTPCRELX		46
 #define R_X86_64_CODE_5_GOTTPOFF		47
 #define R_X86_64_CODE_5_GOTPC32_TLSDESC	48
 #define R_X86_64_CODE_6_GOTPCRELX		49
 #define R_X86_64_CODE_6_GOTPC32_TLSDESC	51

are added for completeness and they are unused.

bfd/

	* elf64-x86-64.c (x86_64_elf_howto_table): Add
	R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF,
	R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX,
	R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC.
	(R_X86_64_standard): Updated.
	(x86_64_reloc_map): Add R_X86_64_CODE_5_GOTPCRELX,
	R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC,
	R_X86_64_CODE_6_GOTPCRELX, R_X86_64_CODE_6_GOTTPOFF and
	R_X86_64_CODE_6_GOTPC32_TLSDESC.
	(elf_x86_64_check_tls_transition): Handle
	R_X86_64_CODE_6_GOTTPOFF.
	(elf_x86_64_tls_transition): Likewise.
	(elf_x86_64_scan_relocs): Handle R_X86_64_CODE_6_GOTTPOFF.
	Issue an error for R_X86_64_CODE_5_GOTPCRELX,
	R_X86_64_CODE_5_GOTTPOFF, R_X86_64_CODE_5_GOTPC32_TLSDESC,
	R_X86_64_CODE_6_GOTPCRELX and R_X86_64_CODE_6_GOTPC32_TLSDESC.
	(elf_x86_64_relocate_section): Handle R_X86_64_CODE_6_GOTTPOFF.
	* reloc.c (bfd_reloc_code_real): Add
	BFD_RELOC_X86_64_CODE_5_GOTPCRELX,
	BFD_RELOC_X86_64_CODE_5_GOTTPOFF,
	BFD_RELOC_X86_64_CODE_5_GOTPC32_TLSDESC,
	BFD_RELOC_X86_64_CODE_6_GOTPCRELX,
	BFD_RELOC_X86_64_CODE_6_GOTTPOFF and
	BFD_RELOC_X86_64_CODE_6_GOTPC32_TLSDESC.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

elfcpp/

	* x86_64.h (R_X86_64_CODE_5_GOTPCRELX): New.
	(R_X86_64_CODE_5_GOTTPOFF): Likewise.
	(R_X86_64_CODE_5_GOTPC32_TLSDESC): Likewise.
	(R_X86_64_CODE_6_GOTPCRELX): Likewise.
	(R_X86_64_CODE_6_GOTTPOFF): Likewise.
	(R_X86_64_CODE_6_GOTPC32_TLSDESC): Likewise.

gas/

	* config/tc-i386.c (tc_i386_fix_adjustable): Handle
	BFD_RELOC_X86_64_CODE_6_GOTTPOFF.
	(md_assemble): Don't check BFD_RELOC_X86_64_CODE_4_GOTTPOFF.
	Allow "add %reg1, foo@gottpoff(%rip), %reg2".
	(output_disp): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF.  Rewrite
	setting fx_tcbitX bits for BFD_RELOC_X86_64_GOTTPOFF,
	BFD_RELOC_X86_64_GOTPC32_TLSDESC and BFD_RELOC_32_PCREL.
	(md_apply_fix): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF.
	(i386_validate_fix): Rewrite fx_tcbitX bit checking for
	BFD_RELOC_X86_64_GOTTPOFF, BFD_RELOC_X86_64_GOTPC32_TLSDESC and
	BFD_RELOC_32_PCREL.
	(tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_6_GOTTPOFF.
	* testsuite/gas/i386/x86-64-gottpoff.d: Updated.
	* testsuite/gas/i386/x86-64-gottpoff.s: Add tests for
	"add %reg1, foo@gottpoff(%rip), %reg2" and
	"add foo@gottpoff(%rip), %reg, %reg2".

gold/

	* x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle
	R_X86_64_CODE_6_GOTTPOFF.
	(Target_x86_64::Scan::get_reference_flags): Likewise.
	(Target_x86_64::Scan::local): Likewise.
	(Target_x86_64::Scan::global): Likewise.
	(Target_x86_64::Relocate::relocate): Likewise.
	(Target_x86_64::Relocate::relocate_tls): Likewise.
	(Target_x86_64::Relocate::tls_ie_to_le): Handle.
	R_X86_64_CODE_6_GOTTPOFF.
	* testsuite/x86_64_ie_to_le.s: Add tests for
	"add %reg1, foo@gottpoff(%rip), %reg2" and
	"add foo@gottpoff(%rip), %reg, %reg2".
	* testsuite/x86_64_ie_to_le.sh: Updated.

include/

	* elf/x86-64.h (elf_x86_64_reloc_type): Add
	R_X86_64_CODE_5_GOTPCRELX, R_X86_64_CODE_5_GOTTPOFF,
	R_X86_64_CODE_5_GOTPC32_TLSDESC, R_X86_64_CODE_6_GOTPCRELX,
	R_X86_64_CODE_6_GOTTPOFF and R_X86_64_CODE_6_GOTPC32_TLSDESC.

ld/

	* testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_6_GOTTPOFF
	tests.
	* testsuite/ld-x86-64/tlsbindesc.d: Updated.
	* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.

(cherry picked from commit 5bc71c2a6b)
2024-02-10 08:23:26 -08:00
GDB Administrator
ba864c35f5 Automatic date update in version.in 2024-02-10 00:01:13 +00:00
Jan Beulich
c426c8e307 x86/APX: VROUND{P,S}{S,D} encodings require AVX512{F,VL}
In eea4357967 ("x86/APX: VROUND{P,S}{S,D} can generally be encoded") I
failed to add the AVX512* ISA dependency of the two new entries.
2024-02-09 08:42:22 +01:00
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 3dea8fca8b) 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 7f26d260ef)
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 3f8f9745c7)
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 60c95acdac)
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 029e52bac7)
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 46bd909328)
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 a58dc5427f intended to bring the following two commits
from master branch:

 91cdbed4d7 gas: scfi: untraceable control flow should be a hard error
 16cbeae1b2 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 e175a2fc60)
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 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