#include "libbfd.h"
#include "som.h"
+#include "safe-ctype.h"
#include <sys/param.h>
#include <signal.h>
#include <machine/reg.h>
#include <sys/file.h>
-#include <ctype.h>
/* Magic not defined in standard HP-UX header files until 8.0 */
obj_som_exec_data (abfd)->exec_flags = aux_hdrp->exec_flags;
}
+ obj_som_exec_data (abfd)->version_id = file_hdrp->version_id;
+
bfd_default_set_arch_mach (abfd, bfd_arch_hppa, pa10);
bfd_get_symcount (abfd) = file_hdrp->symbol_total;
char *space_strings;
unsigned int space_index, i;
unsigned int total_subspaces = 0;
- asection **subspace_sections, *section;
+ asection **subspace_sections = NULL;
+ asection *section;
bfd_size_type amt;
/* First, read in space names. */
else
file_hdr->a_magic = RELOC_MAGIC;
- /* Only new format SOM is supported. */
- file_hdr->version_id = NEW_VERSION_ID;
-
/* These fields are optional, and embedding timestamps is not always
a wise thing to do, it makes comparing objects during a multi-stage
bootstrap difficult. */
break;
case R_END_TRY:
- /* The end of a exception handling region. The reloc's
+ /* The end of an exception handling region. The reloc's
addend contains the offset of the exception handling
code. */
if (bfd_reloc->addend == 0)
som_write_symbol_strings (abfd, current_offset, syms, num_syms, string_sizep,
compilation_unit)
bfd *abfd;
- file_ptr current_offset;
+ unsigned long current_offset;
asymbol **syms;
unsigned int num_syms;
unsigned int *string_sizep;
/* Seek to the start of the space strings in preparation for writing
them out. */
- if (bfd_seek (abfd, current_offset, SEEK_SET) != 0)
+ if (bfd_seek (abfd, (file_ptr) current_offset, SEEK_SET) != 0)
return false;
if (compilation_unit)
unsigned int total_reloc_size;
bfd_size_type amt;
+ /* We must set up the version identifier here as objcopy/strip copy
+ private BFD data too late for us to handle this in som_begin_writing. */
+ if (obj_som_exec_data (abfd)
+ && obj_som_exec_data (abfd)->version_id)
+ obj_som_file_hdr (abfd)->version_id = obj_som_exec_data (abfd)->version_id;
+ else
+ obj_som_file_hdr (abfd)->version_id = NEW_VERSION_ID;
+
/* Next is the symbol table. These are fixed length records.
Count the number of symbols to determine how much room is needed
c = *cp++;
/* If this is a variable, push it on the stack. */
- if (isupper (c))
+ if (ISUPPER (c))
push (var (c));
/* If this is a lower case letter, then it represents
additional data from the fixup stream to be pushed onto
the stack. */
- else if (islower (c))
+ else if (ISLOWER (c))
{
int bits = (c - 'a') * 8;
for (v = 0; c > 'a'; --c)
}
/* A decimal constant. Push it on the stack. */
- else if (isdigit (c))
+ else if (ISDIGIT (c))
{
v = c - '0';
- while (isdigit (*cp))
+ while (ISDIGIT (*cp))
v = (v * 10) + (*cp++ - '0');
push (v);
}
else
return '?';
if (symbol->flags & BSF_GLOBAL)
- c = toupper (c);
+ c = TOUPPER (c);
return c;
}