No description
Find a file
Tsukasa OI 27f754ee50 RISC-V: check offsets when linker relaxation is disabled
The assembler partially relied on the linker to check whether the
offset is valid.  However, some optimization logic (added later)
removes relocations relative to local symbols without checking offsets.

For instance, it caused following code to silently emit wrong jumps
(to the jump instruction "." itself) without relocations:

> .option norelax
> j .+0x200000   # J (or JAL) instruction cannot encode this offset.
> j .+1          # Jump to odd address is not valid.

This commit adds offset checks where necessary.

gas/ChangeLog:

	* config/tc-riscv.c (md_apply_fix): Check offsets when the
	relocation relative to a local symbol is being optimized out.
	* testsuite/gas/riscv/no-relax-branch-offset-fail.s: Failure
	case where the branch offset is invalid.
	* testsuite/gas/riscv/no-relax-branch-offset-fail.d: Ditto.
	* testsuite/gas/riscv/no-relax-branch-offset-fail.l: Ditto.
	* testsuite/gas/riscv/no-relax-branch-offset-ok.s: Border case.
	* testsuite/gas/riscv/no-relax-branch-offset-ok.d: Ditto.
	* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.s: Failure
	case only on RV64 where the PC-relative offset exceed limits.
	* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.d: Ditto.
	* testsuite/gas/riscv/no-relax-pcrel-offset-fail-64.l: Ditto.
	* testsuite/gas/riscv/no-relax-pcrel-offset-fail-not-32.d: Test
	case for RV32 so that no errors occur.
	* testsuite/gas/riscv/no-relax-pcrel-offset-ok.s: Border case.
	* testsuite/gas/riscv/no-relax-pcrel-offset-ok.d: Ditto.
2025-05-16 09:47:27 +08:00
bfd RISC-V: Add zilsd & zclsd support 2025-05-16 08:57:48 +08:00
binutils binutils: Don't complain plugin with all LTO sections removed 2025-05-15 08:43:58 +08:00
config Fix 64-bit BFD detection causing build failures 2025-04-28 18:53:30 +01:00
contrib Revert "contrib: Add autoregen.py" 2024-09-04 13:38:57 +00:00
cpu Add markers for bihnutils 2.44 branch 2025-01-19 12:09:01 +00:00
elfcpp Add markers for bihnutils 2.44 branch 2025-01-19 12:09:01 +00:00
etc Update year range in copyright notice of binutils files 2025-01-01 18:29:57 +10:30
gas RISC-V: check offsets when linker relaxation is disabled 2025-05-16 09:47:27 +08:00
gdb Fix regression with dynamic array bounds 2025-05-15 06:51:19 -06:00
gdbserver [gdbsupport] Reimplement phex and phex_nz as templates 2025-05-02 22:10:53 +02:00
gdbsupport gdbsupport/event-loop: do not truncate poll timeouts to lower second 2025-05-12 17:47:35 +02:00
gnulib gnulib: revert copyright date changes in imported files 2025-04-09 10:03:27 -04:00
gold Updated translations for bfd and gold 2025-02-27 12:16:26 +00:00
gprof asan: null pointer as arg 2 of memcpy 2025-05-01 22:50:35 +09:30
gprofng gprofng: remove unused functions, duplicate macros 2025-05-05 00:07:07 -07:00
include RISC-V: Add zilsd & zclsd support 2025-05-16 08:57:48 +08:00
ld ld: rename ldirname to stat_ldirname 2025-05-15 10:20:53 +02:00
libbacktrace autoupdate: regen after replacing obsolete macros 2024-06-10 08:25:56 +09:30
libctf libctf: fix cv-qualified unnamed struct/union field lookup 2025-02-28 14:16:42 +00:00
libdecnumber regen config 2023-08-12 10:27:57 +09:30
libiberty Revert past commits 2025-03-10 16:15:42 -04:00
libsframe doc: sframe: Clarify FDE/FRE function/range start address fields 2025-02-04 15:13:24 +01:00
opcodes RISC-V: Add zilsd & zclsd support 2025-05-16 08:57:48 +08:00
readline readline/tcap.h: Update definitions for C23 2025-05-02 12:00:05 -06:00
sim Fix d10v sim build with GCC 15 2025-04-25 14:38:11 -06:00
texinfo
zlib autoupdate: regen after replacing obsolete macros 2024-06-10 08:25:56 +09:30
.cvsignore
.editorconfig
.gitattributes binutils-gdb/git: highlight whitespace errors in source files 2022-07-25 14:35:41 +01:00
.gitignore Add Vim swap files to .gitignore 2025-02-28 16:06:25 +00:00
.pre-commit-config.yaml [pre-commit] Add codespell-log commit-msg hook 2025-04-25 19:22:36 +02:00
ar-lib
ChangeLog Add markers for bihnutils 2.44 branch 2025-01-19 12:09:01 +00:00
compile
config-ml.in MSP430: Add -fno-exceptions multilib 2023-08-12 10:24:26 +09:30
config.guess Sync config.guess and config.sub with latest versions from the config project. 2025-01-17 10:18:30 +00:00
config.rpath
config.sub Sync config.guess and config.sub with latest versions from the config project. 2025-01-17 10:18:30 +00:00
configure nios2: Remove binutils support for Nios II target. 2024-11-26 19:13:07 +00:00
configure.ac nios2: Remove binutils support for Nios II target. 2024-11-26 19:13:07 +00:00
COPYING
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
COPYING3
COPYING3.LIB
depcomp
djunpack.bat
install-sh
libtool.m4 FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure scripts 2023-08-12 10:25:06 +09:30
ltgcc.m4
ltmain.sh ltmain.sh: allow more flags at link-time 2024-09-25 19:06:10 +01:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
MAINTAINERS Fix compiling bfd/vms-lib.c for a 32-bit host. 2024-03-18 10:26:16 +00:00
Makefile.def Fix 64-bit BFD detection causing build failures 2025-04-28 18:53:30 +01:00
Makefile.in Fix 64-bit BFD detection causing build failures 2025-04-28 18:53:30 +01:00
Makefile.tpl Revert "Pass GUILE down to subdirectories" 2024-03-22 11:07:28 -06:00
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode Note that at least dejagnu version 1.5.3 is required in order to be ale to run the testsuites. 2022-10-04 10:54:19 +01:00
SECURITY.txt Add a SECURITY.txt file describing the GNU Binutils' project's stance on security related bugs. 2023-04-20 16:52:11 +01:00
setup.com
src-release.sh Rename 'binutils' to 'binutils_with_gold'. Rename 'bin_no_gold' to 'binutils'. Add 'gold' 2025-02-04 11:50:02 +00:00
symlink-tree
test-driver
ylwrap

		   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;  if with a libg++ release,
see libg++/README, etc.  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.