From c4188c2a6a7c2a69a2663be3e57973937eb685ba Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Tue, 19 Aug 1997 16:44:00 +0000 Subject: [PATCH] * coff-i960.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1. (GET_SCNHDR_ALIGN, PUT_SCNHDR_ALIGN): Define. * coff-m88k.c (GET_SCNHDR_NRELOC, GET_SCNHDR_NLNNO): Define. * coffcode.h (coff_set_alignment_hook): Conditionally compile in if COFF_ALIGN_IN_SECTION_HEADER is defined. Convert alignment to power of two for I960 only. * coffswap.h (GET_SCNHDR_NRELOC, PUT_SCNHDR_NRELOC, GET_SCNDHR_NLNNO, PUT_SCNHDR_NLNNO, GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Provide default definitions. (coff_swap_scnhdr_in): Use GET_SCNHDR_FLAGS, GET_SCNHDR_NRELOC, GET_SCNHDR_NLNNO, and GET_SCNHDR_ALIGN. (coff_swap_scnhdr_out): Use PUT_SCNHDR_FLAGS, PUT_SCNHDR_ALIGN. start-sanitize-tic80 * Makefile.in (coff-tic80.o): Depends upon coffswap.h. * coff-tic80.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1. (GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Define *coffcode.h (coff_write_object_contents): Set alignment field in section header for TIC80COFF files. end-sanitize-tic80 PR 12215 and PR 13061 --- bfd/ChangeLog | 22 ++++++++++++++++++++ bfd/coff-tic80.c | 8 +++++++- bfd/coffcode.h | 53 ++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 76 insertions(+), 7 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index d59ba5dce32..178715faa05 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,25 @@ +Tue Aug 19 08:47:17 1997 Fred Fish + + * coff-i960.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1. + (GET_SCNHDR_ALIGN, PUT_SCNHDR_ALIGN): Define. + * coff-m88k.c (GET_SCNHDR_NRELOC, GET_SCNHDR_NLNNO): Define. + * coffcode.h (coff_set_alignment_hook): Conditionally compile in if + COFF_ALIGN_IN_SECTION_HEADER is defined. Convert alignment to power + of two for I960 only. + * coffswap.h (GET_SCNHDR_NRELOC, PUT_SCNHDR_NRELOC, GET_SCNDHR_NLNNO, + PUT_SCNHDR_NLNNO, GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Provide + default definitions. + (coff_swap_scnhdr_in): Use GET_SCNHDR_FLAGS, GET_SCNHDR_NRELOC, + GET_SCNHDR_NLNNO, and GET_SCNHDR_ALIGN. + (coff_swap_scnhdr_out): Use PUT_SCNHDR_FLAGS, PUT_SCNHDR_ALIGN. +start-sanitize-tic80 + * Makefile.in (coff-tic80.o): Depends upon coffswap.h. + * coff-tic80.c (COFF_ALIGN_IN_SECTION_HEADER): Define to 1. + (GET_SCNHDR_FLAGS, PUT_SCNHDR_FLAGS): Define + *coffcode.h (coff_write_object_contents): Set alignment field in + section header for TIC80COFF files. +end-sanitize-tic80 + start-sanitize-v850 Mon Aug 18 11:36:19 1997 Nick Clifton diff --git a/bfd/coff-tic80.c b/bfd/coff-tic80.c index 485024c5030..88f5ccbd7ca 100644 --- a/bfd/coff-tic80.c +++ b/bfd/coff-tic80.c @@ -31,6 +31,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "libcoff.h" #define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2) +#define COFF_ALIGN_IN_SECTION_HEADER 1 + +#define GET_SCNHDR_FLAGS bfd_h_get_16 +#define PUT_SCNHDR_FLAGS bfd_h_put_16 static void rtype2howto PARAMS ((arelent *cache_ptr, struct internal_reloc *dst)); @@ -704,7 +708,9 @@ coff_tic80_relocate_section (output_bfd, info, input_bfd, return true; } -#define TIC80 1 /* Customize coffcode.h */ +#define TIC80COFF 1 /* Customize coffcode.h */ +#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */ +#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */ #include "coffcode.h" const bfd_target diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 633d31f959a..be39c22c93f 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1056,7 +1056,7 @@ coff_new_section_hook (abfd, section) return true; } -#ifdef I960 +#ifdef COFF_ALIGN_IN_SECTION_HEADER /* Set the alignment of a BFD section. */ @@ -1071,13 +1071,22 @@ coff_set_alignment_hook (abfd, section, scnhdr) struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; unsigned int i; +#ifdef I960 + /* Extract ALIGN from 2**ALIGN stored in section header */ for (i = 0; i < 32; i++) if ((1 << i) >= hdr->s_align) break; +#endif +/* start-sanitize-tic80 */ +#ifdef TIC80COFF + /* TI tools hijack bits 8-11 for the alignment */ + i = (hdr->s_flags >> 8) & 0xF ; +#endif +/* end-sanitize-tic80 */ section->alignment_power = i; } -#else /* ! I960 */ +#else /* ! COFF_ALIGN_IN_SECTION_HEADER */ #ifdef COFF_WITH_PE /* a couple of macros to help setting the alignment power field */ @@ -1222,7 +1231,7 @@ coff_set_alignment_hook (abfd, section, scnhdr) #endif /* ! RS6000COFF_C */ #endif /* ! COFF_WITH_PE */ -#endif /* ! I960 */ +#endif /* ! COFF_ALIGN_IN_SECTION_HEADER */ #ifndef coff_mkobject @@ -1584,11 +1593,13 @@ coff_set_arch_mach_hook (abfd, filehdr) break; #endif +/* start-sanitize-tic80 */ #ifdef TIC80_ARCH_MAGIC case TIC80_ARCH_MAGIC: arch = bfd_arch_tic80; break; #endif +/* end-sanitize-tic80 */ default: /* Unreadable input file type */ arch = bfd_arch_obscure; @@ -2641,7 +2652,12 @@ coff_write_object_contents (abfd) section.s_align = (current->alignment_power ? 1 << current->alignment_power : 0); - +/* start-sanitize-tic80 */ +#else +#ifdef TIC80COFF + section.s_flags |= (current->alignment_power & 0xF) << 8; +#endif +/* end-sanitize-tic80 */ #endif #ifdef COFF_IMAGE_WITH_PE @@ -2793,6 +2809,12 @@ coff_write_object_contents (abfd) else internal_f.f_flags |= F_AR32W; +/* start-sanitize-tic80 */ +#ifdef TIC80_TARGET_ID + internal_f.f_target_id = TIC80_TARGET_ID; +#endif +/* end-sanitize-tic80 */ + /* FIXME, should do something about the other byte orders and architectures. @@ -2830,10 +2852,12 @@ coff_write_object_contents (abfd) internal_a.magic = NMAGIC; /* Assume separate i/d */ #define __A_MAGIC_SET__ #endif /* A29K */ -#ifdef TIC80 +/* start-sanitize-tic80 */ +#ifdef TIC80COFF internal_a.magic = TIC80_ARCH_MAGIC; #define __A_MAGIC_SET__ #endif /* TIC80 */ +/* end-sanitize-tic80 */ #ifdef I860 /* FIXME: What are the a.out magic numbers for the i860? */ internal_a.magic = 0; @@ -2896,7 +2920,7 @@ coff_write_object_contents (abfd) #endif /* LYNXOS */ #endif /* SPARC */ -#if RS6000COFF_C +#ifdef RS6000COFF_C #define __A_MAGIC_SET__ internal_a.magic = (abfd->flags & D_PAGED) ? RS6K_AOUTHDR_ZMAGIC : (abfd->flags & WP_TEXT) ? RS6K_AOUTHDR_NMAGIC : @@ -3383,6 +3407,9 @@ coff_slurp_symbol_table (abfd) #ifdef RS6000COFF_C case C_HIDEXT: #endif +#ifdef C_SYSTEM + case C_SYSTEM: /* System Wide variable */ +#endif #ifdef COFF_WITH_PE /* PE uses storage class 0x68 to denote a section symbol */ case C_SECTION: @@ -3478,9 +3505,15 @@ coff_slurp_symbol_table (abfd) #endif case C_REGPARM: /* register parameter */ case C_REG: /* register variable */ +/* start-sanitize-tic80 */ +#ifndef TIC80COFF +/* end-sanitize-tic80 */ #ifdef C_AUTOARG case C_AUTOARG: /* 960-specific storage class */ #endif +/* start-sanitize-tic80 */ +#endif +/* end-sanitize-tic80 */ case C_TPDEF: /* type definition */ case C_ARG: case C_AUTO: /* automatic variable */ @@ -3583,6 +3616,14 @@ coff_slurp_symbol_table (abfd) /* NT uses 0x67 for a weak symbol, not C_ALIAS. */ case C_ALIAS: /* duplicate tag */ #endif +/* start-sanitize-tic80 */ + /* New storage classes for TIc80 */ +#ifdef TIC80COFF + case C_UEXT: /* Tentative external definition */ +#endif + case C_STATLAB: /* Static load time label */ + case C_EXTLAB: /* External load time label */ +/* end-sanitize-tic80 */ case C_HIDDEN: /* ext symbol in dmert public lib */ default: (*_bfd_error_handler)