| 1 | /* HP PA-RISC SOM object file format: definitions internal to BFD.
|
|---|
| 2 | Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, 2001,
|
|---|
| 3 | 2002 Free Software Foundation, Inc.
|
|---|
| 4 |
|
|---|
| 5 | Contributed by the Center for Software Science at the
|
|---|
| 6 | University of Utah ([email protected]).
|
|---|
| 7 |
|
|---|
| 8 | This file is part of BFD, the Binary File Descriptor library.
|
|---|
| 9 |
|
|---|
| 10 | This program is free software; you can redistribute it and/or modify
|
|---|
| 11 | it under the terms of the GNU General Public License as published by
|
|---|
| 12 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 13 | (at your option) any later version.
|
|---|
| 14 |
|
|---|
| 15 | This program is distributed in the hope that it will be useful,
|
|---|
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 18 | GNU General Public License for more details.
|
|---|
| 19 |
|
|---|
| 20 | You should have received a copy of the GNU General Public License
|
|---|
| 21 | along with this program; if not, write to the Free Software
|
|---|
| 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|---|
| 23 | 02111-1307, USA. */
|
|---|
| 24 |
|
|---|
| 25 | #ifndef _SOM_H
|
|---|
| 26 | #define _SOM_H
|
|---|
| 27 |
|
|---|
| 28 | #include "libhppa.h"
|
|---|
| 29 |
|
|---|
| 30 | /* Enable PA2.0 if available */
|
|---|
| 31 | #define PA_2_0
|
|---|
| 32 |
|
|---|
| 33 | #include <a.out.h>
|
|---|
| 34 | #include <lst.h>
|
|---|
| 35 | #include <ar.h>
|
|---|
| 36 |
|
|---|
| 37 | /* The SOM BFD backend doesn't currently use anything from these
|
|---|
| 38 | two include files, but it's likely to need them in the future. */
|
|---|
| 39 | #ifdef R_DLT_REL
|
|---|
| 40 | #include <shl.h>
|
|---|
| 41 | #include <dl.h>
|
|---|
| 42 | #endif
|
|---|
| 43 |
|
|---|
| 44 | #if defined(HOST_HPPABSD) || defined (HOST_HPPAOSF)
|
|---|
| 45 | /* BSD uses a completely different scheme for object file identification.
|
|---|
| 46 | so for now, define _PA_RISC_ID to accept any random value for a model
|
|---|
| 47 | number. */
|
|---|
| 48 | #undef _PA_RISC_ID
|
|---|
| 49 | #define _PA_RISC_ID(__m_num) 1
|
|---|
| 50 | #endif /* HOST_HPPABSD */
|
|---|
| 51 |
|
|---|
| 52 | #define FILE_HDR_SIZE sizeof (struct header)
|
|---|
| 53 | #define AUX_HDR_SIZE sizeof (struct som_exec_auxhdr)
|
|---|
| 54 |
|
|---|
| 55 | typedef struct som_symbol
|
|---|
| 56 | {
|
|---|
| 57 | asymbol symbol;
|
|---|
| 58 | unsigned int som_type;
|
|---|
| 59 |
|
|---|
| 60 | /* Structured like the ELF tc_data union. Allows more code sharing
|
|---|
| 61 | in GAS this way. */
|
|---|
| 62 | union
|
|---|
| 63 | {
|
|---|
| 64 | struct
|
|---|
| 65 | {
|
|---|
| 66 | unsigned int hppa_arg_reloc;
|
|---|
| 67 | unsigned int hppa_priv_level;
|
|---|
| 68 | } ap;
|
|---|
| 69 | PTR any;
|
|---|
| 70 | }
|
|---|
| 71 | tc_data;
|
|---|
| 72 |
|
|---|
| 73 | /* Index of this symbol in the symbol table. Only used when
|
|---|
| 74 | building relocation streams for incomplete objects. */
|
|---|
| 75 | int index;
|
|---|
| 76 |
|
|---|
| 77 | /* How many times this symbol is used in a relocation. By sorting
|
|---|
| 78 | the symbols from most used to least used we can significantly
|
|---|
| 79 | reduce the size of the relocation stream for incomplete objects. */
|
|---|
| 80 | int reloc_count;
|
|---|
| 81 |
|
|---|
| 82 | /* During object file writing, the offset of the name of this symbol
|
|---|
| 83 | in the SOM string table. */
|
|---|
| 84 | int stringtab_offset;
|
|---|
| 85 | }
|
|---|
| 86 | som_symbol_type;
|
|---|
| 87 |
|
|---|
| 88 | /* A structure containing all the magic information stored in a BFD's
|
|---|
| 89 | private data which needs to be copied during an objcopy/strip run. */
|
|---|
| 90 | struct som_exec_data
|
|---|
| 91 | {
|
|---|
| 92 | /* Sort-of a magic number. BSD uses it to distinguish between
|
|---|
| 93 | native executables and hpux executables. */
|
|---|
| 94 | short system_id;
|
|---|
| 95 |
|
|---|
| 96 | /* Magic exec flags. These control things like whether or not
|
|---|
| 97 | null pointer dereferencing is allowed and the like. */
|
|---|
| 98 | long exec_flags;
|
|---|
| 99 |
|
|---|
| 100 | /* We must preserve the version identifier too. Some versions
|
|---|
| 101 | of the HP linker do not grok NEW_VERSION_ID for reasons unknown. */
|
|---|
| 102 | unsigned int version_id;
|
|---|
| 103 |
|
|---|
| 104 | /* Add more stuff here as needed. Good examples of information
|
|---|
| 105 | we might want to pass would be presumed_dp, entry_* and maybe
|
|---|
| 106 | others from the file header. */
|
|---|
| 107 | };
|
|---|
| 108 |
|
|---|
| 109 | struct somdata
|
|---|
| 110 | {
|
|---|
| 111 | /* All the magic information about an executable which lives
|
|---|
| 112 | in the private BFD structure and needs to be copied from
|
|---|
| 113 | the input bfd to the output bfd during an objcopy/strip. */
|
|---|
| 114 | struct som_exec_data *exec_data;
|
|---|
| 115 |
|
|---|
| 116 | /* These three fields are only used when writing files and are
|
|---|
| 117 | generated from scratch. They need not be copied for objcopy
|
|---|
| 118 | or strip to work. */
|
|---|
| 119 | struct header *file_hdr;
|
|---|
| 120 | struct copyright_aux_hdr *copyright_aux_hdr;
|
|---|
| 121 | struct user_string_aux_hdr *version_aux_hdr;
|
|---|
| 122 | struct som_exec_auxhdr *exec_hdr;
|
|---|
| 123 | COMPUNIT *comp_unit;
|
|---|
| 124 |
|
|---|
| 125 | /* Pointers to a saved copy of the symbol and string tables. These
|
|---|
| 126 | need not be copied for objcopy or strip to work. */
|
|---|
| 127 | som_symbol_type *symtab;
|
|---|
| 128 | char *stringtab;
|
|---|
| 129 | asymbol **sorted_syms;
|
|---|
| 130 |
|
|---|
| 131 | /* We remember these offsets so that after check_file_format, we have
|
|---|
| 132 | no dependencies on the particular format of the exec_hdr.
|
|---|
| 133 | These offsets need not be copied for objcopy or strip to work. */
|
|---|
| 134 |
|
|---|
| 135 | file_ptr sym_filepos;
|
|---|
| 136 | file_ptr str_filepos;
|
|---|
|
|---|