1 1.1 christos /* BFD back-end for PPCbug boot records. 2 1.1.1.10 christos Copyright (C) 1996-2025 Free Software Foundation, Inc. 3 1.1 christos Written by Michael Meissner, Cygnus Support, <meissner (at) cygnus.com> 4 1.1 christos 5 1.1 christos This file is part of BFD, the Binary File Descriptor library. 6 1.1 christos 7 1.1 christos This program is free software; you can redistribute it and/or modify 8 1.1 christos it under the terms of the GNU General Public License as published by 9 1.1 christos the Free Software Foundation; either version 3 of the License, or 10 1.1 christos (at your option) any later version. 11 1.1 christos 12 1.1 christos This program is distributed in the hope that it will be useful, 13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of 14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 1.1 christos GNU General Public License for more details. 16 1.1 christos 17 1.1 christos You should have received a copy of the GNU General Public License 18 1.1 christos along with this program; if not, write to the Free Software 19 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 20 1.1 christos MA 02110-1301, USA. */ 21 1.1 christos 22 1.1 christos 23 1.1 christos /* This is a BFD backend which may be used to write PowerPCBug boot objects. 24 1.1 christos It may only be used for output, not input. The intention is that this may 25 1.1 christos be used as an output format for objcopy in order to generate raw binary 26 1.1 christos data. 27 1.1 christos 28 1.1 christos This is very simple. The only complication is that the real data 29 1.1 christos will start at some address X, and in some cases we will not want to 30 1.1 christos include X zeroes just to get to that point. Since the start 31 1.1 christos address is not meaningful for this object file format, we use it 32 1.1 christos instead to indicate the number of zeroes to skip at the start of 33 1.1 christos the file. objcopy cooperates by specially setting the start 34 1.1 christos address to zero by default. */ 35 1.1 christos 36 1.1 christos #include "sysdep.h" 37 1.1 christos #include "safe-ctype.h" 38 1.1 christos #include "bfd.h" 39 1.1 christos #include "libbfd.h" 40 1.1 christos 41 1.1 christos /* PPCbug location structure */ 42 1.1.1.2 christos typedef struct ppcboot_location 43 1.1.1.2 christos { 44 1.1 christos bfd_byte ind; 45 1.1 christos bfd_byte head; 46 1.1 christos bfd_byte sector; 47 1.1 christos bfd_byte cylinder; 48 1.1 christos } ppcboot_location_t; 49 1.1 christos 50 1.1 christos /* PPCbug partition table layout */ 51 1.1.1.2 christos typedef struct ppcboot_partition 52 1.1.1.2 christos { 53 1.1 christos ppcboot_location_t partition_begin; /* partition begin */ 54 1.1 christos ppcboot_location_t partition_end; /* partition end */ 55 1.1 christos bfd_byte sector_begin[4]; /* 32-bit start RBA (zero-based), little endian */ 56 1.1 christos bfd_byte sector_length[4]; /* 32-bit RBA count (one-based), little endian */ 57 1.1 christos } ppcboot_partition_t; 58 1.1 christos 59 1.1 christos /* PPCbug boot layout. */ 60 1.1.1.2 christos typedef struct ppcboot_hdr 61 1.1.1.2 christos { 62 1.1 christos bfd_byte pc_compatibility[446]; /* x86 instruction field */ 63 1.1 christos ppcboot_partition_t partition[4]; /* partition information */ 64 1.1 christos bfd_byte signature[2]; /* 0x55 and 0xaa */ 65 1.1 christos bfd_byte entry_offset[4]; /* entry point offset, little endian */ 66 1.1 christos bfd_byte length[4]; /* load image length, little endian */ 67 1.1 christos bfd_byte flags; /* flag field */ 68 1.1 christos bfd_byte os_id; /* OS_ID */ 69 1.1 christos char partition_name[32]; /* partition name */ 70 1.1 christos bfd_byte reserved1[470]; /* reserved */ 71 1.1 christos } 72 1.1 christos #ifdef __GNUC__ 73 1.1 christos __attribute__ ((packed)) 74 1.1 christos #endif 75 1.1 christos ppcboot_hdr_t; 76 1.1 christos 77 1.1 christos /* Signature bytes for last 2 bytes of the 512 byte record */ 78 1.1 christos #define SIGNATURE0 0x55 79 1.1 christos #define SIGNATURE1 0xaa 80 1.1 christos 81 1.1 christos /* PowerPC boot type */ 82 1.1 christos #define PPC_IND 0x41 83 1.1 christos 84 1.1 christos /* Information needed for ppcboot header */ 85 1.1.1.2 christos typedef struct ppcboot_data 86 1.1.1.2 christos { 87 1.1 christos ppcboot_hdr_t header; /* raw header */ 88 1.1 christos asection *sec; /* single section */ 89 1.1 christos } ppcboot_data_t; 90 1.1 christos 91 1.1 christos /* Any bfd we create by reading a ppcboot file has three symbols: 92 1.1 christos a start symbol, an end symbol, and an absolute length symbol. */ 93 1.1 christos #define PPCBOOT_SYMS 3 94 1.1 christos 95 1.1.1.2 christos #define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (ptr)) 96 1.1 christos #define ppcboot_get_tdata(abfd) ((ppcboot_data_t *) ((abfd)->tdata.any)) 97 1.1 christos 98 1.1 christos /* Create a ppcboot object. Invoked via bfd_set_format. */ 100 1.1.1.8 christos 101 1.1.1.2 christos static bool 102 1.1 christos ppcboot_mkobject (bfd *abfd) 103 1.1 christos { 104 1.1 christos if (!ppcboot_get_tdata (abfd)) 105 1.1.1.7 christos { 106 1.1 christos size_t amt = sizeof (ppcboot_data_t); 107 1.1 christos ppcboot_set_tdata (abfd, bfd_zalloc (abfd, amt)); 108 1.1 christos } 109 1.1.1.8 christos 110 1.1 christos return true; 111 1.1 christos } 112 1.1 christos 113 1.1 christos 114 1.1.1.8 christos /* Set the architecture to PowerPC */ 116 1.1.1.2 christos static bool 117 1.1.1.2 christos ppcboot_set_arch_mach (bfd *abfd, 118 1.1 christos enum bfd_architecture arch, 119 1.1 christos unsigned long machine) 120 1.1 christos { 121 1.1 christos if (arch == bfd_arch_unknown) 122 1.1 christos arch = bfd_arch_powerpc; 123 1.1.1.8 christos 124 1.1 christos else if (arch != bfd_arch_powerpc) 125 1.1 christos return false; 126 1.1 christos 127 1.1 christos return bfd_default_set_arch_mach (abfd, arch, machine); 128 1.1 christos } 129 1.1 christos 130 1.1 christos 131 1.1 christos /* Any file may be considered to be a ppcboot file, provided the target 133 1.1.1.7 christos was not defaulted. That is, it must be explicitly specified as 134 1.1.1.2 christos being ppcboot. */ 135 1.1 christos 136 1.1 christos static bfd_cleanup 137 1.1 christos ppcboot_object_p (bfd *abfd) 138 1.1 christos { 139 1.1 christos struct stat statbuf; 140 1.1 christos asection *sec; 141 1.1 christos ppcboot_hdr_t hdr; 142 1.1 christos size_t i; 143 1.1 christos ppcboot_data_t *tdata; 144 1.1 christos flagword flags; 145 1.1 christos 146 1.1 christos BFD_ASSERT (sizeof (ppcboot_hdr_t) == 1024); 147 1.1 christos 148 1.1 christos if (abfd->target_defaulted) 149 1.1 christos { 150 1.1 christos bfd_set_error (bfd_error_wrong_format); 151 1.1 christos return NULL; 152 1.1 christos } 153 1.1 christos 154 1.1 christos /* Find the file size. */ 155 1.1 christos if (bfd_stat (abfd, &statbuf) < 0) 156 1.1 christos { 157 1.1 christos bfd_set_error (bfd_error_system_call); 158 1.1 christos return NULL; 159 1.1 christos } 160 1.1 christos 161 1.1 christos if ((size_t) statbuf.st_size < sizeof (ppcboot_hdr_t)) 162 1.1 christos { 163 1.1 christos bfd_set_error (bfd_error_wrong_format); 164 1.1.1.9 christos return NULL; 165 1.1 christos } 166 1.1 christos 167 1.1 christos if (bfd_read (&hdr, sizeof (hdr), abfd) != sizeof (hdr)) 168 1.1 christos { 169 1.1 christos if (bfd_get_error () != bfd_error_system_call) 170 1.1 christos bfd_set_error (bfd_error_wrong_format); 171 1.1 christos 172 1.1 christos return NULL; 173 1.1 christos } 174 1.1 christos 175 1.1 christos /* Now do some basic checks. */ 176 1.1 christos for (i = 0; i < sizeof (hdr.pc_compatibility); i++) 177 1.1 christos if (hdr.pc_compatibility[i]) 178 1.1 christos { 179 1.1 christos bfd_set_error (bfd_error_wrong_format); 180 1.1 christos return NULL; 181 1.1 christos } 182 1.1 christos 183 1.1 christos if (hdr.signature[0] != SIGNATURE0 || hdr.signature[1] != SIGNATURE1) 184 1.1 christos { 185 1.1 christos bfd_set_error (bfd_error_wrong_format); 186 1.1 christos return NULL; 187 1.1 christos } 188 1.1 christos 189 1.1 christos if (hdr.partition[0].partition_end.ind != PPC_IND) 190 1.1 christos { 191 1.1 christos bfd_set_error (bfd_error_wrong_format); 192 1.1 christos return NULL; 193 1.1 christos } 194 1.1 christos 195 1.1 christos abfd->symcount = PPCBOOT_SYMS; 196 1.1 christos 197 1.1 christos /* One data section. */ 198 1.1 christos flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_CODE | SEC_HAS_CONTENTS; 199 1.1 christos sec = bfd_make_section_with_flags (abfd, ".data", flags); 200 1.1 christos if (sec == NULL) 201 1.1 christos return NULL; 202 1.1 christos sec->vma = 0; 203 1.1 christos sec->size = statbuf.st_size - sizeof (ppcboot_hdr_t); 204 1.1 christos sec->filepos = sizeof (ppcboot_hdr_t); 205 1.1 christos 206 1.1.1.2 christos ppcboot_mkobject (abfd); 207 1.1 christos tdata = ppcboot_get_tdata (abfd); 208 1.1 christos tdata->sec = sec; 209 1.1.1.7 christos memcpy (&tdata->header, &hdr, sizeof (ppcboot_hdr_t)); 210 1.1 christos 211 1.1 christos ppcboot_set_arch_mach (abfd, bfd_arch_powerpc, 0L); 212 1.1 christos return _bfd_no_cleanup; 213 1.1 christos } 214 1.1 christos 215 1.1 christos #define ppcboot_close_and_cleanup _bfd_generic_close_and_cleanup 216 1.1 christos #define ppcboot_bfd_free_cached_info _bfd_generic_bfd_free_cached_info 217 1.1 christos #define ppcboot_new_section_hook _bfd_generic_new_section_hook 218 1.1 christos 219 1.1.1.8 christos 220 1.1.1.2 christos /* Get contents of the only section. */ 222 1.1.1.2 christos 223 1.1.1.2 christos static bool 224 1.1.1.2 christos ppcboot_get_section_contents (bfd *abfd, 225 1.1 christos asection *section ATTRIBUTE_UNUSED, 226 1.1.1.9 christos void * location, 227 1.1.1.9 christos file_ptr offset, 228 1.1.1.8 christos bfd_size_type count) 229 1.1.1.8 christos { 230 1.1 christos if (bfd_seek (abfd, offset + sizeof (ppcboot_hdr_t), SEEK_SET) != 0 231 1.1 christos || bfd_read (location, count, abfd) != count) 232 1.1 christos return false; 233 1.1 christos return true; 234 1.1 christos } 235 1.1 christos 236 1.1.1.2 christos 237 1.1 christos /* Return the amount of memory needed to read the symbol table. */ 239 1.1 christos 240 1.1 christos static long 241 1.1 christos ppcboot_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED) 242 1.1 christos { 243 1.1 christos return (PPCBOOT_SYMS + 1) * sizeof (asymbol *); 244 1.1 christos } 245 1.1.1.2 christos 246 1.1 christos 247 1.1 christos /* Create a symbol name based on the bfd's filename. */ 249 1.1 christos 250 1.1 christos static char * 251 1.1 christos mangle_name (bfd *abfd, char *suffix) 252 1.1 christos { 253 1.1 christos bfd_size_type size; 254 1.1 christos char *buf; 255 1.1 christos char *p; 256 1.1 christos 257 1.1 christos size = (strlen (bfd_get_filename (abfd)) 258 1.1 christos + strlen (suffix) 259 1.1 christos + sizeof "_ppcboot__"); 260 1.1 christos 261 1.1 christos buf = (char *) bfd_alloc (abfd, size); 262 1.1 christos if (buf == NULL) 263 1.1 christos return ""; 264 1.1 christos 265 1.1 christos sprintf (buf, "_ppcboot_%s_%s", bfd_get_filename (abfd), suffix); 266 1.1 christos 267 1.1 christos /* Change any non-alphanumeric characters to underscores. */ 268 1.1 christos for (p = buf; *p; p++) 269 1.1 christos if (! ISALNUM (*p)) 270 1.1 christos *p = '_'; 271 1.1 christos 272 1.1 christos return buf; 273 1.1.1.2 christos } 274 1.1 christos 275 1.1 christos 276 1.1 christos /* Return the symbol table. */ 278 1.1.1.7 christos 279 1.1 christos static long 280 1.1 christos ppcboot_canonicalize_symtab (bfd *abfd, asymbol **alocation) 281 1.1 christos { 282 1.1.1.8 christos asection *sec = ppcboot_get_tdata (abfd)->sec; 283 1.1 christos asymbol *syms; 284 1.1 christos unsigned int i; 285 1.1 christos size_t amt = PPCBOOT_SYMS * sizeof (asymbol); 286 1.1 christos 287 1.1 christos syms = (asymbol *) bfd_alloc (abfd, amt); 288 1.1 christos if (syms == NULL) 289 1.1 christos return false; 290 1.1 christos 291 1.1 christos /* Start symbol. */ 292 1.1 christos syms[0].the_bfd = abfd; 293 1.1 christos syms[0].name = mangle_name (abfd, "start"); 294 1.1 christos syms[0].value = 0; 295 1.1 christos syms[0].flags = BSF_GLOBAL; 296 1.1 christos syms[0].section = sec; 297 1.1 christos syms[0].udata.p = NULL; 298 1.1 christos 299 1.1 christos /* End symbol. */ 300 1.1 christos syms[1].the_bfd = abfd; 301 1.1 christos syms[1].name = mangle_name (abfd, "end"); 302 1.1 christos syms[1].value = sec->size; 303 1.1 christos syms[1].flags = BSF_GLOBAL; 304 1.1 christos syms[1].section = sec; 305 1.1 christos syms[1].udata.p = NULL; 306 1.1 christos 307 1.1 christos /* Size symbol. */ 308 1.1 christos syms[2].the_bfd = abfd; 309 1.1 christos syms[2].name = mangle_name (abfd, "size"); 310 1.1 christos syms[2].value = sec->size; 311 1.1 christos syms[2].flags = BSF_GLOBAL; 312 1.1 christos syms[2].section = bfd_abs_section_ptr; 313 1.1 christos syms[2].udata.p = NULL; 314 1.1 christos 315 1.1 christos for (i = 0; i < PPCBOOT_SYMS; i++) 316 1.1 christos *alocation++ = syms++; 317 1.1 christos *alocation = NULL; 318 1.1 christos 319 1.1 christos return PPCBOOT_SYMS; 320 1.1 christos } 321 1.1.1.2 christos 322 1.1.1.2 christos #define ppcboot_make_empty_symbol _bfd_generic_make_empty_symbol 323 1.1.1.2 christos #define ppcboot_print_symbol _bfd_nosymbols_print_symbol 324 1.1 christos 325 1.1 christos /* Get information about a symbol. */ 326 1.1 christos 327 1.1 christos static void 328 1.1.1.3 christos ppcboot_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, 329 1.1.1.3 christos asymbol *symbol, 330 1.1.1.6 christos symbol_info *ret) 331 1.1 christos { 332 1.1 christos bfd_symbol_info (symbol, ret); 333 1.1 christos } 334 1.1.1.8 christos 335 1.1.1.3 christos #define ppcboot_get_symbol_version_string \ 336 1.1 christos _bfd_nosymbols_get_symbol_version_string 337 1.1 christos #define ppcboot_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false 338 1.1 christos #define ppcboot_bfd_is_local_label_name bfd_generic_is_local_label_name 339 1.1 christos #define ppcboot_get_lineno _bfd_nosymbols_get_lineno 340 1.1 christos #define ppcboot_find_nearest_line _bfd_nosymbols_find_nearest_line 341 1.1 christos #define ppcboot_find_nearest_line_with_alt _bfd_nosymbols_find_nearest_line_with_alt 342 1.1 christos #define ppcboot_find_line _bfd_nosymbols_find_line 343 1.1.1.8 christos #define ppcboot_find_inliner_info _bfd_nosymbols_find_inliner_info 344 1.1.1.2 christos #define ppcboot_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol 345 1.1.1.2 christos #define ppcboot_read_minisymbols _bfd_generic_read_minisymbols 346 1.1.1.2 christos #define ppcboot_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol 347 1.1.1.2 christos 348 1.1.1.2 christos /* Write section contents of a ppcboot file. */ 350 1.1 christos 351 1.1 christos static bool 352 1.1 christos ppcboot_set_section_contents (bfd *abfd, 353 1.1 christos asection *sec, 354 1.1 christos const void * data, 355 1.1 christos file_ptr offset, 356 1.1.1.6 christos bfd_size_type size) 357 1.1.1.6 christos { 358 1.1 christos if (! abfd->output_has_begun) 359 1.1 christos { 360 1.1 christos bfd_vma low; 361 1.1 christos asection *s; 362 1.1 christos 363 1.1 christos /* The lowest section VMA sets the virtual address of the start 364 1.1 christos of the file. We use the set the file position of all the 365 1.1 christos sections. */ 366 1.1.1.8 christos low = abfd->sections->vma; 367 1.1 christos for (s = abfd->sections->next; s != NULL; s = s->next) 368 1.1 christos if (s->vma < low) 369 1.1 christos low = s->vma; 370 1.1 christos 371 1.1 christos for (s = abfd->sections; s != NULL; s = s->next) 372 1.1 christos s->filepos = s->vma - low; 373 1.1 christos 374 1.1 christos abfd->output_has_begun = true; 375 1.1 christos } 376 1.1 christos 377 1.1 christos return _bfd_generic_set_section_contents (abfd, sec, data, offset, size); 378 1.1 christos } 379 1.1 christos 380 1.1 christos 381 1.1 christos static int 383 1.1.1.8 christos ppcboot_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, 384 1.1.1.2 christos struct bfd_link_info *info ATTRIBUTE_UNUSED) 385 1.1 christos { 386 1.1 christos return sizeof (ppcboot_hdr_t); 387 1.1 christos } 388 1.1.1.2 christos 389 1.1.1.2 christos 390 1.1 christos /* Print out the program headers. */ 392 1.1 christos 393 1.1 christos static bool 394 1.1 christos ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg) 395 1.1 christos { 396 1.1 christos FILE *f = (FILE *)farg; 397 1.1 christos ppcboot_data_t *tdata = ppcboot_get_tdata (abfd); 398 1.1 christos long entry_offset = bfd_getl_signed_32 (tdata->header.entry_offset); 399 1.1 christos long length = bfd_getl_signed_32 (tdata->header.length); 400 1.1 christos int i; 401 1.1 christos 402 1.1 christos fprintf (f, _("\nppcboot header:\n")); 403 1.1 christos fprintf (f, _("Entry offset = 0x%.8lx (%ld)\n"), 404 1.1.1.4 christos (unsigned long) entry_offset, entry_offset); 405 1.1 christos fprintf (f, _("Length = 0x%.8lx (%ld)\n"), 406 1.1 christos (unsigned long) length, length); 407 1.1 christos 408 1.1 christos if (tdata->header.flags) 409 1.1.1.2 christos fprintf (f, _("Flag field = 0x%.2x\n"), tdata->header.flags); 410 1.1.1.2 christos 411 1.1 christos if (tdata->header.os_id) 412 1.1 christos fprintf (f, "OS_ID = 0x%.2x\n", tdata->header.os_id); 413 1.1 christos 414 1.1 christos if (tdata->header.partition_name[0]) 415 1.1 christos fprintf (f, _("Partition name = \"%s\"\n"), tdata->header.partition_name); 416 1.1 christos 417 1.1 christos for (i = 0; i < 4; i++) 418 1.1 christos { 419 1.1 christos long sector_begin = bfd_getl_signed_32 (tdata->header.partition[i].sector_begin); 420 1.1 christos long sector_length = bfd_getl_signed_32 (tdata->header.partition[i].sector_length); 421 1.1 christos 422 1.1 christos /* Skip all 0 entries */ 423 1.1 christos if (!tdata->header.partition[i].partition_begin.ind 424 1.1.1.5 christos && !tdata->header.partition[i].partition_begin.head 425 1.1 christos && !tdata->header.partition[i].partition_begin.sector 426 1.1 christos && !tdata->header.partition[i].partition_begin.cylinder 427 1.1 christos && !tdata->header.partition[i].partition_end.ind 428 1.1 christos && !tdata->header.partition[i].partition_end.head 429 1.1 christos && !tdata->header.partition[i].partition_end.sector 430 1.1 christos && !tdata->header.partition[i].partition_end.cylinder 431 1.1.1.5 christos && !sector_begin && !sector_length) 432 1.1 christos continue; 433 1.1 christos 434 1.1 christos /* xgettext:c-format */ 435 1.1 christos fprintf (f, _("\nPartition[%d] start = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"), i, 436 1.1 christos tdata->header.partition[i].partition_begin.ind, 437 1.1 christos tdata->header.partition[i].partition_begin.head, 438 1.1.1.5 christos tdata->header.partition[i].partition_begin.sector, 439 1.1 christos tdata->header.partition[i].partition_begin.cylinder); 440 1.1 christos 441 1.1.1.5 christos /* xgettext:c-format */ 442 1.1.1.5 christos fprintf (f, _("Partition[%d] end = { 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x }\n"), i, 443 1.1 christos tdata->header.partition[i].partition_end.ind, 444 1.1 christos tdata->header.partition[i].partition_end.head, 445 1.1 christos tdata->header.partition[i].partition_end.sector, 446 1.1 christos tdata->header.partition[i].partition_end.cylinder); 447 1.1 christos 448 1.1.1.8 christos /* xgettext:c-format */ 449 1.1 christos fprintf (f, _("Partition[%d] sector = 0x%.8lx (%ld)\n"), 450 1.1 christos i, (unsigned long) sector_begin, sector_begin); 451 1.1 christos 452 1.1 christos /* xgettext:c-format */ 453 1.1 christos fprintf (f, _("Partition[%d] length = 0x%.8lx (%ld)\n"), 454 1.1 christos i, (unsigned long) sector_length, sector_length); 455 1.1 christos } 456 1.1.1.2 christos 457 1.1 christos fprintf (f, "\n"); 458 1.1 christos return true; 459 1.1.1.7 christos } 460 1.1 christos 461 1.1 christos 462 1.1 christos #define ppcboot_bfd_get_relocated_section_contents \ 464 1.1.1.6 christos bfd_generic_get_relocated_section_contents 465 1.1.1.6 christos #define ppcboot_bfd_relax_section bfd_generic_relax_section 466 1.1 christos #define ppcboot_bfd_gc_sections bfd_generic_gc_sections 467 1.1 christos #define ppcboot_bfd_lookup_section_flags bfd_generic_lookup_section_flags 468 1.1 christos #define ppcboot_bfd_merge_sections bfd_generic_merge_sections 469 1.1 christos #define ppcboot_bfd_is_group_section bfd_generic_is_group_section 470 1.1 christos #define ppcboot_bfd_group_name bfd_generic_group_name 471 1.1 christos #define ppcboot_bfd_discard_group bfd_generic_discard_group 472 1.1 christos #define ppcboot_section_already_linked \ 473 1.1.1.4 christos _bfd_generic_section_already_linked 474 1.1 christos #define ppcboot_bfd_define_common_symbol bfd_generic_define_common_symbol 475 1.1 christos #define ppcboot_bfd_link_hide_symbol _bfd_generic_link_hide_symbol 476 1.1 christos #define ppcboot_bfd_define_start_stop bfd_generic_define_start_stop 477 1.1 christos #define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create 478 1.1 christos #define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols 479 1.1 christos #define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms 480 1.1 christos #define ppcboot_bfd_copy_link_hash_symbol_type \ 481 1.1 christos _bfd_generic_copy_link_hash_symbol_type 482 1.1 christos #define ppcboot_bfd_final_link _bfd_generic_final_link 483 1.1.1.3 christos #define ppcboot_bfd_link_split_section _bfd_generic_link_split_section 484 1.1 christos #define ppcboot_bfd_link_check_relocs _bfd_generic_link_check_relocs 485 1.1 christos 486 1.1 christos #define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data 487 1.1 christos #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data 488 1.1 christos #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data 489 1.1 christos #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data 490 1.1 christos #define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data 491 1.1 christos #define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags 492 1.1 christos #define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data 493 1.1 christos 494 1.1 christos const bfd_target powerpc_boot_vec = 495 1.1.1.2 christos { 496 1.1.1.8 christos "ppcboot", /* name */ 497 1.1 christos bfd_target_unknown_flavour, /* flavour */ 498 1.1 christos BFD_ENDIAN_BIG, /* byteorder is big endian for code */ 499 1.1 christos BFD_ENDIAN_LITTLE, /* header_byteorder */ 500 1.1 christos EXEC_P, /* object_flags */ 501 1.1 christos (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA 502 1.1 christos | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ 503 1.1 christos 0, /* symbol_leading_char */ 504 1.1 christos ' ', /* ar_pad_char */ 505 1.1 christos 16, /* ar_max_namelen */ 506 1.1 christos 0, /* match priority. */ 507 1.1 christos TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */ 508 1.1 christos bfd_getb64, bfd_getb_signed_64, bfd_putb64, 509 1.1 christos bfd_getb32, bfd_getb_signed_32, bfd_putb32, 510 1.1.1.6 christos bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ 511 1.1 christos bfd_getl64, bfd_getl_signed_64, bfd_putl64, 512 1.1.1.6 christos bfd_getl32, bfd_getl_signed_32, bfd_putl32, 513 1.1.1.6 christos bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */ 514 1.1 christos { /* bfd_check_format */ 515 1.1 christos _bfd_dummy_target, 516 1.1.1.6 christos ppcboot_object_p, /* bfd_check_format */ 517 1.1.1.6 christos _bfd_dummy_target, 518 1.1.1.6 christos _bfd_dummy_target, 519 1.1.1.6 christos }, 520 1.1 christos { /* bfd_set_format */ 521 1.1 christos _bfd_bool_bfd_false_error, 522 1.1 christos ppcboot_mkobject, 523 1.1 christos _bfd_bool_bfd_false_error, 524 1.1 christos _bfd_bool_bfd_false_error, 525 1.1 christos }, 526 1.1 christos { /* bfd_write_contents */ 527 1.1 christos _bfd_bool_bfd_false_error, 528 1.1 christos _bfd_bool_bfd_true, 529 1.1 christos _bfd_bool_bfd_false_error, 530 1.1 christos _bfd_bool_bfd_false_error, 531 1.1 christos }, 532 1.1 christos 533 1.1 christos BFD_JUMP_TABLE_GENERIC (ppcboot), 534 1.1 christos BFD_JUMP_TABLE_COPY (ppcboot), 535 1.1 christos BFD_JUMP_TABLE_CORE (_bfd_nocore), 536 BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), 537 BFD_JUMP_TABLE_SYMBOLS (ppcboot), 538 BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), 539 BFD_JUMP_TABLE_WRITE (ppcboot), 540 BFD_JUMP_TABLE_LINK (ppcboot), 541 BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), 542 543 NULL, 544 545 NULL 546 }; 547