diff options
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/coff-tic80.c | 2 | ||||
-rw-r--r-- | bfd/coffcode.h | 25 |
3 files changed, 27 insertions, 8 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d1b995a..70d4e56 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index 253ea94..d23a6f4 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -42,6 +42,8 @@ #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 diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 6da0afa..604ba6d 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1855,10 +1855,6 @@ coff_set_alignment_hook (bfd * abfd ATTRIBUTE_UNUSED, 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 @@ -3865,12 +3861,25 @@ coff_write_object_contents (bfd * abfd) ? 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 |