+2017-11-13 Jan Beulich <jbeulich@suse.com>
+
+ * coff-tic80.c (COFF_ENCODE_ALIGNMENT, COFF_DECODE_ALIGNMENT):
+ Define.
+ * coffcode.h (coff_set_alignment_hook): Drop tic80 special case.
+ (coff_write_object_contents): Likewise. Issue diagnostic for too
+ large alignment.
+
2017-11-12 H.J. Lu <hongjiu.lu@intel.com>
PR ld/22423
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
#define COFF_ALIGN_IN_SECTION_HEADER 1
#define COFF_ALIGN_IN_SFLAGS 1
+#define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X) & 0xf) << 8))
+#define COFF_DECODE_ALIGNMENT(X) (((X) >> 8) & 0xf)
#define GET_SCNHDR_FLAGS H_GET_16
#define PUT_SCNHDR_FLAGS H_PUT_16
if ((1 << i) >= hdr->s_align)
break;
#endif
-#ifdef TIC80COFF
- /* TI tools puts the alignment power in bits 8-11. */
- i = (hdr->s_flags >> 8) & 0xF ;
-#endif
#ifdef COFF_DECODE_ALIGNMENT
i = COFF_DECODE_ALIGNMENT(hdr->s_flags);
#endif
? 1 << current->alignment_power
: 0);
#endif
-#ifdef TIC80COFF
- /* TI COFF puts the alignment power in bits 8-11 of the flags. */
- section.s_flags |= (current->alignment_power & 0xF) << 8;
-#endif
#ifdef COFF_ENCODE_ALIGNMENT
COFF_ENCODE_ALIGNMENT(section, current->alignment_power);
+ if ((unsigned int)COFF_DECODE_ALIGNMENT(section.s_flags)
+ != current->alignment_power)
+ {
+ bfd_boolean warn = coff_data (abfd)->link_info
+ && !bfd_link_relocatable (coff_data (abfd)->link_info);
+
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B:%s section %s: alignment 2**%u not representable"),
+ abfd, warn ? " warning:" : "", current->name,
+ current->alignment_power);
+ if (!warn)
+ {
+ bfd_set_error (bfd_error_nonrepresentable_section);
+ return FALSE;
+ }
+ }
#endif
#ifdef COFF_IMAGE_WITH_PE
+2017-11-13 Jan Beulich <jbeulich@suse.com>
+
+ * coff/pe.h (COFF_ENCODE_ALIGNMENT): Cap value to maximum one
+ representable.
+ (COFF_DECODE_ALIGNMENT): Define.
+
2017-11-09 Tamar Christina <tamar.christina@arm.com>
* opcode/aarch64.h (AARCH64_ARCH_V8_4): Enable DOTPROD.
/* Encode alignment power into IMAGE_SCN_ALIGN bits of s_flags. */
#define COFF_ENCODE_ALIGNMENT(SECTION, ALIGNMENT_POWER) \
- ((SECTION).s_flags |= IMAGE_SCN_ALIGN_POWER_CONST ((ALIGNMENT_POWER)))
+ ((SECTION).s_flags |= IMAGE_SCN_ALIGN_POWER_CONST ((ALIGNMENT_POWER) <= 13 \
+ ? (ALIGNMENT_POWER) : 13))
+#define COFF_DECODE_ALIGNMENT(X) \
+ IMAGE_SCN_ALIGN_POWER_NUM ((X) & IMAGE_SCN_ALIGN_POWER_BIT_MASK)
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* Section contains extended relocations. */
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 /* Section is not cachable. */