[PR22764][LD][AARCH64]Allow R_AARCH64_ABS16 and R_AARCH64_ABS32 against absolution...
[deliverable/binutils-gdb.git] / bfd / elfnn-aarch64.c
index af448f98aef6fb39081d932a22951b58d8fc6515..2737773d1ccfa33c661f10b99a4937e43b46dfda 100644 (file)
@@ -7189,10 +7189,19 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
 #if ARCH_SIZE == 64
        case BFD_RELOC_AARCH64_32:
 #endif
-         if (bfd_link_pic (info)
-             && (sec->flags & SEC_ALLOC) != 0
-             && (sec->flags & SEC_READONLY) != 0)
+         if (bfd_link_pic (info) && (sec->flags & SEC_ALLOC) != 0)
            {
+             if (h != NULL
+                 /* This is an absolute symbol.  It represents a value instead
+                    of an address.  */
+                 && ((h->root.type == bfd_link_hash_defined
+                      && bfd_is_abs_section (h->root.u.def.section))
+                     /* This is an undefined symbol.  */
+                     || h->root.type == bfd_link_hash_undefined))
+               break;
+
+             /* For local symbols, defined global symbols in a non-ABS section,
+                it is assumed that the value is an address.  */
              int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
              _bfd_error_handler
                /* xgettext:c-format */
This page took 0.023845 seconds and 4 git commands to generate.