Various portability lints.

Fixed reloc bug in ieee and oasys.
This commit is contained in:
Steve Chamberlain 1991-05-08 19:21:48 +00:00
parent a5c6b4b3b5
commit d0ec7a8ee4
8 changed files with 475 additions and 540 deletions

View File

@ -1273,7 +1273,9 @@ swap_std_reloc_out (abfd, g, natptr)
else {
r_extern = 0;
if (g->section == NULL) {
BFD_ASSERT(0);
/* It is possible to have a reloc with nothing, we generate an
abs + 0 */
r_addend = 0;
r_index = N_ABS | N_EXT;
}
else if(g->section->output_section == obj_textsec(abfd)) {

View File

@ -1144,7 +1144,7 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
/* now write the strings themselves */
/* FIXME, this needs to be byte-swapped! */
temp = stridx + 4;
bfd_write (&temp, 1, sizeof (temp), arch);
bfd_write ((PTR)&temp, 1, sizeof (temp), arch);
for (count = 0; count < orl_count; count++)
bfd_write (*((map[count]).name), 1, strlen (*((map[count]).name))+1, arch);
@ -1211,9 +1211,9 @@ coff_write_armap (arch, elength, map, orl_count, stridx)
/* Write the ar header for this item and the number of symbols */
bfd_write ((char *)&hdr, 1, sizeof (struct ar_hdr), arch);
bfd_write ((PTR)&hdr, 1, sizeof (struct ar_hdr), arch);
/* FIXME, this needs to be byte-swapped */
bfd_write (&orl_count, 1, sizeof (orl_count), arch);
bfd_write ((PTR)&orl_count, 1, sizeof (orl_count), arch);
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary
@ -1230,7 +1230,7 @@ coff_write_armap (arch, elength, map, orl_count, stridx)
last_eltno++;
}
/* FIXME, this needs to be byte-swapped */
bfd_write (&archive_member_file_ptr,
bfd_write ((PTR)&archive_member_file_ptr,
1,
sizeof (archive_member_file_ptr),
arch);
@ -1238,7 +1238,7 @@ coff_write_armap (arch, elength, map, orl_count, stridx)
/* now write the strings themselves */
for (count = 0; count < orl_count; count++) {
bfd_write (*((map[count]).name),
bfd_write ((PTR)*((map[count]).name),
1,
strlen (*((map[count]).name))+1, arch);

View File

@ -168,7 +168,7 @@ ecoff_object_p (abfd)
bfd_error = no_error;
/* figure out how much to read */
if (bfd_read (short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
if (bfd_read ((PTR)short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
return 0;
magic = bfd_h_getshort (abfd, short_bytes);
@ -176,13 +176,13 @@ ecoff_object_p (abfd)
bfd_error = wrong_format;
return 0;
}
if (bfd_read (short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
if (bfd_read ((PTR)short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
return 0;
nscns = bfd_h_getshort (abfd, short_bytes);
if (bfd_seek (abfd,(file_ptr) ((sizeof (long)) * 3), true) < 0)
return 0;
if (bfd_read (short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
if (bfd_read ((PTR)short_bytes, 1, SHORT_SIZE, abfd) != SHORT_SIZE)
return 0;
opthdr = bfd_h_getshort (abfd, short_bytes);

File diff suppressed because it is too large Load Diff

View File

@ -50,11 +50,11 @@ bfd_true (ignore)
return true;
}
void *
PTR
bfd_nullvoidptr(ignore)
bfd *ignore;
{
return (void *)NULL;
return (PTR)NULL;
}
int

View File

@ -23,26 +23,24 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define UNDERSCORE_HACK 1
#define offsetof(type, identifier) (size_t) &(((type *) 0)->identifier)
#include <ansidecl.h>
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "obstack.h"
#include "oasys.h"
#include "liboasys.h"
static void
DEFUN(oasys_read_record,(abfd, record),
bfd *CONST abfd AND
oasys_record_union_type *record)
{
bfd_read(record, 1, sizeof(record->header), abfd);
bfd_read((PTR)record, 1, sizeof(record->header), abfd);
if ((size_t) record->header.length <= (size_t) sizeof (record->header))
return;
bfd_read(((char *)record )+ sizeof(record->header),
bfd_read((PTR)(((char *)record )+ sizeof(record->header)),
1, record->header.length - sizeof(record->header),
abfd);
}
@ -77,7 +75,6 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
oasys_record_union_type record;
oasys_data_type *data = oasys_data(abfd);
boolean loop = true;
asymbol *dest_undefined;
asymbol *dest_defined;
asymbol *dest;
char *string_ptr;
@ -92,12 +89,12 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
#ifdef UNDERSCORE_HACK
/* buy 1 more char for each symbol to keep the underscore in*/
data->strings = bfd_alloc(abfd, data->symbol_string_length +
abfd->symcount);
abfd->symcount);
#else
data->strings = bfd_alloc(abfd, data->symbol_string_length);
#endif
dest_undefined = data->symbols;
dest_defined = data->symbols + abfd->symcount -1;
string_ptr = data->strings;
@ -137,7 +134,7 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
}
break;
case RELOCATION_TYPE_UND:
dest = data->symbols + bfd_h_getshort(abfd, &record.symbol.refno[0]);
dest = data->symbols + bfd_h_getshort(abfd, (bfd_byte *)&record.symbol.refno[0]);
dest->section = (asection *)NULL;
dest->flags = BSF_UNDEFINED;
break;
@ -176,7 +173,7 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
}
static size_t
static unsigned int
DEFUN(oasys_get_symtab_upper_bound,(abfd),
bfd *CONST abfd)
{
@ -222,7 +219,7 @@ DEFUN(oasys_archive_p,(abfd),
bfd_seek(abfd, (file_ptr) 0, false);
bfd_read(&header, 1, sizeof(header), abfd);
bfd_read((PTR)&header, 1, sizeof(header), abfd);
swap(header.version);
@ -266,8 +263,7 @@ DEFUN(oasys_archive_p,(abfd),
bfd_seek(abfd , header.mod_tbl_offset, SEEK_SET);
for (i = 0; i < header.mod_count; i++) {
bfd_read(&record, 1, sizeof(record), abfd);
bfd_read((PTR)&record, 1, sizeof(record), abfd);
swap(record.mod_size);
swap(record.file_offset);
swap(record.mod_name_length);
@ -304,6 +300,7 @@ DEFUN(oasys_object_p,(abfd),
bfd *abfd)
{
oasys_data_type *oasys;
oasys_data_type *save = oasys_data(abfd);
boolean loop = true;
boolean had_usefull = false;
@ -393,6 +390,7 @@ DEFUN(oasys_object_p,(abfd),
fail:
(void) bfd_release(abfd, oasys);
oasys_data(abfd) = save;
return (bfd_target *)NULL;
}
@ -852,6 +850,7 @@ DEFUN(oasys_write_end,(abfd),
bfd *CONST abfd)
{
oasys_end_record_type end;
uint8e_type null = 0;
end.relb = RELOCATION_TYPE_ABS;
bfd_h_putlong(abfd, abfd->start_address, end.entry);
bfd_h_putshort(abfd, 0, end.fill);
@ -860,6 +859,7 @@ DEFUN(oasys_write_end,(abfd),
oasys_record_is_end_enum,
(oasys_record_union_type *)&end,
sizeof(end));
bfd_write((PTR)&null, 1, 1, abfd);
}
static int
@ -1081,7 +1081,6 @@ DEFUN(oasys_make_empty_symbol,(abfd),
/* Obsbolete procedural interface; better to look at the cache directly */
/* User should have checked the file flags; perhaps we should return
BFD_NO_MORE_SYMBOLS if there are none? */
@ -1185,20 +1184,22 @@ DEFUN(oasys_generic_stat_arch_elt,(abfd, buf),
}
static int
DEFUN(oasys_sizeof_headers,(abfd),
bfd *abfd)
DEFUN(oasys_sizeof_headers,(abfd, exec),
bfd *abfd AND
boolean exec)
{
return 0;
}
#define oasys_core_file_failing_command bfd_false
#define oasys_core_file_failing_signal bfd_false
#define oasys_core_file_matches_executable_p bfd_false
#define oasys_slurp_armap bfd_false
#define oasys_slurp_extended_name_table bfd_false
#define oasys_truncate_arname bfd_false
#define oasys_write_armap bfd_false
#define oasys_get_lineno bfd_false
#define oasys_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
#define oasys_core_file_failing_signal (int (*)())bfd_0
#define oasys_core_file_matches_executable_p 0 /*(PROTO(boolean, (*),(bfd*, bfd*)))bfd_false*/
#define oasys_slurp_armap bfd_true
#define oasys_slurp_extended_name_table bfd_true
#define oasys_truncate_arname (void (*)())bfd_nullvoidptr
#define oasys_write_armap 0 /* (PROTO( boolean, (*),(bfd *, unsigned int, struct orl *, int, int))) bfd_nullvoidptr*/
#define oasys_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
@ -1223,7 +1224,7 @@ bfd_target oasys_vec =
{_bfd_dummy_target,
oasys_object_p, /* bfd_check_format */
oasys_archive_p,
bfd_false
_bfd_dummy_target,
},
{
bfd_false,

View File

@ -42,7 +42,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* $Id$
* $Log$
* Revision 1.6 1991/04/25 04:06:21 gnu
* Revision 1.7 1991/05/08 19:21:47 steve
* Various portability lints.
* Fixed reloc bug in ieee and oasys.
*
* Revision 1.6 1991/04/25 04:06:21 gnu
* Fix minor pointer type problems that "cc" complains about.
*
* Revision 1.5 1991/04/23 22:44:14 steve
@ -213,7 +217,7 @@ asection *section;
bytes_on_line = HEX(&buffer.size);
bfd_read(buffer.u.data, 1 , bytes_on_line * 2, abfd);
bfd_read((PTR)buffer.u.data, 1 , bytes_on_line * 2, abfd);
switch (buffer.type) {
case '6':
@ -380,7 +384,7 @@ int bytes_to_do;
data++;
* ( (char *)(data)) = '\n';
bfd_write(&buffer, 1, (char *)data - (char *)&buffer + 1 , abfd);
bfd_write((PTR)&buffer, 1, (char *)data - (char *)&buffer + 1 , abfd);
bytes_written += bytes_this_chunk;
location += bytes_this_chunk;
@ -427,13 +431,7 @@ return 0;
}
/*SUPPRESS 460 */
#define srec_core_file_failing_command bfd_false
#define srec_core_file_failing_signal bfd_false
#define srec_core_file_matches_executable_p bfd_false
#define srec_slurp_armap bfd_false
#define srec_slurp_extended_name_table bfd_false
#define srec_truncate_arname bfd_false
#define srec_write_armap bfd_false
#define srec_new_section_hook bfd_false
#define srec_get_symtab_upper_bound bfd_false
#define srec_get_symtab bfd_false
@ -441,11 +439,22 @@ return 0;
#define srec_canonicalize_reloc bfd_false
#define srec_make_empty_symbol bfd_false
#define srec_print_symbol bfd_false
#define srec_get_lineno bfd_false
#define srec_openr_next_archived_file bfd_false
#define srec_find_nearest_line bfd_false
#define srec_generic_stat_arch_elt bfd_false
#define srec_core_file_failing_command (char *(*)())(bfd_nullvoidptr)
#define srec_core_file_failing_signal (int (*)())bfd_0
#define srec_core_file_matches_executable_p (PROTO(boolean, (*),(bfd*, bfd*)))bfd_false
#define srec_slurp_armap bfd_true
#define srec_slurp_extended_name_table bfd_true
#define srec_truncate_arname (void (*)())bfd_nullvoidptr
#define srec_write_armap (PROTO( boolean, (*),(bfd *, unsigned int, struct orl *, int, int))) bfd_nullvoidptr
#define srec_get_lineno (struct lineno_cache_entry *(*)())bfd_nullvoidptr
bfd_target srec_vec =
{
"srec", /* name */

View File

@ -1273,7 +1273,9 @@ swap_std_reloc_out (abfd, g, natptr)
else {
r_extern = 0;
if (g->section == NULL) {
BFD_ASSERT(0);
/* It is possible to have a reloc with nothing, we generate an
abs + 0 */
r_addend = 0;
r_index = N_ABS | N_EXT;
}
else if(g->section->output_section == obj_textsec(abfd)) {