This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: Should AArch64 *_NC relocs complain on overflow ?


Hi Richard, Hi Marcus,

  Should AArch64 *_NC relocs complain if they encounter an overflow ?  I
  thought that the _NC suffix meant "no complain", but when I tested a
  local patch[1] to address a problem related to these relocs, I found a
  new failure in the linker testsuite:

    FAIL: ld-aarch64/emit-relocs-286-bad

  This test appears to expect some "relocation truncated to fit" warning
  messages from the R_AARCH64_LDST64_ABS_LO12_NC reloc.  Is the test
  wrong, or am I misunderstanding about when *_NC should generate
  overflow warnings ?

Cheers
  Nick

[1] This is the patch that I am testing:

diff --git a/bfd/elfxx-aarch64.c b/bfd/elfxx-aarch64.c
index 498171c..7d8fa3b 100644
--- a/bfd/elfxx-aarch64.c
+++ b/bfd/elfxx-aarch64.c
@@ -224,7 +224,8 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
     case BFD_RELOC_AARCH64_LD_LO19_PCREL:
     case BFD_RELOC_AARCH64_TLSDESC_LD_PREL19:
     case BFD_RELOC_AARCH64_TLSIE_LD_GOTTPREL_PREL19:
-      if (old_addend & ((1 << howto->rightshift) - 1))
+      if (howto->complain_on_overflow != complain_overflow_dont
+	  && (old_addend & ((1 << howto->rightshift) - 1)))
 	return bfd_reloc_overflow;
       contents = reencode_ld_lit_ofs_19 (contents, addend);
       break;
@@ -285,7 +286,8 @@ _bfd_aarch64_elf_put_addend (bfd *abfd,
     case BFD_RELOC_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC:
     case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12:
     case BFD_RELOC_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC:
-      if (old_addend & ((1 << howto->rightshift) - 1))
+      if (howto->complain_on_overflow != complain_overflow_dont
+	  && (old_addend & ((1 << howto->rightshift) - 1)))
 	return bfd_reloc_overflow;
       /* Used for ldr*|str* rt, [rn, #uimm12] to provide the low order
          12 bits of the page offset following BFD_RELOC_AARCH64_ADR_HI21_PCREL

This is to address a problem building the sipp package on AArch64
Fedora:

  https://bugzilla.redhat.com/show_bug.cgi?id=1300543

Part of the problem appears to be related to the fact that a global
variable is declared with different types in different source files, but
the same code compliles without problems on other architectures, and I
was intrigued as to why the AArch64 was generating warnings for "no
complain" relocs...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]