2020-08-26 Nick Clifton <nickc@redhat.com>
+ PR 26433
+ * elf32-avr.c (avr_final_link_relocate): Fix undefined shift
+ behaviour.
+ (avr_elf32_load_records_from_section): Use bfd_get_16 and
+ bfd_get_32 to load values from potentially unaligned pointers.
+
PR 26416
* elf64-alpha.c (elf64_alpha_relax_tls_get_addr): Test for and
ignore local symbols.
if (srel > ((1 << 7) - 1) || (srel < - (1 << 7)))
return bfd_reloc_overflow;
x = bfd_get_16 (input_bfd, contents);
- x = (x & 0xfc07) | (((srel >> 1) << 3) & 0x3f8);
+ x = (x & 0xfc07) | (((srel >> 1) * 8) & 0x3f8);
bfd_put_16 (input_bfd, x, contents);
break;
ptr++;
flags = *((bfd_byte *) ptr);
ptr++;
- record_count = *((uint16_t *) ptr);
+ record_count = bfd_get_16 (abfd, ptr);
ptr+=2;
BFD_ASSERT (ptr - contents == AVR_PROPERTY_SECTION_HEADER_SIZE);
}
}
- address = *((uint32_t *) ptr);
+ address = bfd_get_32 (abfd, ptr);
ptr += 4;
size -= 4;
/* Just a 4-byte fill to load. */
if (size < 4)
goto load_failed;
- r_list->records [i].data.org.fill = *((uint32_t *) ptr);
+ r_list->records [i].data.org.fill = bfd_get_32 (abfd, ptr);
ptr += 4;
size -= 4;
break;
/* Just a 4-byte alignment to load. */
if (size < 4)
goto load_failed;
- r_list->records [i].data.align.bytes = *((uint32_t *) ptr);
+ r_list->records [i].data.align.bytes = bfd_get_32 (abfd, ptr);
ptr += 4;
size -= 4;
/* Just initialise PRECEDING_DELETED field, this field is
/* A 4-byte alignment, and a 4-byte fill to load. */
if (size < 8)
goto load_failed;
- r_list->records [i].data.align.bytes = *((uint32_t *) ptr);
+ r_list->records [i].data.align.bytes = bfd_get_32 (abfd, ptr);
ptr += 4;
- r_list->records [i].data.align.fill = *((uint32_t *) ptr);
+ r_list->records [i].data.align.fill = bfd_get_32 (abfd, ptr);
ptr += 4;
size -= 8;
/* Just initialise PRECEDING_DELETED field, this field is