From 8612a388f71b8a34a4f118a1f9e5ca660342d7cf Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 8 Aug 1996 16:27:21 +0000 Subject: [PATCH] Thu Aug 8 12:21:56 1996 Klaus Kaempf * evax-alpha.c (evax_alpha_vec): Corrected flags, cleanup. (evax_initialize): Remove evax_reloc_table. (evax_close_and_cleanup): Ditto. (reloc_nil): Ditto. (alpha_howto_table): Remove ALPHA_R_SWREL32 and ALPHA_R_SWREL64 entries. (evax_bfd_reloc_type_lookup): Ditto. * evax-egsd.c (_bfd_evax_slurp_egsd): Add a few casts; set cooked_size == raw_size. * evax-emh.c (_bfd_evax_register_filename): Remove. * evax-etir.c (etir_stc): Allow ETIR_S_C_STC_xx commands. * evax-misc.c (add_new_contents): Malloc section at full size. (_bfd_save_evax_section): Memcpy section contents directly. * evax.h (ALPHA_R_SWREL32, ALPHA_R_SWREL64): Remove. (evax_reloc_table): Remove. * hosts/alphavms.h (O_ACCMODE): Define if needed. * makefile.vms: Add better support for DEC C compilation Add evax.h dependencies * reloc.c (bfd_get_reloc_size): Add case for 16 byte reloc. (BFD_RELOC_SWREL32,BFD_RELOC_SWREL64): Remove. (BFD_RELOC_ALPHA_BASEREG): Remove. * bfd-in2.h, libbfd.h: Rebuild. --- bfd/ChangeLog | 28 +++++++++++++ bfd/bfd-in2.h | 12 +----- bfd/evax-alpha.c | 102 +++++++---------------------------------------- bfd/evax-egsd.c | 15 ++++--- bfd/evax-emh.c | 22 ---------- bfd/evax-etir.c | 2 +- bfd/evax-misc.c | 44 +++++++------------- bfd/evax.h | 5 +-- bfd/libbfd.h | 3 -- bfd/reloc.c | 19 ++------- 10 files changed, 70 insertions(+), 182 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e1e49abdc1..0fd25dd91c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,31 @@ +Thu Aug 8 12:21:56 1996 Klaus Kaempf + + * evax-alpha.c (evax_alpha_vec): Corrected flags, cleanup. + (evax_initialize): Remove evax_reloc_table. + (evax_close_and_cleanup): Ditto. + (reloc_nil): Ditto. + (alpha_howto_table): Remove ALPHA_R_SWREL32 and ALPHA_R_SWREL64 + entries. + (evax_bfd_reloc_type_lookup): Ditto. + * evax-egsd.c (_bfd_evax_slurp_egsd): Add a few casts; set + cooked_size == raw_size. + * evax-emh.c (_bfd_evax_register_filename): Remove. + * evax-etir.c (etir_stc): Allow ETIR_S_C_STC_xx commands. + * evax-misc.c (add_new_contents): Malloc section at full size. + (_bfd_save_evax_section): Memcpy section contents directly. + * evax.h (ALPHA_R_SWREL32, ALPHA_R_SWREL64): Remove. + (evax_reloc_table): Remove. + + * hosts/alphavms.h (O_ACCMODE): Define if needed. + + * makefile.vms: Add better support for DEC C compilation + Add evax.h dependencies + + * reloc.c (bfd_get_reloc_size): Add case for 16 byte reloc. + (BFD_RELOC_SWREL32,BFD_RELOC_SWREL64): Remove. + (BFD_RELOC_ALPHA_BASEREG): Remove. + * bfd-in2.h, libbfd.h: Rebuild. + Thu Aug 8 08:17:32 1996 Stu Grossman (grossman@critters.cygnus.com) * archive.c (bsd_write_armap): Ifdef around calls to getuid and diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index bdf3d75397..f4c273f02e 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1556,11 +1556,6 @@ decided relatively late. */ BFD_RELOC_GPREL16, BFD_RELOC_GPREL32, -/* For openVMS/Alpha systems, these are displacements for switch -tables. */ - BFD_RELOC_SWREL32, - BFD_RELOC_SWREL64, - /* Reloc types used for i960/b.out. */ BFD_RELOC_I960_CALLJ, @@ -1650,13 +1645,10 @@ The GNU linker currently doesn't do any of this optimizing. */ prediction logic which may be provided on some processors. */ BFD_RELOC_ALPHA_HINT, -/* The LINKAGE relocation outputs a special code in the object file, -the rest is handled by the linker. */ +/* The LINKAGE relocation outputs a linkage pair in the object file, +which is filled by the linker. */ BFD_RELOC_ALPHA_LINKAGE, -/* The BASEREG relocation calculates differences to basereg. */ - BFD_RELOC_ALPHA_BASEREG, - /* Bits 27..2 of the relocation address shifted right 2 bits; simple reloc otherwise. */ BFD_RELOC_MIPS_JMP, diff --git a/bfd/evax-alpha.c b/bfd/evax-alpha.c index 2f43039998..20a5a979fd 100644 --- a/bfd/evax-alpha.c +++ b/bfd/evax-alpha.c @@ -137,32 +137,20 @@ const bfd_target evax_alpha_vec = false, /* data byte order is little */ false, /* header byte order is little */ - (HAS_RELOC | /* object flags */ - HAS_LINENO | HAS_DEBUG | - HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), - - (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* sect flags */ + (HAS_RELOC | HAS_SYMS + | WP_TEXT | D_PAGED), /* object flags */ + (SEC_ALLOC | SEC_LOAD | SEC_RELOC + | SEC_READONLY | SEC_CODE | SEC_DATA + | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ 0, /* symbol_leading_char */ ' ', /* ar_pad_char */ 15, /* ar_max_namelen */ - bfd_getl64, /* bfd_getx64 */ - bfd_getl_signed_64, /* bfd_getx_signed_64 */ - bfd_putl64, /* bfd_putx64 */ - bfd_getl32, /* bfd_getx32 */ - bfd_getl_signed_32, /* bfd_getx_signed_32 */ - bfd_putl32, /* bfd_putx32 */ - bfd_getl16, /* bfd_getx16 */ - bfd_getl_signed_16, /* bfd_getx_signed_16 */ - bfd_putl16, /* bfd_putx16 */ - bfd_getl64, /* bfd_h_getx64 */ - bfd_getl_signed_64, /* bfd_h_getx_signed_64 */ - bfd_putl64, /* bfd_h_putx64 */ - bfd_getl32, /* bfd_h_getx32 */ - bfd_getl_signed_32, /* bfd_h_getx_signed_32 */ - bfd_putl32, /* bfd_h_putx32 */ - bfd_getl16, /* bfd_h_getx16 */ - bfd_getl_signed_16, /* bfd_h_getx_signed_16 */ - bfd_putl16, /* bfd_h_putx16 */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, {_bfd_dummy_target, evax_object_p, /* bfd_check_format */ evax_archive_p, _bfd_dummy_target}, @@ -247,11 +235,8 @@ evax_initialize (abfd) goto evax_init_no_mem2; } - for (i=0; inext; - free (er); - er = er1; - } - PRIV(evax_reloc_table)[i] = NULL; } free (abfd->tdata.any); @@ -1317,8 +1293,6 @@ reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) bfd *output_bfd; char **error_message; { - evax_reloc *er; - #if EVAX_DEBUG evax_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); evax_debug (2, "In section %s, symbol %s\n", @@ -1331,23 +1305,6 @@ reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) /* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ #endif - er = (evax_reloc *)malloc (sizeof(evax_reloc)); - if (er == NULL) - { - bfd_set_error (bfd_error_no_memory); - return bfd_reloc_notsupported; /* FIXME */ - } - er->section = sec; - er->reloc = reloc; - er->next = NULL; - if (PRIV(evax_reloc_table)[sec->index] == NULL) - { - PRIV(evax_reloc_table)[sec->index] = er; - } - else - { - er->next = PRIV(evax_reloc_table)[sec->index]; - } return bfd_reloc_ok; } @@ -1541,36 +1498,6 @@ static reloc_howto_type alpha_howto_table[] = 0, /* dst_mask */ false), /* pcrel_offset */ - /* Switch table, 32bit relocation. */ - HOWTO (ALPHA_R_SWREL32, /* type */ - 0, /* rightshift */ - 2, /* size (0 = byte, 1 = short, 2 = long) */ - 32, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - reloc_nil, /* special_function */ - "SWREL32", /* name */ - false, /* partial_inplace */ - 0xffffffff, /* src_mask */ - 0xffffffff, /* dst_mask */ - false), /* pcrel_offset */ - - /* Switch table, 64bit relocation. */ - HOWTO (ALPHA_R_SWREL64, /* type */ - 0, /* rightshift */ - 4, /* size (0 = byte, 1 = short, 2 = long) */ - 64, /* bitsize */ - false, /* pc_relative */ - 0, /* bitpos */ - complain_overflow_dont, /* complain_on_overflow */ - reloc_nil, /* special_function */ - "SWREL64", /* name */ - false, /* partial_inplace */ - MINUS_ONE, /* src_mask */ - MINUS_ONE, /* dst_mask */ - false), /* pcrel_offset */ - /* A 32 bit reference to a symbol. */ HOWTO (ALPHA_R_REFLONG, /* type */ 0, /* rightshift */ @@ -1614,8 +1541,6 @@ evax_bfd_reloc_type_lookup (abfd, code) case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; - case BFD_RELOC_SWREL32: alpha_type = ALPHA_R_SWREL32; break; - case BFD_RELOC_SWREL64: alpha_type = ALPHA_R_SWREL64; break; #if 0 case ???: alpha_type = ALPHA_R_OP_PUSH; break; case ???: alpha_type = ALPHA_R_OP_STORE; break; @@ -1675,6 +1600,7 @@ evax_set_section_contents (abfd, section, location, offset, count) #if EVAX_DEBUG evax_debug (1, "evax_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", abfd, section->name, location, (long int)offset, (int)count); + evax_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); #endif return _bfd_save_evax_section(abfd, section, location, offset, count); } diff --git a/bfd/evax-egsd.c b/bfd/evax-egsd.c index b1394f1753..f5275a9856 100644 --- a/bfd/evax-egsd.c +++ b/bfd/evax-egsd.c @@ -261,7 +261,7 @@ _bfd_evax_slurp_egsd (abfd) return -1; old_flags = bfd_getl16 (evax_rec + 6); section->_raw_size = bfd_getl32 (evax_rec + 8); /* allocation */ - new_flags = evax_secflag_by_name (name, section->_raw_size); + new_flags = evax_secflag_by_name (name, (int) section->_raw_size); if (old_flags & EGPS_S_V_REL) new_flags |= SEC_RELOC; if (!bfd_set_section_flags (abfd, section, new_flags)) @@ -271,14 +271,13 @@ _bfd_evax_slurp_egsd (abfd) if ((base_addr % align_addr) != 0) base_addr += (align_addr - (base_addr % align_addr)); section->vma = (bfd_vma)base_addr; - base_addr += section->_raw_size; /* FIXME: should be cooked size */ - section->contents = (unsigned char *) malloc (section->_raw_size); + base_addr += section->_raw_size; + section->contents = ((unsigned char *) + bfd_malloc (section->_raw_size)); if (section->contents == NULL) - { - bfd_set_error (bfd_error_no_memory); - return -1; - } - memset (section->contents, 0, section->_raw_size); + return -1; + memset (section->contents, 0, (size_t) section->_raw_size); + section->_cooked_size = section->_raw_size; #if EVAX_DEBUG evax_debug(3, "egsd psc %d (%s, flags %04x=%s) ", section->index, name, old_flags, flag2str(gpsflagdesc, old_flags)); diff --git a/bfd/evax-emh.c b/bfd/evax-emh.c index 71519388d6..69f7e0be91 100644 --- a/bfd/evax-emh.c +++ b/bfd/evax-emh.c @@ -124,28 +124,6 @@ _bfd_evax_slurp_emh (abfd) } -#if 0 - -/* register a file name */ - -int -_bfd_evax_register_filename (abfd, name) - bfd *abfd; - char *name; -{ - if (PRIV(filename) != NULL) - { -#if EVAX_DEBUG - evax_debug(3, "Second filename %s, first was %s\n", name, PRIV(filename)); -#endif - return -1; - } - PRIV(filename) = strdup (name); - return 0; -} - -#endif /* 0 */ - /* write object header for bfd abfd */ int diff --git a/bfd/evax-etir.c b/bfd/evax-etir.c index b9c53bc5dd..cb186f11e9 100644 --- a/bfd/evax-etir.c +++ b/bfd/evax-etir.c @@ -875,7 +875,7 @@ etir_stc (abfd, cmd, ptr) arg: */ case ETIR_S_C_STC_NBH_PS: - (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); +/* FIXME (*_bfd_error_handler) ("ETIR_S_C_STC_xx: (%d) not supported", cmd); */ break; default: diff --git a/bfd/evax-misc.c b/bfd/evax-misc.c index aade68a88c..3da8999780 100644 --- a/bfd/evax-misc.c +++ b/bfd/evax-misc.c @@ -558,23 +558,20 @@ add_new_contents (abfd, section) { evax_section *sptr, *newptr; - newptr = (evax_section *) bfd_zalloc (abfd, sizeof (evax_section)); - if (newptr == (evax_section *)NULL) - { - bfd_set_error (bfd_error_no_memory); - return NULL; - } sptr = PRIV(evax_section_table)[section->index]; - if (sptr == NULL) - { - PRIV(evax_section_table)[section->index] = (evax_section *)newptr; - } - else - { - while (sptr->next != NULL) - sptr = sptr->next; - sptr->next = newptr; - } + if (sptr != NULL) + return sptr; + + newptr = (evax_section *) bfd_malloc (sizeof (evax_section)); + if (newptr == (evax_section *) NULL) + return NULL; + newptr->contents = (unsigned char *) bfd_alloc (abfd, section->_raw_size); + if (newptr->contents == (unsigned char *)NULL) + return NULL; + newptr->offset = 0; + newptr->size = section->_raw_size; + newptr->next = 0; + PRIV(evax_section_table)[section->index] = newptr; return newptr; } @@ -602,20 +599,7 @@ _bfd_save_evax_section (abfd, section, data, offset, count) sptr = add_new_contents (abfd, section); if (sptr == NULL) return false; - sptr->contents = (unsigned char *) bfd_alloc (abfd, (int)count); - if (sptr->contents == (unsigned char *)NULL) - { - bfd_set_error (bfd_error_no_memory); - return false; - } - memcpy (sptr->contents, data, (int)count); - sptr->offset = (bfd_vma)offset; - sptr->size = count; - -#if EVAX_DEBUG - evax_debug (6, "_bfd_save_evax_section sptr = %08lx\n", sptr); - _bfd_hexdump (6, data, count, (int)offset); -#endif + memcpy (sptr->contents + offset, data, (size_t) count); return true; } diff --git a/bfd/evax.h b/bfd/evax.h index 6717bdc046..7d6c9b4ec4 100644 --- a/bfd/evax.h +++ b/bfd/evax.h @@ -178,9 +178,7 @@ extern int _bfd_evax_write_edbg PARAMS ((bfd *abfd)); #define ALPHA_R_OP_PSUB 9 #define ALPHA_R_OP_PRSHIFT 10 #define ALPHA_R_LINKAGE 11 -#define ALPHA_R_SWREL32 12 -#define ALPHA_R_SWREL64 13 -#define ALPHA_R_REFLONG 14 +#define ALPHA_R_REFLONG 12 /* Object language definitions. */ @@ -305,7 +303,6 @@ struct evax_private_data_struct { int stackptr; evax_section *evax_section_table[EVAX_SECTION_COUNT]; - evax_reloc *evax_reloc_table[EVAX_SECTION_COUNT]; struct bfd_hash_table *evax_symbol_table; struct symbol_cache_entry **symcache; diff --git a/bfd/libbfd.h b/bfd/libbfd.h index f3c7404e2d..eb34a43922 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -586,8 +586,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_LO10", "BFD_RELOC_GPREL16", "BFD_RELOC_GPREL32", - "BFD_RELOC_SWREL32", - "BFD_RELOC_SWREL64", "BFD_RELOC_I960_CALLJ", "BFD_RELOC_NONE", "BFD_RELOC_SPARC_WDISP22", @@ -628,7 +626,6 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_ALPHA_LITUSE", "BFD_RELOC_ALPHA_HINT", "BFD_RELOC_ALPHA_LINKAGE", - "BFD_RELOC_ALPHA_BASEREG", "BFD_RELOC_MIPS_JMP", "BFD_RELOC_HI16", "BFD_RELOC_HI16_S", diff --git a/bfd/reloc.c b/bfd/reloc.c index a41860447a..d5575ce8c8 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -428,6 +428,7 @@ bfd_get_reloc_size (howto) case 2: return 4; case 3: return 0; case 4: return 8; + case 8: return 16; case -2: return 4; default: abort (); } @@ -1800,15 +1801,6 @@ handled specially, because the value the register will have is decided relatively late. -ENUM - BFD_RELOC_SWREL32 -ENUMX - BFD_RELOC_SWREL64 -ENUMDOC - For openVMS/Alpha systems, these are displacements for switch -tables. - - ENUM BFD_RELOC_I960_CALLJ ENUMDOC @@ -1950,13 +1942,8 @@ ENUMDOC ENUM BFD_RELOC_ALPHA_LINKAGE ENUMDOC - The LINKAGE relocation outputs a special code in the object file, - the rest is handled by the linker. - -ENUM - BFD_RELOC_ALPHA_BASEREG -ENUMDOC - The BASEREG relocation calculates differences to basereg. + The LINKAGE relocation outputs a linkage pair in the object file, + which is filled by the linker. ENUM BFD_RELOC_MIPS_JMP