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

--- Comment #9 from Rainer Orth <ro at CeBiTec dot Uni-Bielefeld.DE> ---
"ro at gcc dot gnu.org" <[email protected]> writes:
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 URL|                            |https://sourceware.org/pipe
>                    |                            |rmail/binutils/2025-Septemb
>                    |                            |er/144549.html
>
> --- Comment #8 from Rainer Orth <ro at gcc dot gnu.org> ---
> Patch posted.

Scratch that.  I've think I've finally found what's going on:

While the SPARC psABI and SCD list

        R_SPARC_UA32                23  V-word32        S + A

i.e. overflow checks on the calculated value, the corresponding entry in
the OpenSolaris/Illumos sources ($SRC/uts/sparc/krtld/doreloc.c) has

https://github.com/illumos/illumos-gate/blob/master/usr/src/uts/sparc/krtld/doreloc.c#L109

/* R_SPARC_UA32 */      {0x0, FLG_RE_UNALIGN, 4, 0, 0},

So unlike other similar case like R_SPARC_32 it lacks the FLG_RE_VERIFY
flag, so no overflow checks are performed despite the ABIs.  This dates
back to at least Solaris 2.5.1 back in 1996, maybe earlier.

I'll check with Ali about the history.

This may or may not be related to this snippet in elfxx-sparc.c:

                /* The Solaris native linker silently disregards overflows.
                   We don't, but this breaks stabs debugging info, whose
                   relocations are only 32-bits wide.  Ignore overflows in
                   this case and also for discarded entries.  */
                if ((r_type == R_SPARC_32
                     || r_type == R_SPARC_UA32
                     || r_type == R_SPARC_DISP32)
                    && (((input_section->flags & SEC_DEBUGGING) != 0
                         && strcmp (bfd_section_name (input_section),
                                    ".stab") == 0)
                        || _bfd_elf_section_offset (output_bfd, info,
                                                    input_section,
                                                    rel->r_offset)
                             == (bfd_vma)-1))

and should be achievable with a check for r_type == R_SPARC_UA32 &&
...target_os == is_solaris.

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

Reply via email to