bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/28410] New: Prevent region check failures when relaxation is not


From: nelsonc1225 at sourceware dot org
Subject: [Bug ld/28410] New: Prevent region check failures when relaxation is not final
Date: Sat, 02 Oct 2021 02:10:55 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=28410

            Bug ID: 28410
           Summary: Prevent region check failures when relaxation is not
                    final
           Product: binutils
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: nelsonc1225 at sourceware dot org
  Target Milestone: ---

Created attachment 13695
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13695&action=edit
proposed solution from Lewis Revill

(Copy from the proposed patch description)

In some circumstances for RISC-V, such as using a .align directive in a section
with a very small output memory region, we currently fail to link. The
following is an analysis of the problem:

Since the restart_relax flag was implemented (commit
ebdcad3fddf6ec21f6d4dcc702379a12718cf0c4), we have the capability to take
another complete round trip through the lang_relax_sections process rather than
simply using the `again` flag. Doing this, we delay the relaxation of alignment
directives until no more round trips are required.

However, the final part of the lang_relax_sections process also involves a
sanity check that addresses fit within regions (os_region_check). In the case
where alignment directives - implemented as nop sleds which can be reduced as
needed - are not yet relaxed, these checks may fail prematurely.

To fix this, this patch adds the delay_region_check flag to bfd_link_info,
which allows lang_relax_sections to prevent the sanity check from occurring if
set to true. Then, in _bfd_riscv_relax_section, instead of simply skipping the
final phase of relaxation when we are restarting relaxation, we also set this
flag to true, preventing premature errors.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]