Changeset 609 for branches/GNU/src/binutils/bfd/aoutx.h
- Timestamp:
- Aug 16, 2003, 6:59:22 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/binutils/bfd/aoutx.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.1.1.2
r608 r609 1 1 /* BFD semi-generic back-end for a.out binaries. 2 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 3 2001 3 2001, 2002, 2003 4 4 Free Software Foundation, Inc. 5 5 Written by Cygnus Support. 6 6 7 This file is part of BFD, the Binary File Descriptor library.8 9 This program is free software; you can redistribute it and/or modify10 it under the terms of the GNU General Public License as published by11 the Free Software Foundation; either version 2 of the License, or12 (at your option) any later version.13 14 This program is distributed in the hope that it will be useful,15 but WITHOUT ANY WARRANTY; without even the implied warranty of16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 GNU General Public License for more details.18 19 You should have received a copy of the GNU General Public License20 along with this program; if not, write to the Free Software21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */7 This file is part of BFD, the Binary File Descriptor library. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 22 22 23 23 /* … … 106 106 to use the 107 107 @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your 108 configuration is selected. 109 110 */ 108 configuration is selected. */ 111 109 112 110 /* Some assumptions: … … 121 119 #define KEEPIT udata.i 122 120 123 #include <ctype.h>124 121 #include "bfd.h" 125 122 #include "sysdep.h" 123 #include "safe-ctype.h" 126 124 #include "bfdlink.h" 127 125 … … 132 130 #include "aout/ar.h" 133 131 134 static boolean aout_get_external_symbols PARAMS ((bfd *)); 135 static boolean translate_from_native_sym_flags 132 static bfd_boolean aout_get_external_symbols 133 PARAMS ((bfd *)); 134 static bfd_boolean translate_from_native_sym_flags 136 135 PARAMS ((bfd *, aout_symbol_type *)); 137 static b oolean translate_to_native_sym_flags136 static bfd_boolean translate_to_native_sym_flags 138 137 PARAMS ((bfd *, asymbol *, struct external_nlist *)); 139 static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *)); 140 static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *)); 141 static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *)); 138 static void adjust_o_magic 139 PARAMS ((bfd *, struct internal_exec *)); 140 static void adjust_z_magic 141 PARAMS ((bfd *, struct internal_exec *)); 142 static void adjust_n_magic 143 PARAMS ((bfd *, struct internal_exec *)); 144 reloc_howto_type * NAME(aout,reloc_type_lookup) 145 PARAMS ((bfd *, bfd_reloc_code_real_type)); 142 146 143 147 /* … … 152 156 address, a symbol index, and a type field. The extended records 153 157 (used on 29ks and sparcs) also have a full integer for an 154 addend. 155 156 */ 158 addend. */ 159 157 160 #ifndef CTOR_TABLE_RELOC_HOWTO 158 161 #define CTOR_TABLE_RELOC_IDX 2 159 #define CTOR_TABLE_RELOC_HOWTO(BFD) ((obj_reloc_entry_size(BFD) == RELOC_EXT_SIZE \ 160 ? howto_table_ext : howto_table_std) \ 161 + CTOR_TABLE_RELOC_IDX) 162 #define CTOR_TABLE_RELOC_HOWTO(BFD) \ 163 ((obj_reloc_entry_size (BFD) == RELOC_EXT_SIZE \ 164 ? howto_table_ext : howto_table_std) \ 165 + CTOR_TABLE_RELOC_IDX) 162 166 #endif 163 167 … … 191 195 reloc_howto_type howto_table_ext[] = 192 196 { 193 /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */194 HOWTO(RELOC_8, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", false, 0,0x000000ff, false),195 HOWTO(RELOC_16, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", false, 0,0x0000ffff, false),196 HOWTO(RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", false, 0,0xffffffff, false),197 HOWTO(RELOC_DISP8, 0, 0, 8, true, 0, complain_overflow_signed,0,"DISP8", false, 0,0x000000ff, false),198 HOWTO(RELOC_DISP16, 0, 1, 16, true, 0, complain_overflow_signed,0,"DISP16", false, 0,0x0000ffff, false),199 HOWTO(RELOC_DISP32, 0, 2, 32, true, 0, complain_overflow_signed,0,"DISP32", false, 0,0xffffffff, false),200 HOWTO(RELOC_WDISP30,2, 2, 30, true, 0, complain_overflow_signed,0,"WDISP30", false, 0,0x3fffffff, false),201 HOWTO(RELOC_WDISP22,2, 2, 22, true, 0, complain_overflow_signed,0,"WDISP22", false, 0,0x003fffff, false),202 HOWTO(RELOC_HI22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"HI22", false, 0,0x003fffff, false),203 HOWTO(RELOC_22, 0, 2, 22, false, 0, complain_overflow_bitfield,0,"22", false, 0,0x003fffff, false),204 HOWTO(RELOC_13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"13", false, 0,0x00001fff, false),205 HOWTO(RELOC_LO10, 0, 2, 10, false, 0, complain_overflow_dont,0,"LO10", false, 0,0x000003ff, false),206 HOWTO(RELOC_SFA_BASE,0, 2, 32, false, 0, complain_overflow_bitfield,0,"SFA_BASE", false, 0,0xffffffff, false),207 HOWTO(RELOC_SFA_OFF13,0,2, 32, false, 0, complain_overflow_bitfield,0,"SFA_OFF13",false, 0,0xffffffff, false),208 HOWTO(RELOC_BASE10, 0, 2, 10, false, 0, complain_overflow_dont,0,"BASE10", false, 0,0x000003ff, false),209 HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_signed,0,"BASE13", false, 0,0x00001fff, false),210 HOWTO(RELOC_BASE22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"BASE22", false, 0,0x003fffff, false),211 HOWTO(RELOC_PC10, 0, 2, 10, true, 0, complain_overflow_dont,0,"PC10", false, 0,0x000003ff, true),212 HOWTO(RELOC_PC22, 10, 2, 22, true, 0, complain_overflow_signed,0,"PC22", false, 0,0x003fffff, true),213 HOWTO(RELOC_JMP_TBL,2, 2, 30, true, 0, complain_overflow_signed,0,"JMP_TBL", false, 0,0x3fffffff, false),214 HOWTO(RELOC_SEGOFF16,0, 2, 0, false, 0, complain_overflow_bitfield,0,"SEGOFF16", false, 0,0x00000000, false),215 HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"GLOB_DAT", false, 0,0x00000000, false),216 HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_SLOT", false, 0,0x00000000, false),217 HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),218 HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true),219 HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true),197 /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ 198 HOWTO(RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", FALSE, 0,0x000000ff, FALSE), 199 HOWTO(RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", FALSE, 0,0x0000ffff, FALSE), 200 HOWTO(RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", FALSE, 0,0xffffffff, FALSE), 201 HOWTO(RELOC_DISP8, 0, 0, 8, TRUE, 0, complain_overflow_signed,0,"DISP8", FALSE, 0,0x000000ff, FALSE), 202 HOWTO(RELOC_DISP16, 0, 1, 16, TRUE, 0, complain_overflow_signed,0,"DISP16", FALSE, 0,0x0000ffff, FALSE), 203 HOWTO(RELOC_DISP32, 0, 2, 32, TRUE, 0, complain_overflow_signed,0,"DISP32", FALSE, 0,0xffffffff, FALSE), 204 HOWTO(RELOC_WDISP30,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"WDISP30", FALSE, 0,0x3fffffff, FALSE), 205 HOWTO(RELOC_WDISP22,2, 2, 22, TRUE, 0, complain_overflow_signed,0,"WDISP22", FALSE, 0,0x003fffff, FALSE), 206 HOWTO(RELOC_HI22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"HI22", FALSE, 0,0x003fffff, FALSE), 207 HOWTO(RELOC_22, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"22", FALSE, 0,0x003fffff, FALSE), 208 HOWTO(RELOC_13, 0, 2, 13, FALSE, 0, complain_overflow_bitfield,0,"13", FALSE, 0,0x00001fff, FALSE), 209 HOWTO(RELOC_LO10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"LO10", FALSE, 0,0x000003ff, FALSE), 210 HOWTO(RELOC_SFA_BASE,0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_BASE", FALSE, 0,0xffffffff, FALSE), 211 HOWTO(RELOC_SFA_OFF13,0,2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_OFF13",FALSE, 0,0xffffffff, FALSE), 212 HOWTO(RELOC_BASE10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"BASE10", FALSE, 0,0x000003ff, FALSE), 213 HOWTO(RELOC_BASE13, 0, 2, 13, FALSE, 0, complain_overflow_signed,0,"BASE13", FALSE, 0,0x00001fff, FALSE), 214 HOWTO(RELOC_BASE22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"BASE22", FALSE, 0,0x003fffff, FALSE), 215 HOWTO(RELOC_PC10, 0, 2, 10, TRUE, 0, complain_overflow_dont,0,"PC10", FALSE, 0,0x000003ff, TRUE), 216 HOWTO(RELOC_PC22, 10, 2, 22, TRUE, 0, complain_overflow_signed,0,"PC22", FALSE, 0,0x003fffff, TRUE), 217 HOWTO(RELOC_JMP_TBL,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"JMP_TBL", FALSE, 0,0x3fffffff, FALSE), 218 HOWTO(RELOC_SEGOFF16,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"SEGOFF16", FALSE, 0,0x00000000, FALSE), 219 HOWTO(RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GLOB_DAT", FALSE, 0,0x00000000, FALSE), 220 HOWTO(RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_SLOT", FALSE, 0,0x00000000, FALSE), 221 HOWTO(RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE), 222 HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), 223 HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), 220 224 #define RELOC_SPARC_REV32 RELOC_WDISP19 221 HOWTO(RELOC_SPARC_REV32, 0, 2, 32, false, 0, complain_overflow_dont,0,"R_SPARC_REV32", false, 0,0xffffffff, false),225 HOWTO(RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont,0,"R_SPARC_REV32", FALSE, 0,0xffffffff, FALSE), 222 226 }; 223 227 224 228 /* Convert standard reloc records to "arelent" format (incl byte swap). */ 225 229 226 reloc_howto_type howto_table_std[] = { 227 /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ 228 HOWTO( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false), 229 HOWTO( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false), 230 HOWTO( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false), 231 HOWTO( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false), 232 HOWTO( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false), 233 HOWTO( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false), 234 HOWTO( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false), 235 HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false), 236 HOWTO( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false), 237 HOWTO( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false), 238 HOWTO(10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false), 230 reloc_howto_type howto_table_std[] = 231 { 232 /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ 233 HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE), 234 HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), 235 HOWTO ( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE), 236 HOWTO ( 3, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,0,"64", TRUE, 0xdeaddead,0xdeaddead, FALSE), 237 HOWTO ( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, FALSE), 238 HOWTO ( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), 239 HOWTO ( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), 240 HOWTO ( 7, 0, 4, 64, TRUE, 0, complain_overflow_signed, 0,"DISP64", TRUE, 0xfeedface,0xfeedface, FALSE), 241 HOWTO ( 8, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GOT_REL", FALSE, 0,0x00000000, FALSE), 242 HOWTO ( 9, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"BASE16", FALSE,0xffffffff,0xffffffff, FALSE), 243 HOWTO (10, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"BASE32", FALSE,0xffffffff,0xffffffff, FALSE), 239 244 EMPTY_HOWTO (-1), 240 245 EMPTY_HOWTO (-1), … … 242 247 EMPTY_HOWTO (-1), 243 248 EMPTY_HOWTO (-1), 244 HOWTO (16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false),249 HOWTO (16, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_TABLE", FALSE, 0,0x00000000, FALSE), 245 250 EMPTY_HOWTO (-1), 246 251 EMPTY_HOWTO (-1), … … 258 263 EMPTY_HOWTO (-1), 259 264 EMPTY_HOWTO (-1), 260 HOWTO (32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),265 HOWTO (32, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE), 261 266 EMPTY_HOWTO (-1), 262 267 EMPTY_HOWTO (-1), … … 266 271 EMPTY_HOWTO (-1), 267 272 EMPTY_HOWTO (-1), 268 HOWTO (40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),273 HOWTO (40, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"BASEREL", FALSE, 0,0x00000000, FALSE), 269 274 }; 270 275 271 #define TABLE_SIZE(TABLE) (sizeof (TABLE) /sizeof (TABLE[0]))276 #define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0])) 272 277 273 278 reloc_howto_type * … … 276 281 bfd_reloc_code_real_type code; 277 282 { 278 #define EXT(i, j) case i: return &howto_table_ext[j]279 #define STD(i, j) case i: return &howto_table_std[j]283 #define EXT(i, j) case i: return &howto_table_ext[j] 284 #define STD(i, j) case i: return &howto_table_std[j] 280 285 int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; 286 281 287 if (code == BFD_RELOC_CTOR) 282 288 switch (bfd_get_arch_info (abfd)->bits_per_address) … … 289 295 break; 290 296 } 297 291 298 if (ext) 292 299 switch (code) … … 311 318 } 312 319 else 313 /* std relocs */320 /* std relocs. */ 314 321 switch (code) 315 322 { 323 STD (BFD_RELOC_8, 0); 316 324 STD (BFD_RELOC_16, 1); 317 325 STD (BFD_RELOC_32, 2); … … 367 375 memset ((PTR) execp, 0, sizeof (struct internal_exec)); 368 376 /* Now fill in fields in the execp, from the bytes in the raw data. */ 369 execp->a_info = bfd_h_get_32 (abfd, bytes->e_info);377 execp->a_info = H_GET_32 (abfd, bytes->e_info); 370 378 execp->a_text = GET_WORD (abfd, bytes->e_text); 371 379 execp->a_data = GET_WORD (abfd, bytes->e_data); … … 402 410 403 411 /* Now fill in fields in the raw data, from the fields in the exec struct. */ 404 bfd_h_put_32 (abfd, execp->a_info , bytes->e_info);412 H_PUT_32 (abfd, execp->a_info , bytes->e_info); 405 413 PUT_WORD (abfd, execp->a_text , bytes->e_text); 406 414 PUT_WORD (abfd, execp->a_data , bytes->e_data); … … 414 422 /* Make all the section for an a.out file. */ 415 423 416 b oolean424 bfd_boolean 417 425 NAME(aout,make_sections) (abfd) 418 426 bfd *abfd; … … 420 428 if (obj_textsec (abfd) == (asection *) NULL 421 429 && bfd_make_section (abfd, ".text") == (asection *) NULL) 422 return false;430 return FALSE; 423 431 if (obj_datasec (abfd) == (asection *) NULL 424 432 && bfd_make_section (abfd, ".data") == (asection *) NULL) 425 return false;433 return FALSE; 426 434 if (obj_bsssec (abfd) == (asection *) NULL 427 435 && bfd_make_section (abfd, ".bss") == (asection *) NULL) 428 return false;429 return true;436 return FALSE; 437 return TRUE; 430 438 } 431 439 … … 455 463 struct aout_data_struct *rawptr, *oldrawptr; 456 464 const bfd_target *result; 457 458 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, sizeof (struct aout_data_struct )); 465 bfd_size_type amt = sizeof (struct aout_data_struct); 466 467 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); 459 468 if (rawptr == NULL) 460 469 return 0; … … 471 480 472 481 abfd->tdata.aout_data->a.hdr = &rawptr->e; 473 *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */ 482 /* Copy in the internal_exec struct. */ 483 *(abfd->tdata.aout_data->a.hdr) = *execp; 474 484 execp = abfd->tdata.aout_data->a.hdr; 475 485 476 /* Set the file flags */486 /* Set the file flags. */ 477 487 abfd->flags = BFD_NO_FLAGS; 478 488 if (execp->a_drsize || execp->a_trsize) 479 489 abfd->flags |= HAS_RELOC; 480 /* Setting of EXEC_P has been deferred to the bottom of this function */490 /* Setting of EXEC_P has been deferred to the bottom of this function. */ 481 491 if (execp->a_syms) 482 492 abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; 483 if (N_DYNAMIC (*execp))493 if (N_DYNAMIC (*execp)) 484 494 abfd->flags |= DYNAMIC; 485 495 … … 530 540 531 541 if (! NAME(aout,make_sections) (abfd)) 532 return NULL;542 goto error_ret; 533 543 534 544 obj_datasec (abfd)->_raw_size = execp->a_data; … … 558 568 struct exec *execp = exec_hdr (abfd); 559 569 560 obj_textsec (abfd)->size = N_TXTSIZE (*execp);561 obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp);562 /* data and bss are already filled in since they're so standard*/563 564 /* The virtual memory addresses of the sections */565 obj_textsec (abfd)->vma = N_TXTADDR (*execp);566 obj_datasec (abfd)->vma = N_DATADDR (*execp);567 obj_bsssec (abfd)->vma = N_BSSADDR (*execp);568 569 /* The file offsets of the sections */570 obj_textsec (abfd)->filepos = N_TXTOFF (*execp);571 obj_datasec (abfd)->filepos = N_DATOFF (*execp);572 573 /* The file offsets of the relocation info */574 obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp);575 obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp);570 obj_textsec (abfd)->size = N_TXTSIZE (*execp); 571 obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp); 572 /* Data and bss are already filled in since they're so standard. */ 573 574 /* The virtual memory addresses of the sections. */ 575 obj_textsec (abfd)->vma = N_TXTADDR (*execp); 576 obj_datasec (abfd)->vma = N_DATADDR (*execp); 577 obj_bsssec (abfd)->vma = N_BSSADDR (*execp); 578 579 /* The file offsets of the sections. */ 580 obj_textsec (abfd)->filepos = N_TXTOFF (*execp); 581 obj_datasec (abfd)->filepos = N_DATOFF (*execp); 582 583 /* The file offsets of the relocation info. */ 584 obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); 585 obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); 576 586 577 587 /* The file offsets of the string table and symbol table. */ … … 580 590 581 591 /* Determine the architecture and machine type of the object file. */ 582 switch (N_MACHTYPE (*exec_hdr (abfd))) { 583 default: 584 abfd->obj_arch = bfd_arch_obscure; 585 break; 586 } 587 588 adata(abfd)->page_size = TARGET_PAGE_SIZE; 589 adata(abfd)->segment_size = SEGMENT_SIZE; 590 adata(abfd)->exec_bytes_size = EXEC_BYTES_SIZE; 592 switch (N_MACHTYPE (*exec_hdr (abfd))) 593 { 594 default: 595 abfd->obj_arch = bfd_arch_obscure; 596 break; 597 } 598 599 adata (abfd)->page_size = TARGET_PAGE_SIZE; 600 adata (abfd)->segment_size = SEGMENT_SIZE; 601 adata (abfd)->exec_bytes_size = EXEC_BYTES_SIZE; 591 602 592 603 return abfd->xvec; … … 620 631 621 632 if (execp->a_entry != 0 622 || (execp->a_entry >= obj_textsec(abfd)->vma 623 && execp->a_entry < obj_textsec(abfd)->vma + obj_textsec(abfd)->_raw_size)) 633 || (execp->a_entry >= obj_textsec (abfd)->vma 634 && execp->a_entry < (obj_textsec (abfd)->vma 635 + obj_textsec (abfd)->_raw_size))) 624 636 abfd->flags |= EXEC_P; 625 637 #ifdef STAT_FOR_EXEC … … 637 649 if (abfd->iostream != NULL 638 650 && (abfd->flags & BFD_IN_MEMORY) == 0 639 && (fstat (fileno((FILE *) (abfd->iostream)), &stat_buf) == 0)651 && (fstat (fileno ((FILE *) (abfd->iostream)), &stat_buf) == 0) 640 652 && ((stat_buf.st_mode & 0111) != 0)) 641 653 abfd->flags |= EXEC_P; … … 650 662 obj_datasec (abfd)->next = obj_bsssec (abfd); 651 663 #endif 652 }653 else654 { 655 free (rawptr);656 abfd->tdata.aout_data = oldrawptr;657 }658 return result;664 return result; 665 } 666 667 error_ret: 668 bfd_release (abfd, rawptr); 669 abfd->tdata.aout_data = oldrawptr; 670 return NULL; 659 671 } 660 672 … … 664 676 665 677 SYNOPSIS 666 b oolean aout_@var{size}_mkobject, (bfd *abfd);678 bfd_boolean aout_@var{size}_mkobject, (bfd *abfd); 667 679 668 680 DESCRIPTION … … 670 682 */ 671 683 672 b oolean684 bfd_boolean 673 685 NAME(aout,mkobject) (abfd) 674 686 bfd *abfd; 675 687 { 676 struct aout_data_struct *rawptr; 688 struct aout_data_struct *rawptr; 689 bfd_size_type amt = sizeof (struct aout_data_struct); 677 690 678 691 bfd_set_error (bfd_error_system_call); 679 692 680 /* Use an intermediate variable for clarity */ 681 rawptr = (struct aout_data_struct *)bfd_zalloc (abfd, sizeof (struct aout_data_struct )); 682 693 rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); 683 694 if (rawptr == NULL) 684 return false;695 return FALSE; 685 696 686 697 abfd->tdata.aout_data = rawptr; 687 698 exec_hdr (abfd) = &(rawptr->e); 688 699 689 obj_textsec (abfd) = (asection *) NULL;690 obj_datasec (abfd) = (asection *) NULL;691 obj_bsssec (abfd) = (asection *) NULL;692 693 return true;700 obj_textsec (abfd) = (asection *) NULL; 701 obj_datasec (abfd) = (asection *) NULL; 702 obj_bsssec (abfd) = (asection *) NULL; 703 704 return TRUE; 694 705 } 695 706 … … 717 728 enum bfd_architecture arch; 718 729 unsigned long machine; 719 b oolean *unknown;730 bfd_boolean *unknown; 720 731 { 721 732 enum machine_type arch_flags; 722 733 723 734 arch_flags = M_UNKNOWN; 724 *unknown = true; 725 726 switch (arch) { 727 case bfd_arch_sparc: 728 if (machine == 0 729 || machine == bfd_mach_sparc 730 || machine == bfd_mach_sparc_sparclite 731 || machine == bfd_mach_sparc_sparclite_le 732 || machine == bfd_mach_sparc_v9) 733 arch_flags = M_SPARC; 734 else if (machine == bfd_mach_sparc_sparclet) 735 arch_flags = M_SPARCLET; 736 break; 737 738 case bfd_arch_m68k: 739 switch (machine) { 740 case 0: arch_flags = M_68010; break; 741 case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break; 742 case bfd_mach_m68010: arch_flags = M_68010; break; 743 case bfd_mach_m68020: arch_flags = M_68020; break; 744 default: arch_flags = M_UNKNOWN; break; 745 } 746 break; 747 748 case bfd_arch_i386: 749 if (machine == 0) arch_flags = M_386; 750 break; 751 752 case bfd_arch_a29k: 753 if (machine == 0) arch_flags = M_29K; 754 break; 755 756 case bfd_arch_arm: 757 if (machine == 0) arch_flags = M_ARM; 758 break; 759 760 case bfd_arch_mips: 761 switch (machine) { 762 case 0: 763 case bfd_mach_mips3000: 764 case bfd_mach_mips3900: 765 arch_flags = M_MIPS1; 735 *unknown = TRUE; 736 737 switch (arch) 738 { 739 case bfd_arch_sparc: 740 if (machine == 0 741 || machine == bfd_mach_sparc 742 || machine == bfd_mach_sparc_sparclite 743 || machine == bfd_mach_sparc_sparclite_le 744 || machine == bfd_mach_sparc_v9) 745 arch_flags = M_SPARC; 746 else if (machine == bfd_mach_sparc_sparclet) 747 arch_flags = M_SPARCLET; 766 748 break; 767 case bfd_mach_mips6000: 768 arch_flags = M_MIPS2; 749 750 case bfd_arch_m68k: 751 switch (machine) 752 { 753 case 0: arch_flags = M_68010; break; 754 case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break; 755 case bfd_mach_m68010: arch_flags = M_68010; break; 756 case bfd_mach_m68020: arch_flags = M_68020; break; 757 default: arch_flags = M_UNKNOWN; break; 758 } 769 759 break; 770 case bfd_mach_mips4000: 771 case bfd_mach_mips4010: 772 case bfd_mach_mips4100: 773 case bfd_mach_mips4300: 774 case bfd_mach_mips4400: 775 case bfd_mach_mips4600: 776 case bfd_mach_mips4650: 777 case bfd_mach_mips8000: 778 case bfd_mach_mips10000: 779 case bfd_mach_mips12000: 780 case bfd_mach_mips16: 781 case bfd_mach_mips32: 782 case bfd_mach_mips32_4k: 783 case bfd_mach_mips5: 784 case bfd_mach_mips64: 785 case bfd_mach_mips_sb1: 786 /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ 787 arch_flags = M_MIPS2; 760 761 case bfd_arch_i386: 762 if (machine == 0 763 || machine == bfd_mach_i386_i386 764 || machine == bfd_mach_i386_i386_intel_syntax) 765 arch_flags = M_386; 788 766 break; 767 768 case bfd_arch_a29k: 769 if (machine == 0) 770 arch_flags = M_29K; 771 break; 772 773 case bfd_arch_arm: 774 if (machine == 0) 775 arch_flags = M_ARM; 776 break; 777 778 case bfd_arch_mips: 779 switch (machine) 780 { 781 case 0: 782 case bfd_mach_mips3000: 783 case bfd_mach_mips3900: 784 arch_flags = M_MIPS1; 785 break; 786 case bfd_mach_mips6000: 787 arch_flags = M_MIPS2; 788 break; 789 case bfd_mach_mips4000: 790 case bfd_mach_mips4010: 791 case bfd_mach_mips4100: 792 case bfd_mach_mips4300: 793 case bfd_mach_mips4400: 794 case bfd_mach_mips4600: 795 case bfd_mach_mips4650: 796 case bfd_mach_mips8000: 797 case bfd_mach_mips10000: 798 case bfd_mach_mips12000: 799 case bfd_mach_mips16: 800 case bfd_mach_mipsisa32: 801 case bfd_mach_mipsisa32r2: 802 case bfd_mach_mips5: 803 case bfd_mach_mipsisa64: 804 case bfd_mach_mips_sb1: 805 /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ 806 arch_flags = M_MIPS2; 807 break; 808 default: 809 arch_flags = M_UNKNOWN; 810 break; 811 } 812 break; 813 814 case bfd_arch_ns32k: 815 switch (machine) 816 { 817 case 0: arch_flags = M_NS32532; break; 818 case 32032: arch_flags = M_NS32032; break; 819 case 32532: arch_flags = M_NS32532; break; 820 default: arch_flags = M_UNKNOWN; break; 821 } 822 break; 823 824 case bfd_arch_vax: 825 *unknown = FALSE; 826 break; 827 828 case bfd_arch_cris: 829 if (machine == 0 || machine == 255) 830 arch_flags = M_CRIS; 831 break; 832 789 833 default: 790 834 arch_flags = M_UNKNOWN; 791 break; 792 } 793 break; 794 795 case bfd_arch_ns32k: 796 switch (machine) { 797 case 0: arch_flags = M_NS32532; break; 798 case 32032: arch_flags = M_NS32032; break; 799 case 32532: arch_flags = M_NS32532; break; 800 default: arch_flags = M_UNKNOWN; break; 801 } 802 break; 803 804 case bfd_arch_vax: 805 *unknown = false; 806 break; 807 808 case bfd_arch_cris: 809 if (machine == 0 || machine == 255) arch_flags = M_CRIS; 810 break; 811 812 default: 813 arch_flags = M_UNKNOWN; 814 } 835 } 815 836 816 837 if (arch_flags != M_UNKNOWN) 817 *unknown = false;838 *unknown = FALSE; 818 839 819 840 return arch_flags; … … 825 846 826 847 SYNOPSIS 827 b oolean aout_@var{size}_set_arch_mach,848 bfd_boolean aout_@var{size}_set_arch_mach, 828 849 (bfd *, 829 850 enum bfd_architecture arch, … … 836 857 */ 837 858 838 b oolean859 bfd_boolean 839 860 NAME(aout,set_arch_mach) (abfd, arch, machine) 840 861 bfd *abfd; … … 843 864 { 844 865 if (! bfd_default_set_arch_mach (abfd, arch, machine)) 845 return false;866 return FALSE; 846 867 847 868 if (arch != bfd_arch_unknown) 848 869 { 849 b oolean unknown;870 bfd_boolean unknown; 850 871 851 872 NAME(aout,machine_type) (arch, machine, &unknown); 852 873 if (unknown) 853 return false; 854 } 855 856 /* Determine the size of a relocation entry */ 857 switch (arch) { 858 case bfd_arch_sparc: 859 case bfd_arch_a29k: 860 case bfd_arch_mips: 861 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; 862 break; 863 default: 864 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; 865 break; 866 } 867 868 return (*aout_backend_info(abfd)->set_sizes) (abfd); 874 return FALSE; 875 } 876 877 /* Determine the size of a relocation entry. */ 878 switch (arch) 879 { 880 case bfd_arch_sparc: 881 case bfd_arch_a29k: 882 case bfd_arch_mips: 883 obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE; 884 break; 885 default: 886 obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; 887 break; 888 } 889 890 return (*aout_backend_info (abfd)->set_sizes) (abfd); 869 891 } 870 892 … … 879 901 880 902 /* Text. */ 881 obj_textsec (abfd)->filepos = pos;882 if (!obj_textsec (abfd)->user_set_vma)883 obj_textsec (abfd)->vma = vma;903 obj_textsec (abfd)->filepos = pos; 904 if (!obj_textsec (abfd)->user_set_vma) 905 obj_textsec (abfd)->vma = vma; 884 906 else 885 vma = obj_textsec (abfd)->vma;886 887 pos += obj_textsec (abfd)->_raw_size;888 vma += obj_textsec (abfd)->_raw_size;907 vma = obj_textsec (abfd)->vma; 908 909 pos += obj_textsec (abfd)->_raw_size; 910 vma += obj_textsec (abfd)->_raw_size; 889 911 890 912 /* Data. */ 891 if (!obj_datasec (abfd)->user_set_vma)892 { 893 #if 0 /* ?? Does alignment in the file image really matter? */894 pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma;913 if (!obj_datasec (abfd)->user_set_vma) 914 { 915 #if 0 /* ?? Does alignment in the file image really matter? */ 916 pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; 895 917 #endif 896 obj_textsec (abfd)->_raw_size += pad;918 obj_textsec (abfd)->_raw_size += pad; 897 919 pos += pad; 898 920 vma += pad; 899 obj_datasec (abfd)->vma = vma;921 obj_datasec (abfd)->vma = vma; 900 922 } 901 923 else 902 vma = obj_datasec (abfd)->vma;903 obj_datasec (abfd)->filepos = pos;904 pos += obj_datasec (abfd)->_raw_size;905 vma += obj_datasec (abfd)->_raw_size;924 vma = obj_datasec (abfd)->vma; 925 obj_datasec (abfd)->filepos = pos; 926 pos += obj_datasec (abfd)->_raw_size; 927 vma += obj_datasec (abfd)->_raw_size; 906 928 907 929 /* BSS. */ 908 if (!obj_bsssec (abfd)->user_set_vma)930 if (!obj_bsssec (abfd)->user_set_vma) 909 931 { 910 932 #if 0 911 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;933 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; 912 934 #endif 913 obj_datasec (abfd)->_raw_size += pad;935 obj_datasec (abfd)->_raw_size += pad; 914 936 pos += pad; 915 937 vma += pad; 916 obj_bsssec (abfd)->vma = vma;938 obj_bsssec (abfd)->vma = vma; 917 939 } 918 940 else 919 941 { 920 /* The VMA of the .bss section is set by the theVMA of the942 /* The VMA of the .bss section is set by the VMA of the 921 943 .data section plus the size of the .data section. We may 922 944 need to add padding bytes to make this true. */ … … 928 950 } 929 951 } 930 obj_bsssec (abfd)->filepos = pos;952 obj_bsssec (abfd)->filepos = pos; 931 953 932 954 /* Fix up the exec header. */ 933 execp->a_text = obj_textsec (abfd)->_raw_size;934 execp->a_data = obj_datasec (abfd)->_raw_size;935 execp->a_bss = obj_bsssec (abfd)->_raw_size;955 execp->a_text = obj_textsec (abfd)->_raw_size; 956 execp->a_data = obj_datasec (abfd)->_raw_size; 957 execp->a_bss = obj_bsssec (abfd)->_raw_size; 936 958 N_SET_MAGIC (*execp, OMAGIC); 937 959 } … … 944 966 bfd_size_type data_pad, text_pad; 945 967 file_ptr text_end; 946 CONSTstruct aout_backend_data *abdp;968 const struct aout_backend_data *abdp; 947 969 int ztih; /* Nonzero if text includes exec header. */ 948 970 … … 953 975 && (abdp->text_includes_header 954 976 || obj_aout_subformat (abfd) == q_magic_format)); 955 obj_textsec (abfd)->filepos = (ztih956 ? adata(abfd).exec_bytes_size957 : adata(abfd).zmagic_disk_block_size);958 if (! obj_textsec (abfd)->user_set_vma)977 obj_textsec (abfd)->filepos = (ztih 978 ? adata (abfd).exec_bytes_size 979 : adata (abfd).zmagic_disk_block_size); 980 if (! obj_textsec (abfd)->user_set_vma) 959 981 { 960 982 /* ?? Do we really need to check for relocs here? */ 961 obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC)962 ? 0963 : (ztih964 ? (abdp->default_text_vma965 + adata(abfd).exec_bytes_size)966 : abdp->default_text_vma));983 obj_textsec (abfd)->vma = ((abfd->flags & HAS_RELOC) 984 ? 0 985 : (ztih 986 ? (abdp->default_text_vma 987 + adata (abfd).exec_bytes_size) 988 : abdp->default_text_vma)); 967 989 text_pad = 0; 968 990 } … … 995 1017 text_end += obj_textsec (abfd)->filepos; 996 1018 } 997 obj_textsec (abfd)->_raw_size += text_pad;1019 obj_textsec (abfd)->_raw_size += text_pad; 998 1020 text_end += text_pad; 999 1021 1000 1022 /* Data. */ 1001 if (!obj_datasec (abfd)->user_set_vma)1023 if (!obj_datasec (abfd)->user_set_vma) 1002 1024 { 1003 1025 bfd_vma vma; 1004 vma = obj_textsec (abfd)->vma + obj_textsec(abfd)->_raw_size;1005 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);1026 vma = obj_textsec (abfd)->vma + obj_textsec (abfd)->_raw_size; 1027 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); 1006 1028 } 1007 1029 if (abdp && abdp->zmagic_mapped_contiguous) 1008 1030 { 1009 text_pad = (obj_datasec(abfd)->vma 1010 - obj_textsec(abfd)->vma 1011 - obj_textsec(abfd)->_raw_size); 1012 obj_textsec(abfd)->_raw_size += text_pad; 1013 } 1014 obj_datasec(abfd)->filepos = (obj_textsec(abfd)->filepos 1015 + obj_textsec(abfd)->_raw_size); 1031 asection * text = obj_textsec (abfd); 1032 asection * data = obj_datasec (abfd); 1033 1034 text_pad = data->vma - (text->vma + text->_raw_size); 1035 /* Only pad the text section if the data 1036 section is going to be placed after it. */ 1037 if (text_pad > 0) 1038 text->_raw_size += text_pad; 1039 } 1040 obj_datasec (abfd)->filepos = (obj_textsec (abfd)->filepos 1041 + obj_textsec (abfd)->_raw_size); 1016 1042 1017 1043 /* Fix up exec header while we're at it. */ 1018 execp->a_text = obj_textsec (abfd)->_raw_size;1044 execp->a_text = obj_textsec (abfd)->_raw_size; 1019 1045 if (ztih && (!abdp || (abdp && !abdp->exec_header_not_counted))) 1020 execp->a_text += adata (abfd).exec_bytes_size;1046 execp->a_text += adata (abfd).exec_bytes_size; 1021 1047 if (obj_aout_subformat (abfd) == q_magic_format) 1022 1048 N_SET_MAGIC (*execp, QMAGIC); … … 1025 1051 1026 1052 /* Spec says data section should be rounded up to page boundary. */ 1027 obj_datasec (abfd)->_raw_size1028 = align_power (obj_datasec (abfd)->_raw_size,1029 obj_bsssec (abfd)->alignment_power);1030 execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size,1031 adata (abfd).page_size);1032 data_pad = execp->a_data - obj_datasec (abfd)->_raw_size;1053 obj_datasec (abfd)->_raw_size 1054 = align_power (obj_datasec (abfd)->_raw_size, 1055 obj_bsssec (abfd)->alignment_power); 1056 execp->a_data = BFD_ALIGN (obj_datasec (abfd)->_raw_size, 1057 adata (abfd).page_size); 1058 data_pad = execp->a_data - obj_datasec (abfd)->_raw_size; 1033 1059 1034 1060 /* BSS. */ 1035 if (!obj_bsssec (abfd)->user_set_vma)1036 obj_bsssec (abfd)->vma = (obj_datasec(abfd)->vma1037 + obj_datasec(abfd)->_raw_size);1061 if (!obj_bsssec (abfd)->user_set_vma) 1062 obj_bsssec (abfd)->vma = (obj_datasec (abfd)->vma 1063 + obj_datasec (abfd)->_raw_size); 1038 1064 /* If the BSS immediately follows the data section and extra space 1039 1065 in the page is left after the data section, fudge data … … 1043 1069 could have explicitly set the BSS vma to immediately follow 1044 1070 the data section.) */ 1045 if (align_power (obj_bsssec (abfd)->vma, obj_bsssec(abfd)->alignment_power)1046 == obj_datasec (abfd)->vma + obj_datasec(abfd)->_raw_size)1047 execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size) ? 0 :1048 obj_bsssec(abfd)->_raw_size - data_pad;1071 if (align_power (obj_bsssec (abfd)->vma, obj_bsssec (abfd)->alignment_power) 1072 == obj_datasec (abfd)->vma + obj_datasec (abfd)->_raw_size) 1073 execp->a_bss = (data_pad > obj_bsssec (abfd)->_raw_size 1074 ? 0 : obj_bsssec (abfd)->_raw_size - data_pad); 1049 1075 else 1050 execp->a_bss = obj_bsssec (abfd)->_raw_size;1076 execp->a_bss = obj_bsssec (abfd)->_raw_size; 1051 1077 } 1052 1078 … … 1056 1082 struct internal_exec *execp; 1057 1083 { 1058 file_ptr pos = adata (abfd).exec_bytes_size;1084 file_ptr pos = adata (abfd).exec_bytes_size; 1059 1085 bfd_vma vma = 0; 1060 1086 int pad; 1061 1087 1062 1088 /* Text. */ 1063 obj_textsec (abfd)->filepos = pos;1064 if (!obj_textsec (abfd)->user_set_vma)1065 obj_textsec (abfd)->vma = vma;1089 obj_textsec (abfd)->filepos = pos; 1090 if (!obj_textsec (abfd)->user_set_vma) 1091 obj_textsec (abfd)->vma = vma; 1066 1092 else 1067 vma = obj_textsec (abfd)->vma;1068 pos += obj_textsec (abfd)->_raw_size;1069 vma += obj_textsec (abfd)->_raw_size;1093 vma = obj_textsec (abfd)->vma; 1094 pos += obj_textsec (abfd)->_raw_size; 1095 vma += obj_textsec (abfd)->_raw_size; 1070 1096 1071 1097 /* Data. */ 1072 obj_datasec (abfd)->filepos = pos;1073 if (!obj_datasec (abfd)->user_set_vma)1074 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata(abfd).segment_size);1075 vma = obj_datasec (abfd)->vma;1098 obj_datasec (abfd)->filepos = pos; 1099 if (!obj_datasec (abfd)->user_set_vma) 1100 obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); 1101 vma = obj_datasec (abfd)->vma; 1076 1102 1077 1103 /* Since BSS follows data immediately, see if it needs alignment. */ 1078 vma += obj_datasec (abfd)->_raw_size;1079 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;1080 obj_datasec (abfd)->_raw_size += pad;1081 pos += obj_datasec (abfd)->_raw_size;1104 vma += obj_datasec (abfd)->_raw_size; 1105 pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; 1106 obj_datasec (abfd)->_raw_size += pad; 1107 pos += obj_datasec (abfd)->_raw_size; 1082 1108 1083 1109 /* BSS. */ 1084 if (!obj_bsssec (abfd)->user_set_vma)1085 obj_bsssec (abfd)->vma = vma;1110 if (!obj_bsssec (abfd)->user_set_vma) 1111 obj_bsssec (abfd)->vma = vma; 1086 1112 else 1087 vma = obj_bsssec (abfd)->vma;1113 vma = obj_bsssec (abfd)->vma; 1088 1114 1089 1115 /* Fix up exec header. */ 1090 execp->a_text = obj_textsec (abfd)->_raw_size;1091 execp->a_data = obj_datasec (abfd)->_raw_size;1092 execp->a_bss = obj_bsssec (abfd)->_raw_size;1116 execp->a_text = obj_textsec (abfd)->_raw_size; 1117 execp->a_data = obj_datasec (abfd)->_raw_size; 1118 execp->a_bss = obj_bsssec (abfd)->_raw_size; 1093 1119 N_SET_MAGIC (*execp, NMAGIC); 1094 1120 } 1095 1121 1096 b oolean1122 bfd_boolean 1097 1123 NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) 1098 1124 bfd *abfd; … … 1103 1129 1104 1130 if (! NAME(aout,make_sections) (abfd)) 1105 return false;1106 1107 if (adata (abfd).magic != undecided_magic)1108 return true;1109 1110 obj_textsec (abfd)->_raw_size =1111 align_power (obj_textsec(abfd)->_raw_size,1112 obj_textsec(abfd)->alignment_power);1131 return FALSE; 1132 1133 if (adata (abfd).magic != undecided_magic) 1134 return TRUE; 1135 1136 obj_textsec (abfd)->_raw_size = 1137 align_power (obj_textsec (abfd)->_raw_size, 1138 obj_textsec (abfd)->alignment_power); 1113 1139 1114 1140 *text_size = obj_textsec (abfd)->_raw_size; … … 1131 1157 if (abfd->flags & D_PAGED) 1132 1158 /* Whether or not WP_TEXT is set -- let D_PAGED override. */ 1133 adata (abfd).magic = z_magic;1159 adata (abfd).magic = z_magic; 1134 1160 else if (abfd->flags & WP_TEXT) 1135 adata (abfd).magic = n_magic;1161 adata (abfd).magic = n_magic; 1136 1162 else 1137 adata (abfd).magic = o_magic;1163 adata (abfd).magic = o_magic; 1138 1164 1139 1165 #ifdef BFD_AOUT_DEBUG /* requires gcc2 */ … … 1141 1167 fprintf (stderr, "%s text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x,%x>\n", 1142 1168 ({ char *str; 1143 switch (adata(abfd).magic) { 1144 case n_magic: str = "NMAGIC"; break; 1145 case o_magic: str = "OMAGIC"; break; 1146 case z_magic: str = "ZMAGIC"; break; 1147 default: abort (); 1148 } 1169 switch (adata (abfd).magic) 1170 { 1171 case n_magic: str = "NMAGIC"; break; 1172 case o_magic: str = "OMAGIC"; break; 1173 case z_magic: str = "ZMAGIC"; break; 1174 default: abort (); 1175 } 1149 1176 str; 1150 1177 }), 1151 obj_textsec (abfd)->vma, obj_textsec(abfd)->_raw_size,1152 obj_textsec (abfd)->alignment_power,1153 obj_datasec (abfd)->vma, obj_datasec(abfd)->_raw_size,1154 obj_datasec (abfd)->alignment_power,1155 obj_bsssec (abfd)->vma, obj_bsssec(abfd)->_raw_size,1156 obj_bsssec (abfd)->alignment_power);1178 obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, 1179 obj_textsec (abfd)->alignment_power, 1180 obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, 1181 obj_datasec (abfd)->alignment_power, 1182 obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size, 1183 obj_bsssec (abfd)->alignment_power); 1157 1184 #endif 1158 1185 #endif 1159 1186 1160 switch (adata (abfd).magic)1187 switch (adata (abfd).magic) 1161 1188 { 1162 1189 case o_magic: … … 1175 1202 #ifdef BFD_AOUT_DEBUG 1176 1203 fprintf (stderr, " text=<%x,%x,%x> data=<%x,%x,%x> bss=<%x,%x>\n", 1177 obj_textsec (abfd)->vma, obj_textsec(abfd)->_raw_size,1178 obj_textsec (abfd)->filepos,1179 obj_datasec (abfd)->vma, obj_datasec(abfd)->_raw_size,1180 obj_datasec (abfd)->filepos,1181 obj_bsssec (abfd)->vma, obj_bsssec(abfd)->_raw_size);1204 obj_textsec (abfd)->vma, obj_textsec (abfd)->_raw_size, 1205 obj_textsec (abfd)->filepos, 1206 obj_datasec (abfd)->vma, obj_datasec (abfd)->_raw_size, 1207 obj_datasec (abfd)->filepos, 1208 obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size); 1182 1209 #endif 1183 1210 1184 return true;1211 return TRUE; 1185 1212 } 1186 1213 … … 1190 1217 1191 1218 SYNOPSIS 1192 b oolean aout_@var{size}_new_section_hook,1219 bfd_boolean aout_@var{size}_new_section_hook, 1193 1220 (bfd *abfd, 1194 1221 asection *newsect)); … … 1198 1225 request. 1199 1226 */ 1200 b oolean1227 bfd_boolean 1201 1228 NAME(aout,new_section_hook) (abfd, newsect) 1202 1229 bfd *abfd; 1203 1230 asection *newsect; 1204 1231 { 1205 /* align to double at least*/1206 newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power;1232 /* Align to double at least. */ 1233 newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power; 1207 1234 1208 1235 if (bfd_get_format (abfd) == bfd_object) 1209 { 1210 if (obj_textsec(abfd) == NULL && !strcmp(newsect->name, ".text")) { 1211 obj_textsec(abfd)= newsect; 1212 newsect->target_index = N_TEXT; 1213 return true; 1214 } 1215 1216 if (obj_datasec(abfd) == NULL && !strcmp(newsect->name, ".data")) { 1217 obj_datasec(abfd) = newsect; 1218 newsect->target_index = N_DATA; 1219 return true; 1220 } 1221 1222 if (obj_bsssec(abfd) == NULL && !strcmp(newsect->name, ".bss")) { 1223 obj_bsssec(abfd) = newsect; 1224 newsect->target_index = N_BSS; 1225 return true; 1226 } 1227 1228 } 1229 1230 /* We allow more than three sections internally */ 1231 return true; 1232 } 1233 1234 boolean 1236 { 1237 if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text")) 1238 { 1239 obj_textsec (abfd)= newsect; 1240 newsect->target_index = N_TEXT; 1241 return TRUE; 1242 } 1243 1244 if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) 1245 { 1246 obj_datasec (abfd) = newsect; 1247 newsect->target_index = N_DATA; 1248 return TRUE; 1249 } 1250 1251 if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) 1252 { 1253 obj_bsssec (abfd) = newsect; 1254 newsect->target_index = N_BSS; 1255 return TRUE; 1256 } 1257 } 1258 1259 /* We allow more than three sections internally. */ 1260 return TRUE; 1261 } 1262 1263 bfd_boolean 1235 1264 NAME(aout,set_section_contents) (abfd, section, location, offset, count) 1236 1265 bfd *abfd; … … 1246 1275 { 1247 1276 if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) 1248 return false;1277 return FALSE; 1249 1278 } 1250 1279 … … 1252 1281 { 1253 1282 bfd_set_error (bfd_error_no_contents); 1254 return false;1283 return FALSE; 1255 1284 } 1256 1285 … … 1258 1287 && section != obj_datasec (abfd)) 1259 1288 { 1260 (*_bfd_error_handler) 1261 (_("%s: can not represent section `%s' in a.out object file format"), 1262 bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); 1263 bfd_set_error (bfd_error_nonrepresentable_section); 1264 return false; 1289 if (aout_section_merge_with_text_p (abfd, section)) 1290 section->filepos = obj_textsec (abfd)->filepos + 1291 (section->vma - obj_textsec (abfd)->vma); 1292 else 1293 { 1294 (*_bfd_error_handler) 1295 (_("%s: can not represent section `%s' in a.out object file format"), 1296 bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); 1297 bfd_set_error (bfd_error_nonrepresentable_section); 1298 return FALSE; 1299 } 1265 1300 } 1266 1301 … … 1268 1303 { 1269 1304 if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 1270 || bfd_ write (location, 1, count, abfd) != count)1271 return false;1272 } 1273 1274 return true;1305 || bfd_bwrite (location, count, abfd) != count) 1306 return FALSE; 1307 } 1308 1309 return TRUE; 1275 1310 } 1276 1311 … … 1278 1313 /* Read the external symbols from an a.out file. */ 1279 1314 1280 static b oolean1315 static bfd_boolean 1281 1316 aout_get_external_symbols (abfd) 1282 1317 bfd *abfd; … … 1286 1321 bfd_size_type count; 1287 1322 struct external_nlist *syms; 1323 bfd_size_type amt; 1288 1324 1289 1325 count = exec_hdr (abfd)->a_syms / EXTERNAL_NLIST_SIZE; 1290 1326 1291 1327 #ifdef USE_MMAP 1292 if ( bfd_get_file_window (abfd,1293 obj_sym_filepos (abfd),exec_hdr (abfd)->a_syms,1294 &obj_aout_sym_window (abfd), true) == false)1295 return false;1328 if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), 1329 exec_hdr (abfd)->a_syms, 1330 &obj_aout_sym_window (abfd), TRUE)) 1331 return FALSE; 1296 1332 syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; 1297 1333 #else … … 1300 1336 possible to free them. */ 1301 1337 syms = ((struct external_nlist *) 1302 bfd_malloc ( (size_t)count * EXTERNAL_NLIST_SIZE));1338 bfd_malloc (count * EXTERNAL_NLIST_SIZE)); 1303 1339 if (syms == (struct external_nlist *) NULL && count != 0) 1304 return false; 1305 1340 return FALSE; 1341 1342 amt = exec_hdr (abfd)->a_syms; 1306 1343 if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 1307 || (bfd_read (syms, 1, exec_hdr (abfd)->a_syms, abfd) 1308 != exec_hdr (abfd)->a_syms)) 1344 || bfd_bread (syms, amt, abfd) != amt) 1309 1345 { 1310 1346 free (syms); 1311 return false;1347 return FALSE; 1312 1348 } 1313 1349 #endif … … 1323 1359 bfd_size_type stringsize; 1324 1360 char *strings; 1361 bfd_size_type amt = BYTES_IN_WORD; 1325 1362 1326 1363 /* Get the size of the strings. */ 1327 1364 if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 1328 || (bfd_read ((PTR) string_chars, BYTES_IN_WORD, 1, abfd) 1329 != BYTES_IN_WORD)) 1330 return false; 1365 || bfd_bread ((PTR) string_chars, amt, abfd) != amt) 1366 return FALSE; 1331 1367 stringsize = GET_WORD (abfd, string_chars); 1332 1368 1333 1369 #ifdef USE_MMAP 1334 if ( bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize,1335 &obj_aout_string_window (abfd), true) == false)1336 return false;1370 if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize, 1371 &obj_aout_string_window (abfd), TRUE)) 1372 return FALSE; 1337 1373 strings = (char *) obj_aout_string_window (abfd).data; 1338 1374 #else 1339 strings = (char *) bfd_malloc ( (size_t)stringsize + 1);1375 strings = (char *) bfd_malloc (stringsize + 1); 1340 1376 if (strings == NULL) 1341 return false;1377 return FALSE; 1342 1378 1343 1379 /* Skip space for the string count in the buffer for convenience 1344 1380 when using indexes. */ 1345 if (bfd_read (strings + BYTES_IN_WORD, 1, stringsize - BYTES_IN_WORD, 1346 abfd) 1347 != stringsize - BYTES_IN_WORD) 1381 amt = stringsize - BYTES_IN_WORD; 1382 if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt) 1348 1383 { 1349 1384 free (strings); 1350 return false;1385 return FALSE; 1351 1386 } 1352 1387 #endif … … 1361 1396 } 1362 1397 1363 return true;1398 return TRUE; 1364 1399 } 1365 1400 … … 1369 1404 symbol->flags and symbol->section, and adjusting symbol->value. */ 1370 1405 1371 static b oolean1406 static bfd_boolean 1372 1407 translate_from_native_sym_flags (abfd, cache_ptr) 1373 1408 bfd *abfd; … … 1382 1417 1383 1418 /* This is a debugging symbol. */ 1384 1385 1419 cache_ptr->symbol.flags = BSF_DEBUGGING; 1386 1420 … … 1407 1441 cache_ptr->symbol.value -= sec->vma; 1408 1442 1409 return true;1443 return TRUE; 1410 1444 } 1411 1445 … … 1476 1510 arelent_chain *reloc; 1477 1511 asection *into_section; 1512 bfd_size_type amt; 1478 1513 1479 1514 /* This is a set symbol. The name of the symbol is the name … … 1492 1527 char *copy; 1493 1528 1494 copy = bfd_alloc (abfd, strlen (cache_ptr->symbol.name) + 1); 1529 amt = strlen (cache_ptr->symbol.name) + 1; 1530 copy = bfd_alloc (abfd, amt); 1495 1531 if (copy == NULL) 1496 return false;1532 return FALSE; 1497 1533 1498 1534 strcpy (copy, cache_ptr->symbol.name); 1499 1535 section = bfd_make_section (abfd, copy); 1500 1536 if (section == NULL) 1501 return false;1537 return FALSE; 1502 1538 } 1503 1539 1504 reloc = (arelent_chain *) bfd_alloc (abfd, sizeof (arelent_chain)); 1540 amt = sizeof (arelent_chain); 1541 reloc = (arelent_chain *) bfd_alloc (abfd, amt); 1505 1542 if (reloc == NULL) 1506 return false;1543 return FALSE; 1507 1544 1508 1545 /* Build a relocation entry for the constructor. */ … … 1547 1584 section->_raw_size += BYTES_IN_WORD; 1548 1585 1549 reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd);1586 reloc->relent.howto = CTOR_TABLE_RELOC_HOWTO (abfd); 1550 1587 1551 1588 #endif /* 0 */ … … 1617 1654 } 1618 1655 1619 return true;1656 return TRUE; 1620 1657 } 1621 1658 1622 1659 /* Set the fields of SYM_POINTER according to CACHE_PTR. */ 1623 1660 1624 static b oolean1661 static bfd_boolean 1625 1662 translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) 1626 1663 bfd *abfd; … … 1648 1685 cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*")); 1649 1686 bfd_set_error (bfd_error_nonrepresentable_section); 1650 return false;1687 return FALSE; 1651 1688 } 1652 1689 … … 1673 1710 else 1674 1711 { 1675 (*_bfd_error_handler) 1676 (_("%s: can not represent section `%s' in a.out object file format"), 1677 bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); 1678 bfd_set_error (bfd_error_nonrepresentable_section); 1679 return false; 1680 } 1681 1682 /* Turn the symbol from section relative to absolute again */ 1712 if (aout_section_merge_with_text_p (abfd, sec)) 1713 sym_pointer->e_type[0] |= N_TEXT; 1714 else 1715 { 1716 (*_bfd_error_handler) 1717 (_("%s: can not represent section `%s' in a.out object file format"), 1718 bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); 1719 bfd_set_error (bfd_error_nonrepresentable_section); 1720 return FALSE; 1721 } 1722 } 1723 1724 /* Turn the symbol from section relative to absolute again. */ 1683 1725 value += sec->vma + off; 1684 1726 … … 1696 1738 { 1697 1739 int type = ((aout_symbol_type *) cache_ptr)->type; 1740 1698 1741 switch (type) 1699 1742 { … … 1722 1765 } 1723 1766 1724 PUT_WORD (abfd, value, sym_pointer->e_value);1725 1726 return true;1767 PUT_WORD (abfd, value, sym_pointer->e_value); 1768 1769 return TRUE; 1727 1770 } 1728 1771 … … 1734 1777 bfd *abfd; 1735 1778 { 1736 aout_symbol_type *new =1737 (aout_symbol_type *)bfd_zalloc (abfd, sizeof (aout_symbol_type));1779 bfd_size_type amt = sizeof (aout_symbol_type); 1780 aout_symbol_type *new = (aout_symbol_type *) bfd_zalloc (abfd, amt); 1738 1781 if (!new) 1739 1782 return NULL; … … 1745 1788 /* Translate a set of internal symbols into external symbols. */ 1746 1789 1747 b oolean1790 bfd_boolean 1748 1791 NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) 1749 1792 bfd *abfd; … … 1753 1796 char *str; 1754 1797 bfd_size_type strsize; 1755 b oolean dynamic;1798 bfd_boolean dynamic; 1756 1799 { 1757 1800 struct external_nlist *ext_end; … … 1775 1818 in->symbol.name = str + x; 1776 1819 else 1777 return false;1820 return FALSE; 1778 1821 1779 1822 in->symbol.value = GET_SWORD (abfd, ext->e_value); 1780 in->desc = bfd_h_get_16 (abfd, ext->e_desc);1781 in->other = bfd_h_get_8 (abfd, ext->e_other);1782 in->type = bfd_h_get_8 (abfd, ext->e_type);1823 in->desc = H_GET_16 (abfd, ext->e_desc); 1824 in->other = H_GET_8 (abfd, ext->e_other); 1825 in->type = H_GET_8 (abfd, ext->e_type); 1783 1826 in->symbol.udata.p = NULL; 1784 1827 1785 1828 if (! translate_from_native_sym_flags (abfd, in)) 1786 return false;1829 return FALSE; 1787 1830 1788 1831 if (dynamic) … … 1790 1833 } 1791 1834 1792 return true;1835 return TRUE; 1793 1836 } 1794 1837 … … 1797 1840 hold them all plus all the cached symbol entries. */ 1798 1841 1799 b oolean1842 bfd_boolean 1800 1843 NAME(aout,slurp_symbol_table) (abfd) 1801 1844 bfd *abfd; … … 1803 1846 struct external_nlist *old_external_syms; 1804 1847 aout_symbol_type *cached; 1805 size_tcached_size;1806 1807 /* If there's no work to be done, don't do any */1848 bfd_size_type cached_size; 1849 1850 /* If there's no work to be done, don't do any. */ 1808 1851 if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) 1809 return true;1852 return TRUE; 1810 1853 1811 1854 old_external_syms = obj_aout_external_syms (abfd); 1812 1855 1813 1856 if (! aout_get_external_symbols (abfd)) 1814 return false;1815 1816 cached_size = (obj_aout_external_sym_count (abfd)1817 * sizeof (aout_symbol_type));1818 cached = (aout_symbol_type *) bfd_ malloc (cached_size);1857 return FALSE; 1858 1859 cached_size = obj_aout_external_sym_count (abfd); 1860 cached_size *= sizeof (aout_symbol_type); 1861 cached = (aout_symbol_type *) bfd_zmalloc (cached_size); 1819 1862 if (cached == NULL && cached_size != 0) 1820 return false; 1821 if (cached_size != 0) 1822 memset (cached, 0, cached_size); 1863 return FALSE; 1823 1864 1824 1865 /* Convert from external symbol information to internal. */ … … 1829 1870 obj_aout_external_strings (abfd), 1830 1871 obj_aout_external_string_size (abfd), 1831 false)))1872 FALSE))) 1832 1873 { 1833 1874 free (cached); 1834 return false;1875 return FALSE; 1835 1876 } 1836 1877 … … 1854 1895 } 1855 1896 1856 return true;1897 return TRUE; 1857 1898 } 1858 1899 … … 1868 1909 1869 1910 static bfd_size_type add_to_stringtab 1870 PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, boolean)); 1871 static boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *)); 1911 PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean)); 1912 static bfd_boolean emit_stringtab 1913 PARAMS ((bfd *, struct bfd_strtab_hash *)); 1872 1914 1873 1915 /* Get the index of a string in a strtab, adding it if it is not … … 1879 1921 struct bfd_strtab_hash *tab; 1880 1922 const char *str; 1881 b oolean copy;1882 { 1883 b oolean hash;1923 bfd_boolean copy; 1924 { 1925 bfd_boolean hash; 1884 1926 bfd_size_type index; 1885 1927 … … 1890 1932 /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx 1891 1933 doesn't understand a hashed string table. */ 1892 hash = true;1934 hash = TRUE; 1893 1935 if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) 1894 hash = false;1936 hash = FALSE; 1895 1937 1896 1938 index = _bfd_stringtab_add (tab, str, hash, copy); … … 1909 1951 file. */ 1910 1952 1911 static b oolean1953 static bfd_boolean 1912 1954 emit_stringtab (abfd, tab) 1913 1955 register bfd *abfd; … … 1915 1957 { 1916 1958 bfd_byte buffer[BYTES_IN_WORD]; 1959 bfd_size_type amt = BYTES_IN_WORD; 1917 1960 1918 1961 /* The string table starts with the size. */ 1919 1962 PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); 1920 if (bfd_ write ((PTR) buffer, 1, BYTES_IN_WORD, abfd) != BYTES_IN_WORD)1921 return false;1963 if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt) 1964 return FALSE; 1922 1965 1923 1966 return _bfd_stringtab_emit (abfd, tab); … … 1925 1968 1926 1969 1927 b oolean1970 bfd_boolean 1928 1971 NAME(aout,write_syms) (abfd) 1929 1972 bfd *abfd; … … 1935 1978 strtab = _bfd_stringtab_init (); 1936 1979 if (strtab == NULL) 1937 return false;1980 return FALSE; 1938 1981 1939 1982 for (count = 0; count < bfd_get_symcount (abfd); count++) … … 1942 1985 bfd_size_type indx; 1943 1986 struct external_nlist nsp; 1944 1945 indx = add_to_stringtab (abfd, strtab, g->name, false); 1987 bfd_size_type amt; 1988 1989 indx = add_to_stringtab (abfd, strtab, g->name, FALSE); 1946 1990 if (indx == (bfd_size_type) -1) 1947 1991 goto error_return; 1948 1992 PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx); 1949 1993 1950 if (bfd_asymbol_flavour (g) == abfd->xvec->flavour)1994 if (bfd_asymbol_flavour (g) == abfd->xvec->flavour) 1951 1995 { 1952 bfd_h_put_16(abfd, aout_symbol(g)->desc, nsp.e_desc);1953 bfd_h_put_8(abfd, aout_symbol(g)->other,nsp.e_other);1954 bfd_h_put_8(abfd, aout_symbol(g)->type, nsp.e_type);1996 H_PUT_16 (abfd, aout_symbol (g)->desc, nsp.e_desc); 1997 H_PUT_8 (abfd, aout_symbol (g)->other, nsp.e_other); 1998 H_PUT_8 (abfd, aout_symbol (g)->type, nsp.e_type); 1955 1999 } 1956 2000 else 1957 2001 { 1958 bfd_h_put_16(abfd,0, nsp.e_desc);1959 bfd_h_put_8(abfd, 0, nsp.e_other);1960 bfd_h_put_8(abfd, 0, nsp.e_type);2002 H_PUT_16 (abfd, 0, nsp.e_desc); 2003 H_PUT_8 (abfd, 0, nsp.e_other); 2004 H_PUT_8 (abfd, 0, nsp.e_type); 1961 2005 } 1962 2006 … … 1964 2008 goto error_return; 1965 2009 1966 if (bfd_write((PTR)&nsp,1,EXTERNAL_NLIST_SIZE, abfd)1967 != EXTERNAL_NLIST_SIZE)2010 amt = EXTERNAL_NLIST_SIZE; 2011 if (bfd_bwrite ((PTR) &nsp, amt, abfd) != amt) 1968 2012 goto error_return; 1969 2013 … … 1978 2022 _bfd_stringtab_free (strtab); 1979 2023 1980 return true;2024 return TRUE; 1981 2025 1982 2026 error_return: 1983 2027 _bfd_stringtab_free (strtab); 1984 return false;2028 return FALSE; 1985 2029 } 1986 2030 … … 1997 2041 return -1; 1998 2042 1999 for (symbase = obj_aout_symbols(abfd); counter++ < bfd_get_symcount (abfd);) 2000 *(location++) = (asymbol *) ( symbase++); 2043 for (symbase = obj_aout_symbols (abfd); 2044 counter++ < bfd_get_symcount (abfd); 2045 ) 2046 *(location++) = (asymbol *) (symbase++); 2001 2047 *location++ =0; 2002 2048 return bfd_get_symcount (abfd); … … 2004 2050 2005 2051 2006 /* Standard reloc stuff */2052 /* Standard reloc stuff. */ 2007 2053 /* Output standard relocation information to a file in target byte order. */ 2008 2054 … … 2024 2070 asection *output_section = sym->section->output_section; 2025 2071 2026 PUT_WORD (abfd, g->address, natptr->r_address);2027 2028 r_length = g->howto->size ; /* Size as a power of two */2029 r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */2072 PUT_WORD (abfd, g->address, natptr->r_address); 2073 2074 r_length = g->howto->size ; /* Size as a power of two. */ 2075 r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ 2030 2076 /* XXX This relies on relocs coming from a.out files. */ 2031 2077 r_baserel = (g->howto->type & 8) != 0; … … 2038 2084 #endif 2039 2085 2040 /* name was clobbered by aout_write_syms to be symbol index*/2086 /* Name was clobbered by aout_write_syms to be symbol index. */ 2041 2087 2042 2088 /* If this relocation is relative to a symbol then set the … … 2045 2091 Absolute symbols can come in in two ways, either as an offset 2046 2092 from the abs section, or as a symbol which has an abs value. 2047 check for that here 2048 */ 2093 check for that here. */ 2049 2094 2050 2095 if (bfd_is_com_section (output_section) … … 2053 2098 { 2054 2099 if (bfd_abs_section_ptr->symbol == sym) 2055 2056 /* Whoops, looked like an abs symbol, but is really an offset2057 from the abs section*/2058 r_index = N_ABS;2059 r_extern = 0;2060 2100 { 2101 /* Whoops, looked like an abs symbol, but is 2102 really an offset from the abs section. */ 2103 r_index = N_ABS; 2104 r_extern = 0; 2105 } 2061 2106 else 2062 { 2063 /* Fill in symbol */ 2064 r_extern = 1; 2065 r_index = (*(g->sym_ptr_ptr))->KEEPIT; 2066 2067 } 2107 { 2108 /* Fill in symbol. */ 2109 r_extern = 1; 2110 r_index = (*(g->sym_ptr_ptr))->KEEPIT; 2111 } 2068 2112 } 2069 2113 else 2070 2114 { 2071 /* Just an ordinary section */2115 /* Just an ordinary section. */ 2072 2116 r_extern = 0; 2073 2117 r_index = output_section->target_index; 2074 2118 } 2075 2119 2076 /* now the fun stuff */ 2077 if (bfd_header_big_endian (abfd)) { 2120 /* Now the fun stuff. */ 2121 if (bfd_header_big_endian (abfd)) 2122 { 2078 2123 natptr->r_index[0] = r_index >> 16; 2079 2124 natptr->r_index[1] = r_index >> 8; 2080 2125 natptr->r_index[2] = r_index; 2081 natptr->r_type[0] = 2082 (r_extern? RELOC_STD_BITS_EXTERN_BIG: 0)2083 | (r_pcrel? RELOC_STD_BITS_PCREL_BIG: 0)2084 | (r_baserel? RELOC_STD_BITS_BASEREL_BIG: 0)2085 | (r_jmptable? RELOC_STD_BITS_JMPTABLE_BIG: 0)2086 | (r_relative? RELOC_STD_BITS_RELATIVE_BIG: 0)2087 | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG); 2088 } else {2089 natptr->r_index[2] = r_index >> 16; 2090 natptr->r_index[1] = r_index >> 8;2091 natptr->r_index[0] = r_index;2092 natptr->r_type[0] = 2093 (r_extern? RELOC_STD_BITS_EXTERN_LITTLE: 0)2094 | (r_pcrel? RELOC_STD_BITS_PCREL_LITTLE: 0)2095 | (r_baserel? RELOC_STD_BITS_BASEREL_LITTLE: 0)2096 | (r_jmptable? RELOC_STD_BITS_JMPTABLE_LITTLE: 0)2097 | (r_relative? RELOC_STD_BITS_RELATIVE_LITTLE: 0)2098 | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE);2099 2100 } 2101 2102 /* Extended stuff */2126 natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0) 2127 | (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0) 2128 | (r_baserel ? RELOC_STD_BITS_BASEREL_BIG : 0) 2129 | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_BIG : 0) 2130 | (r_relative ? RELOC_STD_BITS_RELATIVE_BIG : 0) 2131 | (r_length << RELOC_STD_BITS_LENGTH_SH_BIG)); 2132 } 2133 else 2134 { 2135 natptr->r_index[2] = r_index >> 16; 2136 natptr->r_index[1] = r_index >> 8; 2137 natptr->r_index[0] = r_index; 2138 natptr->r_type[0] = ((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0) 2139 | (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0) 2140 | (r_baserel ? RELOC_STD_BITS_BASEREL_LITTLE : 0) 2141 | (r_jmptable ? RELOC_STD_BITS_JMPTABLE_LITTLE : 0) 2142 | (r_relative ? RELOC_STD_BITS_RELATIVE_LITTLE : 0) 2143 | (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE)); 2144 } 2145 } 2146 2147 /* Extended stuff. */ 2103 2148 /* Output extended relocation information to a file in target byte order. */ 2104 2149 … … 2115 2160 int r_extern; 2116 2161 unsigned int r_type; 2117 unsigned intr_addend;2162 bfd_vma r_addend; 2118 2163 asymbol *sym = *(g->sym_ptr_ptr); 2119 2164 asection *output_section = sym->section->output_section; … … 2133 2178 from the abs section, or as a symbol which has an abs value. 2134 2179 check for that here. */ 2135 2136 2180 if (bfd_is_abs_section (bfd_get_section (sym))) 2137 2181 { … … 2150 2194 else 2151 2195 { 2152 /* Just an ordinary section */2196 /* Just an ordinary section. */ 2153 2197 r_extern = 0; 2154 2198 r_index = output_section->target_index; 2155 2199 } 2156 2200 2157 /* now the fun stuff */ 2158 if (bfd_header_big_endian (abfd)) { 2159 natptr->r_index[0] = r_index >> 16; 2160 natptr->r_index[1] = r_index >> 8; 2161 natptr->r_index[2] = r_index; 2162 natptr->r_type[0] = 2163 ((r_extern? RELOC_EXT_BITS_EXTERN_BIG: 0) 2164 | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG)); 2165 } else { 2166 natptr->r_index[2] = r_index >> 16; 2167 natptr->r_index[1] = r_index >> 8; 2168 natptr->r_index[0] = r_index; 2169 natptr->r_type[0] = 2170 (r_extern? RELOC_EXT_BITS_EXTERN_LITTLE: 0) 2171 | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE); 2172 } 2201 /* Now the fun stuff. */ 2202 if (bfd_header_big_endian (abfd)) 2203 { 2204 natptr->r_index[0] = r_index >> 16; 2205 natptr->r_index[1] = r_index >> 8; 2206 natptr->r_index[2] = r_index; 2207 natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_BIG : 0) 2208 | (r_type << RELOC_EXT_BITS_TYPE_SH_BIG)); 2209 } 2210 else 2211 { 2212 natptr->r_index[2] = r_index >> 16; 2213 natptr->r_index[1] = r_index >> 8; 2214 natptr->r_index[0] = r_index; 2215 natptr->r_type[0] = ((r_extern ? RELOC_EXT_BITS_EXTERN_LITTLE : 0) 2216 | (r_type << RELOC_EXT_BITS_TYPE_SH_LITTLE)); 2217 } 2173 2218 2174 2219 PUT_WORD (abfd, r_addend, natptr->r_addend); … … 2181 2226 Aout keeps all it's symbols based from zero, so the symbol would 2182 2227 contain 60. This macro subs the base of each section from the value 2183 to give the true offset from the section */ 2184 2185 #define MOVE_ADDRESS(ad) \ 2186 if (r_extern) { \ 2187 /* undefined symbol */ \ 2188 cache_ptr->sym_ptr_ptr = symbols + r_index; \ 2189 cache_ptr->addend = ad; \ 2190 } else { \ 2191 /* defined, section relative. replace symbol with pointer to \ 2192 symbol which points to section */ \ 2193 switch (r_index) { \ 2194 case N_TEXT: \ 2195 case N_TEXT | N_EXT: \ 2196 cache_ptr->sym_ptr_ptr = obj_textsec(abfd)->symbol_ptr_ptr; \ 2197 cache_ptr->addend = ad - su->textsec->vma; \ 2198 break; \ 2199 case N_DATA: \ 2200 case N_DATA | N_EXT: \ 2201 cache_ptr->sym_ptr_ptr = obj_datasec(abfd)->symbol_ptr_ptr; \ 2202 cache_ptr->addend = ad - su->datasec->vma; \ 2203 break; \ 2204 case N_BSS: \ 2205 case N_BSS | N_EXT: \ 2206 cache_ptr->sym_ptr_ptr = obj_bsssec(abfd)->symbol_ptr_ptr; \ 2207 cache_ptr->addend = ad - su->bsssec->vma; \ 2208 break; \ 2209 default: \ 2210 case N_ABS: \ 2211 case N_ABS | N_EXT: \ 2212 cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ 2228 to give the true offset from the section. */ 2229 2230 #define MOVE_ADDRESS(ad) \ 2231 if (r_extern) \ 2232 { \ 2233 /* Undefined symbol. */ \ 2234 cache_ptr->sym_ptr_ptr = symbols + r_index; \ 2213 2235 cache_ptr->addend = ad; \ 2214 break; \2215 2236 } \ 2216 } \ 2237 else \ 2238 { \ 2239 /* Defined, section relative. Replace symbol with pointer to \ 2240 symbol which points to section. */ \ 2241 switch (r_index) \ 2242 { \ 2243 case N_TEXT: \ 2244 case N_TEXT | N_EXT: \ 2245 cache_ptr->sym_ptr_ptr = obj_textsec (abfd)->symbol_ptr_ptr; \ 2246 cache_ptr->addend = ad - su->textsec->vma; \ 2247 break; \ 2248 case N_DATA: \ 2249 case N_DATA | N_EXT: \ 2250 cache_ptr->sym_ptr_ptr = obj_datasec (abfd)->symbol_ptr_ptr; \ 2251 cache_ptr->addend = ad - su->datasec->vma; \ 2252 break; \ 2253 case N_BSS: \ 2254 case N_BSS | N_EXT: \ 2255 cache_ptr->sym_ptr_ptr = obj_bsssec (abfd)->symbol_ptr_ptr; \ 2256 cache_ptr->addend = ad - su->bsssec->vma; \ 2257 break; \ 2258 default: \ 2259 case N_ABS: \ 2260 case N_ABS | N_EXT: \ 2261 cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; \ 2262 cache_ptr->addend = ad; \ 2263 break; \ 2264 } \ 2265 } 2217 2266 2218 2267 void … … 2231 2280 cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); 2232 2281 2233 /* now the fun stuff */ 2234 if (bfd_header_big_endian (abfd)) { 2235 r_index = (bytes->r_index[0] << 16) 2236 | (bytes->r_index[1] << 8) 2237 | bytes->r_index[2]; 2238 r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); 2239 r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) 2240 >> RELOC_EXT_BITS_TYPE_SH_BIG; 2241 } else { 2242 r_index = (bytes->r_index[2] << 16) 2243 | (bytes->r_index[1] << 8) 2244 | bytes->r_index[0]; 2245 r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); 2246 r_type = (bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) 2247 >> RELOC_EXT_BITS_TYPE_SH_LITTLE; 2248 } 2282 /* Now the fun stuff. */ 2283 if (bfd_header_big_endian (abfd)) 2284 { 2285 r_index = (((unsigned int) bytes->r_index[0] << 16) 2286 | ((unsigned int) bytes->r_index[1] << 8) 2287 | bytes->r_index[2]); 2288 r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); 2289 r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_BIG) 2290 >> RELOC_EXT_BITS_TYPE_SH_BIG); 2291 } 2292 else 2293 { 2294 r_index = (((unsigned int) bytes->r_index[2] << 16) 2295 | ((unsigned int) bytes->r_index[1] << 8) 2296 | bytes->r_index[0]); 2297 r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); 2298 r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE) 2299 >> RELOC_EXT_BITS_TYPE_SH_LITTLE); 2300 } 2249 2301 2250 2302 cache_ptr->howto = howto_table_ext + r_type; … … 2253 2305 regardless of the setting of r_extern. r_extern just reflects 2254 2306 whether the symbol the reloc is against is local or global. */ 2255 if (r_type == RELOC_BASE102256 || r_type == RELOC_BASE132257 || r_type == RELOC_BASE22)2307 if (r_type == (unsigned int) RELOC_BASE10 2308 || r_type == (unsigned int) RELOC_BASE13 2309 || r_type == (unsigned int) RELOC_BASE22) 2258 2310 r_extern = 1; 2259 2311 … … 2266 2318 } 2267 2319 2268 MOVE_ADDRESS (GET_SWORD(abfd, bytes->r_addend));2320 MOVE_ADDRESS (GET_SWORD (abfd, bytes->r_addend)); 2269 2321 } 2270 2322 … … 2285 2337 unsigned int howto_idx; 2286 2338 2287 cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address); 2288 2289 /* now the fun stuff */ 2290 if (bfd_header_big_endian (abfd)) { 2291 r_index = (bytes->r_index[0] << 16) 2292 | (bytes->r_index[1] << 8) 2293 | bytes->r_index[2]; 2294 r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); 2295 r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); 2296 r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); 2297 r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); 2298 r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); 2299 r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) 2300 >> RELOC_STD_BITS_LENGTH_SH_BIG; 2301 } else { 2302 r_index = (bytes->r_index[2] << 16) 2303 | (bytes->r_index[1] << 8) 2304 | bytes->r_index[0]; 2305 r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); 2306 r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); 2307 r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); 2308 r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); 2309 r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE)); 2310 r_length = (bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) 2311 >> RELOC_STD_BITS_LENGTH_SH_LITTLE; 2312 } 2313 2314 howto_idx = r_length + 4 * r_pcrel + 8 * r_baserel 2315 + 16 * r_jmptable + 32 * r_relative; 2339 cache_ptr->address = H_GET_32 (abfd, bytes->r_address); 2340 2341 /* Now the fun stuff. */ 2342 if (bfd_header_big_endian (abfd)) 2343 { 2344 r_index = (((unsigned int) bytes->r_index[0] << 16) 2345 | ((unsigned int) bytes->r_index[1] << 8) 2346 | bytes->r_index[2]); 2347 r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); 2348 r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); 2349 r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_BIG)); 2350 r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_BIG)); 2351 r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_BIG)); 2352 r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) 2353 >> RELOC_STD_BITS_LENGTH_SH_BIG); 2354 } 2355 else 2356 { 2357 r_index = (((unsigned int) bytes->r_index[2] << 16) 2358 | ((unsigned int) bytes->r_index[1] << 8) 2359 | bytes->r_index[0]); 2360 r_extern = (0 != (bytes->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); 2361 r_pcrel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); 2362 r_baserel = (0 != (bytes->r_type[0] & RELOC_STD_BITS_BASEREL_LITTLE)); 2363 r_jmptable= (0 != (bytes->r_type[0] & RELOC_STD_BITS_JMPTABLE_LITTLE)); 2364 r_relative= (0 != (bytes->r_type[0] & RELOC_STD_BITS_RELATIVE_LITTLE)); 2365 r_length = ((bytes->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) 2366 >> RELOC_STD_BITS_LENGTH_SH_LITTLE); 2367 } 2368 2369 howto_idx = (r_length + 4 * r_pcrel + 8 * r_baserel 2370 + 16 * r_jmptable + 32 * r_relative); 2316 2371 BFD_ASSERT (howto_idx < TABLE_SIZE (howto_table_std)); 2317 2372 cache_ptr->howto = howto_table_std + howto_idx; … … 2332 2387 } 2333 2388 2334 MOVE_ADDRESS (0);2389 MOVE_ADDRESS (0); 2335 2390 } 2336 2391 2337 2392 /* Read and swap the relocs for a section. */ 2338 2393 2339 b oolean2394 bfd_boolean 2340 2395 NAME(aout,slurp_reloc_table) (abfd, asect, symbols) 2341 2396 bfd *abfd; … … 2343 2398 asymbol **symbols; 2344 2399 { 2345 unsigned intcount;2400 bfd_size_type count; 2346 2401 bfd_size_type reloc_size; 2347 2402 PTR relocs; … … 2350 2405 unsigned int counter = 0; 2351 2406 arelent *cache_ptr; 2407 bfd_size_type amt; 2352 2408 2353 2409 if (asect->relocation) 2354 return true;2410 return TRUE; 2355 2411 2356 2412 if (asect->flags & SEC_CONSTRUCTOR) 2357 return true;2413 return TRUE; 2358 2414 2359 2415 if (asect == obj_datasec (abfd)) 2360 reloc_size = exec_hdr (abfd)->a_drsize;2416 reloc_size = exec_hdr (abfd)->a_drsize; 2361 2417 else if (asect == obj_textsec (abfd)) 2362 reloc_size = exec_hdr (abfd)->a_trsize;2418 reloc_size = exec_hdr (abfd)->a_trsize; 2363 2419 else if (asect == obj_bsssec (abfd)) 2364 2420 reloc_size = 0; … … 2366 2422 { 2367 2423 bfd_set_error (bfd_error_invalid_operation); 2368 return false;2424 return FALSE; 2369 2425 } 2370 2426 2371 2427 if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) 2372 return false;2428 return FALSE; 2373 2429 2374 2430 each_size = obj_reloc_entry_size (abfd); … … 2376 2432 count = reloc_size / each_size; 2377 2433 2378 reloc_cache = (arelent *) bfd_malloc ((size_t) (count * sizeof (arelent))); 2434 amt = count * sizeof (arelent); 2435 reloc_cache = (arelent *) bfd_zmalloc (amt); 2379 2436 if (reloc_cache == NULL && count != 0) 2380 return false; 2381 memset (reloc_cache, 0, count * sizeof (arelent)); 2382 2383 relocs = bfd_malloc ((size_t) reloc_size); 2437 return FALSE; 2438 2439 relocs = bfd_malloc (reloc_size); 2384 2440 if (relocs == NULL && reloc_size != 0) 2385 2441 { 2386 2442 free (reloc_cache); 2387 return false;2388 } 2389 2390 if (bfd_ read (relocs, 1, reloc_size, abfd) != reloc_size)2443 return FALSE; 2444 } 2445 2446 if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) 2391 2447 { 2392 2448 free (relocs); 2393 2449 free (reloc_cache); 2394 return false;2450 return FALSE; 2395 2451 } 2396 2452 … … 2398 2454 if (each_size == RELOC_EXT_SIZE) 2399 2455 { 2400 register struct reloc_ext_external *rptr = 2401 (struct reloc_ext_external *) relocs; 2456 struct reloc_ext_external *rptr = (struct reloc_ext_external *) relocs; 2402 2457 2403 2458 for (; counter < count; counter++, rptr++, cache_ptr++) 2404 2459 MY_swap_ext_reloc_in (abfd, rptr, cache_ptr, symbols, 2405 bfd_get_symcount (abfd));2460 (bfd_size_type) bfd_get_symcount (abfd)); 2406 2461 } 2407 2462 else 2408 2463 { 2409 register struct reloc_std_external *rptr = 2410 (struct reloc_std_external *) relocs; 2464 struct reloc_std_external *rptr = (struct reloc_std_external *) relocs; 2411 2465 2412 2466 for (; counter < count; counter++, rptr++, cache_ptr++) 2413 2467 MY_swap_std_reloc_in (abfd, rptr, cache_ptr, symbols, 2414 bfd_get_symcount (abfd));2468 (bfd_size_type) bfd_get_symcount (abfd)); 2415 2469 } 2416 2470 … … 2420 2474 asect->reloc_count = cache_ptr - reloc_cache; 2421 2475 2422 return true;2476 return TRUE; 2423 2477 } 2424 2478 2425 2479 /* Write out a relocation section into an object file. */ 2426 2480 2427 b oolean2481 bfd_boolean 2428 2482 NAME(aout,squirt_out_relocs) (abfd, section) 2429 2483 bfd *abfd; … … 2435 2489 2436 2490 unsigned int count = section->reloc_count; 2437 size_tnatsize;2491 bfd_size_type natsize; 2438 2492 2439 2493 if (count == 0 || section->orelocation == NULL) 2440 return true;2494 return TRUE; 2441 2495 2442 2496 each_size = obj_reloc_entry_size (abfd); 2443 natsize = each_size * count;2497 natsize = (bfd_size_type) each_size * count; 2444 2498 native = (unsigned char *) bfd_zalloc (abfd, natsize); 2445 2499 if (!native) 2446 return false;2500 return FALSE; 2447 2501 2448 2502 generic = section->orelocation; … … 2461 2515 count != 0; 2462 2516 --count, natptr += each_size, ++generic) 2463 MY_swap_std_reloc_out(abfd, *generic, (struct reloc_std_external *)natptr); 2464 } 2465 2466 if ( bfd_write ((PTR) native, 1, natsize, abfd) != natsize) { 2467 bfd_release(abfd, native); 2468 return false; 2469 } 2517 MY_swap_std_reloc_out (abfd, *generic, 2518 (struct reloc_std_external *) natptr); 2519 } 2520 2521 if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) 2522 { 2523 bfd_release (abfd, native); 2524 return FALSE; 2525 } 2470 2526 bfd_release (abfd, native); 2471 2527 2472 return true; 2473 } 2474 2475 /* This is stupid. This function should be a boolean predicate */ 2528 return TRUE; 2529 } 2530 2531 /* This is stupid. This function should be a boolean predicate. */ 2532 2476 2533 long 2477 2534 NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) … … 2493 2550 return -1; 2494 2551 2495 if (section->flags & SEC_CONSTRUCTOR) { 2496 arelent_chain *chain = section->constructor_chain; 2497 for (count = 0; count < section->reloc_count; count ++) { 2498 *relptr ++ = &chain->relent; 2499 chain = chain->next; 2500 } 2501 } 2502 else { 2503 tblptr = section->relocation; 2504 2505 for (count = 0; count++ < section->reloc_count;) 2506 { 2507 *relptr++ = tblptr++; 2508 } 2509 } 2552 if (section->flags & SEC_CONSTRUCTOR) 2553 { 2554 arelent_chain *chain = section->constructor_chain; 2555 for (count = 0; count < section->reloc_count; count ++) 2556 { 2557 *relptr ++ = &chain->relent; 2558 chain = chain->next; 2559 } 2560 } 2561 else 2562 { 2563 tblptr = section->relocation; 2564 2565 for (count = 0; count++ < section->reloc_count; ) 2566 { 2567 *relptr++ = tblptr++; 2568 } 2569 } 2510 2570 *relptr = 0; 2511 2571 … … 2518 2578 sec_ptr asect; 2519 2579 { 2520 if (bfd_get_format (abfd) != bfd_object) { 2521 bfd_set_error (bfd_error_invalid_operation); 2522 return -1; 2523 } 2524 if (asect->flags & SEC_CONSTRUCTOR) { 2580 if (bfd_get_format (abfd) != bfd_object) 2581 { 2582 bfd_set_error (bfd_error_invalid_operation); 2583 return -1; 2584 } 2585 2586 if (asect->flags & SEC_CONSTRUCTOR) 2525 2587 return (sizeof (arelent *) * (asect->reloc_count+1)); 2526 }2527 2588 2528 2589 if (asect == obj_datasec (abfd)) 2529 2590 return (sizeof (arelent *) 2530 * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd))2591 * ((exec_hdr (abfd)->a_drsize / obj_reloc_entry_size (abfd)) 2531 2592 + 1)); 2532 2593 2533 2594 if (asect == obj_textsec (abfd)) 2534 2595 return (sizeof (arelent *) 2535 * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd))2596 * ((exec_hdr (abfd)->a_trsize / obj_reloc_entry_size (abfd)) 2536 2597 + 1)); 2537 2598 … … 2557 2618 } 2558 2619 2559 2620 alent * 2560 2621 NAME(aout,get_lineno) (ignore_abfd, ignore_symbol) 2561 2622 bfd *ignore_abfd ATTRIBUTE_UNUSED; … … 2575 2636 if (ret->type == '?') 2576 2637 { 2577 int type_code = aout_symbol (symbol)->type & 0xff;2638 int type_code = aout_symbol (symbol)->type & 0xff; 2578 2639 const char *stab_name = bfd_get_stab_name (type_code); 2579 2640 static char buf[10]; … … 2586 2647 ret->type = '-'; 2587 2648 ret->stab_type = type_code; 2588 ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff);2589 ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff);2649 ret->stab_other = (unsigned) (aout_symbol (symbol)->other & 0xff); 2650 ret->stab_desc = (unsigned) (aout_symbol (symbol)->desc & 0xffff); 2590 2651 ret->stab_name = stab_name; 2591 2652 } … … 2593 2654 2594 2655 void 2595 NAME(aout,print_symbol) ( ignore_abfd, afile, symbol, how)2596 bfd * ignore_abfd ATTRIBUTE_UNUSED;2656 NAME(aout,print_symbol) (abfd, afile, symbol, how) 2657 bfd *abfd; 2597 2658 PTR afile; 2598 2659 asymbol *symbol; … … 2601 2662 FILE *file = (FILE *)afile; 2602 2663 2603 switch (how) { 2604 case bfd_print_symbol_name: 2605 if (symbol->name) 2606 fprintf (file,"%s", symbol->name); 2607 break; 2608 case bfd_print_symbol_more: 2609 fprintf (file,"%4x %2x %2x",(unsigned) (aout_symbol(symbol)->desc & 0xffff), 2610 (unsigned) (aout_symbol(symbol)->other & 0xff), 2611 (unsigned) (aout_symbol(symbol)->type)); 2612 break; 2613 case bfd_print_symbol_all: 2614 { 2615 CONST char *section_name = symbol->section->name; 2616 2617 bfd_print_symbol_vandf((PTR)file,symbol); 2618 2619 fprintf (file," %-5s %04x %02x %02x", 2620 section_name, 2621 (unsigned) (aout_symbol(symbol)->desc & 0xffff), 2622 (unsigned) (aout_symbol(symbol)->other & 0xff), 2623 (unsigned) (aout_symbol(symbol)->type & 0xff)); 2664 switch (how) 2665 { 2666 case bfd_print_symbol_name: 2624 2667 if (symbol->name) 2625 fprintf (file," %s", symbol->name); 2626 } 2627 break; 2628 } 2668 fprintf (file,"%s", symbol->name); 2669 break; 2670 case bfd_print_symbol_more: 2671 fprintf (file,"%4x %2x %2x", 2672 (unsigned) (aout_symbol (symbol)->desc & 0xffff), 2673 (unsigned) (aout_symbol (symbol)->other & 0xff), 2674 (unsigned) (aout_symbol (symbol)->type)); 2675 break; 2676 case bfd_print_symbol_all: 2677 { 2678 const char *section_name = symbol->section->name; 2679 2680 bfd_print_symbol_vandf (abfd, (PTR)file, symbol); 2681 2682 fprintf (file," %-5s %04x %02x %02x", 2683 section_name, 2684 (unsigned) (aout_symbol (symbol)->desc & 0xffff), 2685 (unsigned) (aout_symbol (symbol)->other & 0xff), 2686 (unsigned) (aout_symbol (symbol)->type & 0xff)); 2687 if (symbol->name) 2688 fprintf (file," %s", symbol->name); 2689 } 2690 break; 2691 } 2629 2692 } 2630 2693 … … 2641 2704 NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) 2642 2705 bfd *abfd; 2643 b oolean dynamic;2706 bfd_boolean dynamic; 2644 2707 PTR *minisymsp; 2645 2708 unsigned int *sizep; … … 2677 2740 NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) 2678 2741 bfd *abfd; 2679 b oolean dynamic;2742 bfd_boolean dynamic; 2680 2743 const PTR minisym; 2681 2744 asymbol *sym; … … 2695 2758 obj_aout_external_strings (abfd), 2696 2759 obj_aout_external_string_size (abfd), 2697 false)))2760 FALSE))) 2698 2761 return NULL; 2699 2762 … … 2701 2764 } 2702 2765 2703 /* 2704 provided a BFD, a section and an offset into the section, calculate 2705 and return the name of the source file and the line nearest to the 2706 wanted location. 2707 */ 2708 2709 boolean 2766 /* Provided a BFD, a section and an offset into the section, calculate 2767 and return the name of the source file and the line nearest to the 2768 wanted location. */ 2769 2770 bfd_boolean 2710 2771 NAME(aout,find_nearest_line) 2711 2772 (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) … … 2714 2775 asymbol **symbols; 2715 2776 bfd_vma offset; 2716 CONSTchar **filename_ptr;2717 CONSTchar **functionname_ptr;2777 const char **filename_ptr; 2778 const char **functionname_ptr; 2718 2779 unsigned int *line_ptr; 2719 2780 { 2720 /* Run down the file looking for the filename, function and linenumber */2781 /* Run down the file looking for the filename, function and linenumber. */ 2721 2782 asymbol **p; 2722 CONSTchar *directory_name = NULL;2723 CONSTchar *main_file_name = NULL;2724 CONSTchar *current_file_name = NULL;2725 CONSTchar *line_file_name = NULL; /* Value of current_file_name at line number. */2726 CONSTchar *line_directory_name = NULL; /* Value of directory_name at line number. */2783 const char *directory_name = NULL; 2784 const char *main_file_name = NULL; 2785 const char *current_file_name = NULL; 2786 const char *line_file_name = NULL; /* Value of current_file_name at line number. */ 2787 const char *line_directory_name = NULL; /* Value of directory_name at line number. */ 2727 2788 bfd_vma low_line_vma = 0; 2728 2789 bfd_vma low_func_vma = 0; 2729 2790 asymbol *func = 0; 2730 size_tfilelen, funclen;2791 bfd_size_type filelen, funclen; 2731 2792 char *buf; 2732 2793 … … 2734 2795 *functionname_ptr = 0; 2735 2796 *line_ptr = 0; 2736 if (symbols != (asymbol **)NULL) { 2737 for (p = symbols; *p; p++) { 2738 aout_symbol_type *q = (aout_symbol_type *) (*p); 2739 next: 2740 switch (q->type){ 2741 case N_TEXT: 2742 /* If this looks like a file name symbol, and it comes after 2743 the line number we have found so far, but before the 2744 offset, then we have probably not found the right line 2745 number. */ 2746 if (q->symbol.value <= offset 2747 && ((q->symbol.value > low_line_vma 2748 && (line_file_name != NULL 2749 || *line_ptr != 0)) 2750 || (q->symbol.value > low_func_vma 2751 && func != NULL))) 2752 { 2753 const char *symname; 2754 2755 symname = q->symbol.name; 2756 if (strcmp (symname + strlen (symname) - 2, ".o") == 0) 2797 2798 if (symbols != (asymbol **)NULL) 2799 { 2800 for (p = symbols; *p; p++) 2801 { 2802 aout_symbol_type *q = (aout_symbol_type *) (*p); 2803 next: 2804 switch (q->type) 2805 { 2806 case N_TEXT: 2807 /* If this looks like a file name symbol, and it comes after 2808 the line number we have found so far, but before the 2809 offset, then we have probably not found the right line 2810 number. */ 2811 if (q->symbol.value <= offset 2812 && ((q->symbol.value > low_line_vma 2813 && (line_file_name != NULL 2814 || *line_ptr != 0)) 2815 || (q->symbol.value > low_func_vma 2816 && func != NULL))) 2817 { 2818 const char *symname; 2819 2820 symname = q->symbol.name; 2821 if (strcmp (symname + strlen (symname) - 2, ".o") == 0) 2822 { 2823 if (q->symbol.value > low_line_vma) 2824 { 2825 *line_ptr = 0; 2826 line_file_name = NULL; 2827 } 2828 if (q->symbol.value > low_func_vma) 2829 func = NULL; 2830 } 2831 } 2832 break; 2833 2834 case N_SO: 2835 /* If this symbol is less than the offset, but greater than 2836 the line number we have found so far, then we have not 2837 found the right line number. */ 2838 if (q->symbol.value <= offset) 2839 { 2840 if (q->symbol.value > low_line_vma) 2841 { 2842 *line_ptr = 0; 2843 line_file_name = NULL; 2844 } 2845 if (q->symbol.value > low_func_vma) 2846 func = NULL; 2847 } 2848 2849 main_file_name = current_file_name = q->symbol.name; 2850 /* Look ahead to next symbol to check if that too is an N_SO. */ 2851 p++; 2852 if (*p == NULL) 2853 break; 2854 q = (aout_symbol_type *) (*p); 2855 if (q->type != (int)N_SO) 2856 goto next; 2857 2858 /* Found a second N_SO First is directory; second is filename. */ 2859 directory_name = current_file_name; 2860 main_file_name = current_file_name = q->symbol.name; 2861 if (obj_textsec (abfd) != section) 2862 goto done; 2863 break; 2864 case N_SOL: 2865 current_file_name = q->symbol.name; 2866 break; 2867 2868 case N_SLINE: 2869 2870 case N_DSLINE: 2871 case N_BSLINE: 2872 /* We'll keep this if it resolves nearer than the one we have 2873 already. */ 2874 if (q->symbol.value >= low_line_vma 2875 && q->symbol.value <= offset) 2876 { 2877 *line_ptr = q->desc; 2878 low_line_vma = q->symbol.value; 2879 line_file_name = current_file_name; 2880 line_directory_name = directory_name; 2881 } 2882 break; 2883 case N_FUN: 2757 2884 { 2758 if (q->symbol.value > low_line_vma) 2885 /* We'll keep this if it is nearer than the one we have already. */ 2886 if (q->symbol.value >= low_func_vma && 2887 q->symbol.value <= offset) 2759 2888 { 2760 *line_ptr = 0;2761 line_file_name = NULL;2889 low_func_vma = q->symbol.value; 2890 func = (asymbol *)q; 2762 2891 } 2763 if (q->symbol.value > low_func_vma)2764 func = NULL;2892 else if (q->symbol.value > offset) 2893 goto done; 2765 2894 } 2766 } 2767 break; 2768 2769 case N_SO: 2770 /* If this symbol is less than the offset, but greater than 2771 the line number we have found so far, then we have not 2772 found the right line number. */ 2773 if (q->symbol.value <= offset) 2774 { 2775 if (q->symbol.value > low_line_vma) 2776 { 2777 *line_ptr = 0; 2778 line_file_name = NULL; 2779 } 2780 if (q->symbol.value > low_func_vma) 2781 func = NULL; 2782 } 2783 2784 main_file_name = current_file_name = q->symbol.name; 2785 /* Look ahead to next symbol to check if that too is an N_SO. */ 2786 p++; 2787 if (*p == NULL) 2788 break; 2789 q = (aout_symbol_type *) (*p); 2790 if (q->type != (int)N_SO) 2791 goto next; 2792 2793 /* Found a second N_SO First is directory; second is filename. */ 2794 directory_name = current_file_name; 2795 main_file_name = current_file_name = q->symbol.name; 2796 if (obj_textsec(abfd) != section) 2797 goto done; 2798 break; 2799 case N_SOL: 2800 current_file_name = q->symbol.name; 2801 break; 2802 2803 case N_SLINE: 2804 2805 case N_DSLINE: 2806 case N_BSLINE: 2807 /* We'll keep this if it resolves nearer than the one we have 2808 already. */ 2809 if (q->symbol.value >= low_line_vma 2810 && q->symbol.value <= offset) 2811 { 2812 *line_ptr = q->desc; 2813 low_line_vma = q->symbol.value; 2814 line_file_name = current_file_name; 2815 line_directory_name = directory_name; 2816 } 2817 break; 2818 case N_FUN: 2819 { 2820 /* We'll keep this if it is nearer than the one we have already */ 2821 if (q->symbol.value >= low_func_vma && 2822 q->symbol.value <= offset) { 2823 low_func_vma = q->symbol.value; 2824 func = (asymbol *)q; 2825 } 2826 else if (q->symbol.value > offset) 2827 goto done; 2895 break; 2896 } 2828 2897 } 2829 break; 2830 } 2831 } 2832 } 2898 } 2833 2899 2834 2900 done: … … 2845 2911 else 2846 2912 filelen = strlen (directory_name) + strlen (main_file_name); 2913 2847 2914 if (func == NULL) 2848 2915 funclen = 0; … … 2852 2919 if (adata (abfd).line_buf != NULL) 2853 2920 free (adata (abfd).line_buf); 2921 2854 2922 if (filelen + funclen == 0) 2855 2923 adata (abfd).line_buf = buf = NULL; … … 2859 2927 adata (abfd).line_buf = buf; 2860 2928 if (buf == NULL) 2861 return false;2929 return FALSE; 2862 2930 } 2863 2931 … … 2877 2945 { 2878 2946 const char *function = func->name; 2879 char * p;2947 char *colon; 2880 2948 2881 2949 /* The caller expects a symbol name. We actually have a … … 2889 2957 strcpy (buf + 1, function); 2890 2958 } 2891 /* Have to remove : stuff */2892 p= strchr (buf, ':');2893 if ( p!= NULL)2894 * p= '\0';2959 /* Have to remove : stuff. */ 2960 colon = strchr (buf, ':'); 2961 if (colon != NULL) 2962 *colon = '\0'; 2895 2963 *functionname_ptr = buf; 2896 2964 } 2897 2965 2898 return true;2966 return TRUE; 2899 2967 } 2900 2968 … … 2902 2970 NAME(aout,sizeof_headers) (abfd, execable) 2903 2971 bfd *abfd; 2904 b oolean execable ATTRIBUTE_UNUSED;2905 { 2906 return adata (abfd).exec_bytes_size;2972 bfd_boolean execable ATTRIBUTE_UNUSED; 2973 { 2974 return adata (abfd).exec_bytes_size; 2907 2975 } 2908 2976 … … 2910 2978 read it again later if we need it. */ 2911 2979 2912 b oolean2980 bfd_boolean 2913 2981 NAME(aout,bfd_free_cached_info) (abfd) 2914 2982 bfd *abfd; … … 2918 2986 if (bfd_get_format (abfd) != bfd_object 2919 2987 || abfd->tdata.aout_data == NULL) 2920 return true;2988 return TRUE; 2921 2989 2922 2990 #define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; } … … 2935 3003 #undef BFCI_FREE 2936 3004 2937 return true;3005 return TRUE; 2938 3006 } 2939 3007 … … 2941 3009 /* a.out link code. */ 2942 3010 2943 static b oolean aout_link_add_object_symbols3011 static bfd_boolean aout_link_add_object_symbols 2944 3012 PARAMS ((bfd *, struct bfd_link_info *)); 2945 static boolean aout_link_check_archive_element 2946 PARAMS ((bfd *, struct bfd_link_info *, boolean *)); 2947 static boolean aout_link_free_symbols PARAMS ((bfd *)); 2948 static boolean aout_link_check_ar_symbols 2949 PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); 2950 static boolean aout_link_add_symbols 3013 static bfd_boolean aout_link_check_archive_element 3014 PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); 3015 static bfd_boolean aout_link_free_symbols 3016 PARAMS ((bfd *)); 3017 static bfd_boolean aout_link_check_ar_symbols 3018 PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); 3019 static bfd_boolean aout_link_add_symbols 2951 3020 PARAMS ((bfd *, struct bfd_link_info *)); 2952 3021 … … 2976 3045 { 2977 3046 /* Set local fields. */ 2978 ret->written = false;3047 ret->written = FALSE; 2979 3048 ret->indx = -1; 2980 3049 } … … 2985 3054 /* Initialize an a.out link hash table. */ 2986 3055 2987 b oolean3056 bfd_boolean 2988 3057 NAME(aout,link_hash_table_init) (table, abfd, newfunc) 2989 3058 struct aout_link_hash_table *table; 2990 3059 bfd *abfd; 2991 struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *,2992 2993 3060 struct bfd_hash_entry *(*newfunc) 3061 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, 3062 const char *)); 2994 3063 { 2995 3064 return _bfd_link_hash_table_init (&table->root, abfd, newfunc); … … 3003 3072 { 3004 3073 struct aout_link_hash_table *ret; 3005 3006 ret = ((struct aout_link_hash_table *) 3007 bfd_alloc (abfd, sizeof (struct aout_link_hash_table)));3074 bfd_size_type amt = sizeof (struct aout_link_hash_table); 3075 3076 ret = (struct aout_link_hash_table *) bfd_malloc (amt); 3008 3077 if (ret == NULL) 3009 3078 return (struct bfd_link_hash_table *) NULL; 3079 3010 3080 if (! NAME(aout,link_hash_table_init) (ret, abfd, 3011 3081 NAME(aout,link_hash_newfunc))) … … 3020 3090 appropriate. */ 3021 3091 3022 b oolean3092 bfd_boolean 3023 3093 NAME(aout,link_add_symbols) (abfd, info) 3024 3094 bfd *abfd; … … 3034 3104 default: 3035 3105 bfd_set_error (bfd_error_wrong_format); 3036 return false;3106 return FALSE; 3037 3107 } 3038 3108 } … … 3040 3110 /* Add symbols from an a.out object file. */ 3041 3111 3042 static b oolean3112 static bfd_boolean 3043 3113 aout_link_add_object_symbols (abfd, info) 3044 3114 bfd *abfd; … … 3046 3116 { 3047 3117 if (! aout_get_external_symbols (abfd)) 3048 return false;3118 return FALSE; 3049 3119 if (! aout_link_add_symbols (abfd, info)) 3050 return false;3120 return FALSE; 3051 3121 if (! info->keep_memory) 3052 3122 { 3053 3123 if (! aout_link_free_symbols (abfd)) 3054 return false;3055 } 3056 return true;3124 return FALSE; 3125 } 3126 return TRUE; 3057 3127 } 3058 3128 … … 3062 3132 _bfd_generic_link_add_archive_symbols. */ 3063 3133 3064 static b oolean3134 static bfd_boolean 3065 3135 aout_link_check_archive_element (abfd, info, pneeded) 3066 3136 bfd *abfd; 3067 3137 struct bfd_link_info *info; 3068 b oolean *pneeded;3138 bfd_boolean *pneeded; 3069 3139 { 3070 3140 if (! aout_get_external_symbols (abfd)) 3071 return false;3141 return FALSE; 3072 3142 3073 3143 if (! aout_link_check_ar_symbols (abfd, info, pneeded)) 3074 return false;3144 return FALSE; 3075 3145 3076 3146 if (*pneeded) 3077 3147 { 3078 3148 if (! aout_link_add_symbols (abfd, info)) 3079 return false;3149 return FALSE; 3080 3150 } 3081 3151 … … 3083 3153 { 3084 3154 if (! aout_link_free_symbols (abfd)) 3085 return false;3086 } 3087 3088 return true;3155 return FALSE; 3156 } 3157 3158 return TRUE; 3089 3159 } 3090 3160 3091 3161 /* Free up the internal symbols read from an a.out file. */ 3092 3162 3093 static b oolean3163 static bfd_boolean 3094 3164 aout_link_free_symbols (abfd) 3095 3165 bfd *abfd; … … 3113 3183 obj_aout_external_strings (abfd) = (char *) NULL; 3114 3184 } 3115 return true;3185 return TRUE; 3116 3186 } 3117 3187 … … 3123 3193 (unless there is some other reason to include it). */ 3124 3194 3125 static b oolean3195 static bfd_boolean 3126 3196 aout_link_check_ar_symbols (abfd, info, pneeded) 3127 3197 bfd *abfd; 3128 3198 struct bfd_link_info *info; 3129 b oolean *pneeded;3199 bfd_boolean *pneeded; 3130 3200 { 3131 3201 register struct external_nlist *p; … … 3133 3203 char *strings; 3134 3204 3135 *pneeded = false;3205 *pneeded = FALSE; 3136 3206 3137 3207 /* Look through all the symbols. */ … … 3141 3211 for (; p < pend; p++) 3142 3212 { 3143 int type = bfd_h_get_8 (abfd, p->e_type);3213 int type = H_GET_8 (abfd, p->e_type); 3144 3214 const char *name; 3145 3215 struct bfd_link_hash_entry *h; … … 3163 3233 3164 3234 name = strings + GET_WORD (abfd, p->e_strx); 3165 h = bfd_link_hash_lookup (info->hash, name, false, false, true);3235 h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); 3166 3236 3167 3237 /* We are only interested in symbols that are currently … … 3184 3254 /* This object file defines this symbol. We must link it 3185 3255 in. This is true regardless of whether the current 3186 definition of the symbol is undefined or common. If the 3187 current definition is common, we have a case in which we 3188 have already seen an object file including 3256 definition of the symbol is undefined or common. 3257 3258 If the current definition is common, we have a case in 3259 which we have already seen an object file including: 3189 3260 int a; 3190 and this object file from the archive includes 3261 and this object file from the archive includes: 3191 3262 int a = 5; 3192 In such a case we must include this object file. 3263 In such a case, whether to include this object is target 3264 dependant for backward compatability. 3193 3265 3194 3266 FIXME: The SunOS 4.1.3 linker will pull in the archive 3195 3267 element if the symbol is defined in the .data section, 3196 3268 but not if it is defined in the .text section. That 3197 seems a bit crazy to me, and I haven't implemented it. 3198 However, it might be correct. */ 3269 seems a bit crazy to me, and it has not been implemented 3270 yet. However, it might be correct. */ 3271 if (h->type == bfd_link_hash_common) 3272 { 3273 int skip = 0; 3274 3275 switch (info->common_skip_ar_aymbols) 3276 { 3277 case bfd_link_common_skip_text: 3278 skip = (type == (N_TEXT | N_EXT)); 3279 break; 3280 case bfd_link_common_skip_data: 3281 skip = (type == (N_DATA | N_EXT)); 3282 break; 3283 default: 3284 case bfd_link_common_skip_all: 3285 skip = 1; 3286 break; 3287 } 3288 3289 if (skip) 3290 continue; 3291 } 3292 3199 3293 if (! (*info->callbacks->add_archive_element) (info, abfd, name)) 3200 return false;3201 *pneeded = true;3202 return true;3294 return FALSE; 3295 *pneeded = TRUE; 3296 return TRUE; 3203 3297 } 3204 3298 … … 3227 3321 abfd, 3228 3322 name)) 3229 return false;3230 *pneeded = true;3231 return true;3323 return FALSE; 3324 *pneeded = TRUE; 3325 return TRUE; 3232 3326 } 3233 3327 /* Turn the current link symbol into a common … … 3238 3332 sizeof (struct bfd_link_hash_common_entry))); 3239 3333 if (h->u.c.p == NULL) 3240 return false;3334 return FALSE; 3241 3335 3242 3336 h->u.c.size = value; … … 3275 3369 { 3276 3370 if (! (*info->callbacks->add_archive_element) (info, abfd, name)) 3277 return false;3278 *pneeded = true;3279 return true;3371 return FALSE; 3372 *pneeded = TRUE; 3373 return TRUE; 3280 3374 } 3281 3375 } … … 3283 3377 3284 3378 /* We do not need this object file. */ 3285 return true;3379 return TRUE; 3286 3380 } 3287 3381 3288 3382 /* Add all symbols from an object file to the hash table. */ 3289 3383 3290 static b oolean3384 static bfd_boolean 3291 3385 aout_link_add_symbols (abfd, info) 3292 3386 bfd *abfd; 3293 3387 struct bfd_link_info *info; 3294 3388 { 3295 boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *, 3296 const char *, flagword, asection *, 3297 bfd_vma, const char *, boolean, 3298 boolean, 3299 struct bfd_link_hash_entry **)); 3389 bfd_boolean (*add_one_symbol) 3390 PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, 3391 bfd_vma, const char *, bfd_boolean, bfd_boolean, 3392 struct bfd_link_hash_entry **)); 3300 3393 struct external_nlist *syms; 3301 3394 bfd_size_type sym_count; 3302 3395 char *strings; 3303 b oolean copy;3396 bfd_boolean copy; 3304 3397 struct aout_link_hash_entry **sym_hash; 3305 3398 register struct external_nlist *p; 3306 3399 struct external_nlist *pend; 3400 bfd_size_type amt; 3307 3401 3308 3402 syms = obj_aout_external_syms (abfd); … … 3310 3404 strings = obj_aout_external_strings (abfd); 3311 3405 if (info->keep_memory) 3312 copy = false;3406 copy = FALSE; 3313 3407 else 3314 copy = true;3408 copy = TRUE; 3315 3409 3316 3410 if (aout_backend_info (abfd)->add_dynamic_symbols != NULL) … … 3318 3412 if (! ((*aout_backend_info (abfd)->add_dynamic_symbols) 3319 3413 (abfd, info, &syms, &sym_count, &strings))) 3320 return false;3414 return FALSE; 3321 3415 } 3322 3416 … … 3325 3419 table, but keeping the list is more efficient. Perhaps this 3326 3420 should be conditional on info->keep_memory. */ 3327 sym_hash = ((struct aout_link_hash_entry **) 3328 bfd_alloc (abfd, 3329 ((size_t) sym_count 3330 * sizeof (struct aout_link_hash_entry *)))); 3421 amt = sym_count * sizeof (struct aout_link_hash_entry *); 3422 sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt); 3331 3423 if (sym_hash == NULL && sym_count != 0) 3332 return false;3424 return FALSE; 3333 3425 obj_aout_sym_hashes (abfd) = sym_hash; 3334 3426 … … 3350 3442 *sym_hash = NULL; 3351 3443 3352 type = bfd_h_get_8 (abfd, p->e_type);3444 type = H_GET_8 (abfd, p->e_type); 3353 3445 3354 3446 /* Ignore debugging symbols. */ … … 3476 3568 3477 3569 if (! ((*add_one_symbol) 3478 (info, abfd, name, flags, section, value, string, copy, false,3570 (info, abfd, name, flags, section, value, string, copy, FALSE, 3479 3571 (struct bfd_link_hash_entry **) sym_hash))) 3480 return false;3572 return FALSE; 3481 3573 3482 3574 /* Restrict the maximum alignment of a common symbol based on … … 3504 3596 } 3505 3597 3506 return true;3598 return TRUE; 3507 3599 } 3508 3600 … … 3535 3627 /* Look up an entry in an the header file hash table. */ 3536 3628 3537 #define aout_link_includes_lookup(table, string, create, copy) 3538 ((struct aout_link_includes_entry *) 3629 #define aout_link_includes_lookup(table, string, create, copy) \ 3630 ((struct aout_link_includes_entry *) \ 3539 3631 bfd_hash_lookup (&(table)->root, (string), (create), (copy))) 3540 3632 … … 3568 3660 static struct bfd_hash_entry *aout_link_includes_newfunc 3569 3661 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); 3570 static b oolean aout_link_input_bfd3662 static bfd_boolean aout_link_input_bfd 3571 3663 PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); 3572 static b oolean aout_link_write_symbols3664 static bfd_boolean aout_link_write_symbols 3573 3665 PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); 3574 static b oolean aout_link_write_other_symbol3666 static bfd_boolean aout_link_write_other_symbol 3575 3667 PARAMS ((struct aout_link_hash_entry *, PTR)); 3576 static b oolean aout_link_input_section3668 static bfd_boolean aout_link_input_section 3577 3669 PARAMS ((struct aout_final_link_info *, bfd *input_bfd, 3578 3670 asection *input_section, file_ptr *reloff_ptr, 3579 3671 bfd_size_type rel_size)); 3580 static b oolean aout_link_input_section_std3672 static bfd_boolean aout_link_input_section_std 3581 3673 PARAMS ((struct aout_final_link_info *, bfd *input_bfd, 3582 3674 asection *input_section, struct reloc_std_external *, 3583 3675 bfd_size_type rel_size, bfd_byte *contents)); 3584 static b oolean aout_link_input_section_ext3676 static bfd_boolean aout_link_input_section_ext 3585 3677 PARAMS ((struct aout_final_link_info *, bfd *input_bfd, 3586 3678 asection *input_section, struct reloc_ext_external *, … … 3588 3680 static INLINE asection *aout_reloc_index_to_section 3589 3681 PARAMS ((bfd *, int)); 3590 static b oolean aout_link_reloc_link_order3682 static bfd_boolean aout_link_reloc_link_order 3591 3683 PARAMS ((struct aout_final_link_info *, asection *, 3592 3684 struct bfd_link_order *)); … … 3631 3723 the output section. */ 3632 3724 3633 b oolean3725 bfd_boolean 3634 3726 NAME(aout,final_link) (abfd, info, callback) 3635 3727 bfd *abfd; … … 3638 3730 { 3639 3731 struct aout_final_link_info aout_info; 3640 b oolean includes_hash_initialized = false;3732 bfd_boolean includes_hash_initialized = FALSE; 3641 3733 register bfd *sub; 3642 3734 bfd_size_type trsize, drsize; 3643 size_tmax_contents_size;3644 size_tmax_relocs_size;3645 size_tmax_sym_count;3735 bfd_size_type max_contents_size; 3736 bfd_size_type max_relocs_size; 3737 bfd_size_type max_sym_count; 3646 3738 bfd_size_type text_size; 3647 3739 file_ptr text_end; 3648 3740 register struct bfd_link_order *p; 3649 3741 asection *o; 3650 b oolean have_link_order_relocs;3742 bfd_boolean have_link_order_relocs; 3651 3743 3652 3744 if (info->shared) … … 3664 3756 251)) 3665 3757 goto error_return; 3666 includes_hash_initialized = true;3758 includes_hash_initialized = TRUE; 3667 3759 3668 3760 /* Figure out the largest section size. Also, if generating … … 3675 3767 for (sub = info->input_bfds; sub != NULL; sub = sub->link_next) 3676 3768 { 3677 size_tsz;3769 bfd_size_type sz; 3678 3770 3679 3771 if (info->relocateable) … … 3787 3879 3788 3880 h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", 3789 false, false, false);3881 FALSE, FALSE, FALSE); 3790 3882 if (h != NULL) 3791 3883 aout_link_write_other_symbol (h, &aout_info); … … 3814 3906 whether we have already handled it. */ 3815 3907 for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) 3816 sub->output_has_begun = false;3908 sub->output_has_begun = FALSE; 3817 3909 3818 3910 /* Mark all sections which are to be included in the link. This … … 3823 3915 { 3824 3916 for (p = o->link_order_head; p != NULL; p = p->next) 3825 { 3826 if (p->type == bfd_indirect_link_order) 3827 p->u.indirect.section->linker_mark = true; 3828 } 3829 } 3830 3831 have_link_order_relocs = false; 3917 if (p->type == bfd_indirect_link_order) 3918 p->u.indirect.section->linker_mark = TRUE; 3919 } 3920 3921 have_link_order_relocs = FALSE; 3832 3922 for (o = abfd->sections; o != (asection *) NULL; o = o->next) 3833 3923 { … … 3847 3937 if (! aout_link_input_bfd (&aout_info, input_bfd)) 3848 3938 goto error_return; 3849 input_bfd->output_has_begun = true;3939 input_bfd->output_has_begun = TRUE; 3850 3940 } 3851 3941 } … … 3854 3944 { 3855 3945 /* These are handled below. */ 3856 have_link_order_relocs = true;3946 have_link_order_relocs = TRUE; 3857 3947 } 3858 3948 else … … 3914 4004 { 3915 4005 bfd_hash_table_free (&aout_info.includes.root); 3916 includes_hash_initialized = false;4006 includes_hash_initialized = FALSE; 3917 4007 } 3918 4008 … … 3944 4034 { 3945 4035 bfd_byte b; 4036 file_ptr pos; 3946 4037 3947 4038 b = 0; 3948 if (bfd_seek (abfd, 3949 (obj_datasec (abfd)->filepos 3950 + exec_hdr (abfd)->a_data 3951 - 1), 3952 SEEK_SET) != 0 3953 || bfd_write (&b, 1, 1, abfd) != 1) 4039 pos = obj_datasec (abfd)->filepos + exec_hdr (abfd)->a_data - 1; 4040 if (bfd_seek (abfd, pos, SEEK_SET) != 0 4041 || bfd_bwrite (&b, (bfd_size_type) 1, abfd) != 1) 3954 4042 goto error_return; 3955 4043 } 3956 4044 3957 return true;4045 return TRUE; 3958 4046 3959 4047 error_return: … … 3968 4056 if (includes_hash_initialized) 3969 4057 bfd_hash_table_free (&aout_info.includes.root); 3970 return false;4058 return FALSE; 3971 4059 } 3972 4060 3973 4061 /* Link an a.out input BFD into the output file. */ 3974 4062 3975 static b oolean4063 static bfd_boolean 3976 4064 aout_link_input_bfd (finfo, input_bfd) 3977 4065 struct aout_final_link_info *finfo; … … 3991 4079 3992 4080 /* Get the symbols. We probably have them already, unless 3993 finfo->info->keep_memory is false. */4081 finfo->info->keep_memory is FALSE. */ 3994 4082 if (! aout_get_external_symbols (input_bfd)) 3995 return false;4083 return FALSE; 3996 4084 3997 4085 sym_count = obj_aout_external_sym_count (input_bfd); … … 4000 4088 is placed into finfo->symbol_map. */ 4001 4089 if (! aout_link_write_symbols (finfo, input_bfd)) 4002 return false;4090 return FALSE; 4003 4091 4004 4092 /* Relocate and write out the sections. These functions use the … … 4012 4100 &finfo->treloff, 4013 4101 exec_hdr (input_bfd)->a_trsize)) 4014 return false;4102 return FALSE; 4015 4103 } 4016 4104 if (obj_datasec (input_bfd)->linker_mark) … … 4020 4108 &finfo->dreloff, 4021 4109 exec_hdr (input_bfd)->a_drsize)) 4022 return false;4110 return FALSE; 4023 4111 } 4024 4112 … … 4029 4117 { 4030 4118 if (! aout_link_free_symbols (input_bfd)) 4031 return false;4032 } 4033 4034 return true;4119 return FALSE; 4120 } 4121 4122 return TRUE; 4035 4123 } 4036 4124 … … 4038 4126 symbol indices into a symbol_map. */ 4039 4127 4040 static b oolean4128 static bfd_boolean 4041 4129 aout_link_write_symbols (finfo, input_bfd) 4042 4130 struct aout_final_link_info *finfo; … … 4054 4142 struct aout_link_hash_entry **sym_hash; 4055 4143 int *symbol_map; 4056 b oolean pass;4057 b oolean skip_next;4144 bfd_boolean pass; 4145 bfd_boolean skip_next; 4058 4146 4059 4147 output_bfd = finfo->output_bfd; … … 4069 4157 && (strip != strip_some 4070 4158 || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename, 4071 false, false) != NULL)4159 FALSE, FALSE) != NULL) 4072 4160 && discard != discard_all) 4073 4161 { 4074 bfd_h_put_8 (output_bfd, N_TEXT, outsym->e_type);4075 bfd_h_put_8 (output_bfd, 0, outsym->e_other);4076 bfd_h_put_16 (output_bfd, (bfd_vma)0, outsym->e_desc);4162 H_PUT_8 (output_bfd, N_TEXT, outsym->e_type); 4163 H_PUT_8 (output_bfd, 0, outsym->e_other); 4164 H_PUT_16 (output_bfd, 0, outsym->e_desc); 4077 4165 strtab_index = add_to_stringtab (output_bfd, finfo->strtab, 4078 input_bfd->filename, false);4166 input_bfd->filename, FALSE); 4079 4167 if (strtab_index == (bfd_size_type) -1) 4080 return false;4168 return FALSE; 4081 4169 PUT_WORD (output_bfd, strtab_index, outsym->e_strx); 4082 4170 PUT_WORD (output_bfd, … … 4089 4177 } 4090 4178 4091 pass = false;4092 skip_next = false;4179 pass = FALSE; 4180 skip_next = FALSE; 4093 4181 sym = obj_aout_external_syms (input_bfd); 4094 4182 sym_end = sym + sym_count; 4095 4183 sym_hash = obj_aout_sym_hashes (input_bfd); 4096 4184 symbol_map = finfo->symbol_map; 4097 memset (symbol_map, 0, sym_count * sizeof *symbol_map);4185 memset (symbol_map, 0, (size_t) sym_count * sizeof *symbol_map); 4098 4186 for (; sym < sym_end; sym++, sym_hash++, symbol_map++) 4099 4187 { … … 4101 4189 int type; 4102 4190 struct aout_link_hash_entry *h; 4103 b oolean skip;4191 bfd_boolean skip; 4104 4192 asection *symsec; 4105 4193 bfd_vma val = 0; 4106 b oolean copy;4194 bfd_boolean copy; 4107 4195 4108 4196 /* We set *symbol_map to 0 above for all symbols. If it has … … 4118 4206 *symbol_map = -1; 4119 4207 4120 type = bfd_h_get_8 (input_bfd, sym->e_type);4208 type = H_GET_8 (input_bfd, sym->e_type); 4121 4209 name = strings + GET_WORD (input_bfd, sym->e_strx); 4122 4210 … … 4128 4216 indirect or warning symbol. */ 4129 4217 val = GET_WORD (input_bfd, sym->e_value); 4130 pass = false;4218 pass = FALSE; 4131 4219 } 4132 4220 else if (skip_next) … … 4135 4223 symbol that we have changed to no longer be an indirect 4136 4224 symbol. */ 4137 skip_next = false;4225 skip_next = FALSE; 4138 4226 continue; 4139 4227 } … … 4150 4238 /* Use the name from the hash table, in case the symbol was 4151 4239 wrapped. */ 4152 if (h != NULL) 4240 if (h != NULL 4241 && h->root.type != bfd_link_hash_warning) 4153 4242 name = h->root.root.string; 4154 4243 … … 4172 4261 /* If the symbol has already been written out, skip it. */ 4173 4262 if (h != (struct aout_link_hash_entry *) NULL 4174 && h->root.type != bfd_link_hash_warning4175 4263 && h->written) 4176 4264 { 4177 4265 if ((type & N_TYPE) == N_INDR 4178 4266 || type == N_WARNING) 4179 skip_next = true;4267 skip_next = TRUE; 4180 4268 *symbol_map = h->indx; 4181 4269 continue; … … 4183 4271 4184 4272 /* See if we are stripping this symbol. */ 4185 skip = false;4273 skip = FALSE; 4186 4274 switch (strip) 4187 4275 { … … 4190 4278 case strip_debugger: 4191 4279 if ((type & N_STAB) != 0) 4192 skip = true;4280 skip = TRUE; 4193 4281 break; 4194 4282 case strip_some: 4195 if (bfd_hash_lookup (finfo->info->keep_hash, name, false, false)4283 if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE) 4196 4284 == NULL) 4197 skip = true;4285 skip = TRUE; 4198 4286 break; 4199 4287 case strip_all: 4200 skip = true;4288 skip = TRUE; 4201 4289 break; 4202 4290 } … … 4204 4292 { 4205 4293 if (h != (struct aout_link_hash_entry *) NULL) 4206 h->written = true;4294 h->written = TRUE; 4207 4295 continue; 4208 4296 } … … 4233 4321 the correct definition so the debugger will 4234 4322 understand it. */ 4235 pass = true;4323 pass = TRUE; 4236 4324 val = GET_WORD (input_bfd, sym->e_value); 4237 4325 symsec = NULL; … … 4249 4337 which is the target of the indirection. */ 4250 4338 if ((type & N_TYPE) == N_INDR) 4251 skip_next = true;4339 skip_next = TRUE; 4252 4340 4253 4341 symsec = NULL; … … 4341 4429 if (h != (struct aout_link_hash_entry *) NULL) 4342 4430 { 4343 h->written = true;4431 h->written = TRUE; 4344 4432 h->indx = obj_aout_external_sym_count (output_bfd); 4345 4433 } … … 4352 4440 { 4353 4441 case discard_none: 4442 case discard_sec_merge: 4354 4443 break; 4355 4444 case discard_l: 4356 4445 if ((type & N_STAB) == 0 4357 4446 && bfd_is_local_label_name (input_bfd, name)) 4358 skip = true;4447 skip = TRUE; 4359 4448 break; 4360 4449 case discard_all: 4361 skip = true;4450 skip = TRUE; 4362 4451 break; 4363 4452 } 4364 4453 if (skip) 4365 4454 { 4366 pass = false;4455 pass = FALSE; 4367 4456 continue; 4368 4457 } … … 4375 4464 numbers in types (the first number after an open 4376 4465 parenthesis). */ 4377 if (type == N_BINCL)4466 if (type == (int) N_BINCL) 4378 4467 { 4379 4468 struct external_nlist *incl_sym; … … 4388 4477 int incl_type; 4389 4478 4390 incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);4391 if (incl_type == N_EINCL)4479 incl_type = H_GET_8 (input_bfd, incl_sym->e_type); 4480 if (incl_type == (int) N_EINCL) 4392 4481 { 4393 4482 if (nest == 0) … … 4395 4484 --nest; 4396 4485 } 4397 else if (incl_type == N_BINCL)4486 else if (incl_type == (int) N_BINCL) 4398 4487 ++nest; 4399 4488 else if (nest == 0) … … 4409 4498 /* Skip the file number. */ 4410 4499 ++s; 4411 while ( isdigit ((unsigned char)*s))4500 while (ISDIGIT (*s)) 4412 4501 ++s; 4413 4502 --s; … … 4420 4509 same value, then replace this one with an N_EXCL 4421 4510 symbol. */ 4422 copy = ! finfo->info->keep_memory;4511 copy = (bfd_boolean) (! finfo->info->keep_memory); 4423 4512 incl_entry = aout_link_includes_lookup (&finfo->includes, 4424 name, true, copy);4513 name, TRUE, copy); 4425 4514 if (incl_entry == NULL) 4426 return false;4515 return FALSE; 4427 4516 for (t = incl_entry->totals; t != NULL; t = t->next) 4428 4517 if (t->total == val) … … 4436 4525 sizeof *t)); 4437 4526 if (t == NULL) 4438 return false;4527 return FALSE; 4439 4528 t->total = val; 4440 4529 t->next = incl_entry->totals; … … 4448 4537 it to be an N_EXCL entry, and mark all the 4449 4538 included symbols to prevent outputting them. */ 4450 type = N_EXCL;4539 type = (int) N_EXCL; 4451 4540 4452 4541 nest = 0; … … 4457 4546 int incl_type; 4458 4547 4459 incl_type = bfd_h_get_8 (input_bfd, incl_sym->e_type);4460 if (incl_type == N_EINCL)4548 incl_type = H_GET_8 (input_bfd, incl_sym->e_type); 4549 if (incl_type == (int) N_EINCL) 4461 4550 { 4462 4551 if (nest == 0) … … 4467 4556 --nest; 4468 4557 } 4469 else if (incl_type == N_BINCL)4558 else if (incl_type == (int) N_BINCL) 4470 4559 ++nest; 4471 4560 else if (nest == 0) … … 4478 4567 /* Copy this symbol into the list of symbols we are going to 4479 4568 write out. */ 4480 bfd_h_put_8 (output_bfd, type, outsym->e_type); 4481 bfd_h_put_8 (output_bfd, bfd_h_get_8 (input_bfd, sym->e_other), 4482 outsym->e_other); 4483 bfd_h_put_16 (output_bfd, bfd_h_get_16 (input_bfd, sym->e_desc), 4484 outsym->e_desc); 4485 copy = false; 4569 H_PUT_8 (output_bfd, type, outsym->e_type); 4570 H_PUT_8 (output_bfd, H_GET_8 (input_bfd, sym->e_other), outsym->e_other); 4571 H_PUT_16 (output_bfd, H_GET_16 (input_bfd, sym->e_desc), outsym->e_desc); 4572 copy = FALSE; 4486 4573 if (! finfo->info->keep_memory) 4487 4574 { … … 4492 4579 name = h->root.root.string; 4493 4580 else 4494 copy = true;4581 copy = TRUE; 4495 4582 } 4496 4583 strtab_index = add_to_stringtab (output_bfd, finfo->strtab, 4497 4584 name, copy); 4498 4585 if (strtab_index == (bfd_size_type) -1) 4499 return false;4586 return FALSE; 4500 4587 PUT_WORD (output_bfd, strtab_index, outsym->e_strx); 4501 4588 PUT_WORD (output_bfd, val, outsym->e_value); … … 4508 4595 if (outsym > finfo->output_syms) 4509 4596 { 4510 bfd_size_type outsym_ count;4597 bfd_size_type outsym_size; 4511 4598 4512 4599 if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) 4513 return false; 4514 outsym_count = outsym - finfo->output_syms; 4515 if (bfd_write ((PTR) finfo->output_syms, 4516 (bfd_size_type) EXTERNAL_NLIST_SIZE, 4517 (bfd_size_type) outsym_count, output_bfd) 4518 != outsym_count * EXTERNAL_NLIST_SIZE) 4519 return false; 4520 finfo->symoff += outsym_count * EXTERNAL_NLIST_SIZE; 4521 } 4522 4523 return true; 4600 return FALSE; 4601 outsym_size = outsym - finfo->output_syms; 4602 outsym_size *= EXTERNAL_NLIST_SIZE; 4603 if (bfd_bwrite ((PTR) finfo->output_syms, outsym_size, output_bfd) 4604 != outsym_size) 4605 return FALSE; 4606 finfo->symoff += outsym_size; 4607 } 4608 4609 return TRUE; 4524 4610 } 4525 4611 … … 4527 4613 object. */ 4528 4614 4529 static b oolean4615 static bfd_boolean 4530 4616 aout_link_write_other_symbol (h, data) 4531 4617 struct aout_link_hash_entry *h; … … 4538 4624 struct external_nlist outsym; 4539 4625 bfd_size_type indx; 4626 bfd_size_type amt; 4627 4628 if (h->root.type == bfd_link_hash_warning) 4629 { 4630 h = (struct aout_link_hash_entry *) h->root.u.i.link; 4631 if (h->root.type == bfd_link_hash_new) 4632 return TRUE; 4633 } 4540 4634 4541 4635 output_bfd = finfo->output_bfd; … … 4552 4646 4553 4647 if (h->written) 4554 return true;4555 4556 h->written = true;4648 return TRUE; 4649 4650 h->written = TRUE; 4557 4651 4558 4652 /* An indx of -2 means the symbol must be written. */ … … 4561 4655 || (finfo->info->strip == strip_some 4562 4656 && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, 4563 false, false) == NULL)))4564 return true;4657 FALSE, FALSE) == NULL))) 4658 return TRUE; 4565 4659 4566 4660 switch (h->root.type) 4567 4661 { 4568 4662 default: 4663 case bfd_link_hash_warning: 4569 4664 abort (); 4570 4665 /* Avoid variable not initialized warnings. */ 4571 return true;4666 return TRUE; 4572 4667 case bfd_link_hash_new: 4573 4668 /* This can happen for set symbols when sets are not being 4574 4669 built. */ 4575 return true;4670 return TRUE; 4576 4671 case bfd_link_hash_undefined: 4577 4672 type = N_UNDF | N_EXT; … … 4608 4703 val = 0; 4609 4704 case bfd_link_hash_indirect: 4610 case bfd_link_hash_warning: 4611 /* FIXME: Ignore these for now. The circumstances under which 4612 they should be written out are not clear to me. */ 4613 return true; 4614 } 4615 4616 bfd_h_put_8 (output_bfd, type, outsym.e_type); 4617 bfd_h_put_8 (output_bfd, 0, outsym.e_other); 4618 bfd_h_put_16 (output_bfd, 0, outsym.e_desc); 4705 /* We ignore these symbols, since the indirected symbol is 4706 already in the hash table. */ 4707 return TRUE; 4708 } 4709 4710 H_PUT_8 (output_bfd, type, outsym.e_type); 4711 H_PUT_8 (output_bfd, 0, outsym.e_other); 4712 H_PUT_16 (output_bfd, 0, outsym.e_desc); 4619 4713 indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, 4620 false);4621 if (indx == (bfd_size_type) -1)4714 FALSE); 4715 if (indx == - (bfd_size_type) 1) 4622 4716 { 4623 4717 /* FIXME: No way to handle errors. */ … … 4627 4721 PUT_WORD (output_bfd, val, outsym.e_value); 4628 4722 4723 amt = EXTERNAL_NLIST_SIZE; 4629 4724 if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0 4630 || bfd_write ((PTR) &outsym, (bfd_size_type) EXTERNAL_NLIST_SIZE, 4631 (bfd_size_type) 1, output_bfd) != EXTERNAL_NLIST_SIZE) 4725 || bfd_bwrite ((PTR) &outsym, amt, output_bfd) != amt) 4632 4726 { 4633 4727 /* FIXME: No way to handle errors. */ … … 4639 4733 ++obj_aout_external_sym_count (output_bfd); 4640 4734 4641 return true;4735 return TRUE; 4642 4736 } 4643 4737 4644 4738 /* Link an a.out section into the output file. */ 4645 4739 4646 static b oolean4740 static bfd_boolean 4647 4741 aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, 4648 4742 rel_size) … … 4661 4755 (PTR) finfo->contents, 4662 4756 (file_ptr) 0, input_size)) 4663 return false;4757 return FALSE; 4664 4758 4665 4759 /* Read in the relocs if we haven't already done it. */ … … 4673 4767 { 4674 4768 if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 4675 || bfd_ read (relocs, 1, rel_size, input_bfd) != rel_size)4676 return false;4769 || bfd_bread (relocs, rel_size, input_bfd) != rel_size) 4770 return FALSE; 4677 4771 } 4678 4772 } … … 4684 4778 (struct reloc_std_external *) relocs, 4685 4779 rel_size, finfo->contents)) 4686 return false;4780 return FALSE; 4687 4781 } 4688 4782 else … … 4691 4785 (struct reloc_ext_external *) relocs, 4692 4786 rel_size, finfo->contents)) 4693 return false;4787 return FALSE; 4694 4788 } 4695 4789 … … 4698 4792 input_section->output_section, 4699 4793 (PTR) finfo->contents, 4700 input_section->output_offset,4794 (file_ptr) input_section->output_offset, 4701 4795 input_size)) 4702 return false;4796 return FALSE; 4703 4797 4704 4798 /* If we are producing relocateable output, the relocs were … … 4707 4801 { 4708 4802 if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) 4709 return false; 4710 if (bfd_write (relocs, (bfd_size_type) 1, rel_size, finfo->output_bfd) 4711 != rel_size) 4712 return false; 4803 return FALSE; 4804 if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) 4805 return FALSE; 4713 4806 *reloff_ptr += rel_size; 4714 4807 … … 4722 4815 } 4723 4816 4724 return true;4817 return TRUE; 4725 4818 } 4726 4819 … … 4752 4845 /* Relocate an a.out section using standard a.out relocs. */ 4753 4846 4754 static b oolean4847 static bfd_boolean 4755 4848 aout_link_input_section_std (finfo, input_bfd, input_section, relocs, 4756 4849 rel_size, contents) … … 4762 4855 bfd_byte *contents; 4763 4856 { 4764 boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, 4765 bfd *, asection *, 4766 struct aout_link_hash_entry *, 4767 PTR, bfd_byte *, boolean *, 4768 bfd_vma *)); 4857 bfd_boolean (*check_dynamic_reloc) 4858 PARAMS ((struct bfd_link_info *, bfd *, asection *, 4859 struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, 4860 bfd_vma *)); 4769 4861 bfd *output_bfd; 4770 b oolean relocateable;4862 bfd_boolean relocateable; 4771 4863 struct external_nlist *syms; 4772 4864 char *strings; … … 4808 4900 4809 4901 #ifdef MY_reloc_howto 4810 howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel);4902 howto = MY_reloc_howto (input_bfd, rel, r_index, r_extern, r_pcrel); 4811 4903 #else 4812 4904 { … … 4818 4910 if (bfd_header_big_endian (input_bfd)) 4819 4911 { 4820 r_index = (( rel->r_index[0] << 16)4821 | ( rel->r_index[1] << 8)4912 r_index = (((unsigned int) rel->r_index[0] << 16) 4913 | ((unsigned int) rel->r_index[1] << 8) 4822 4914 | rel->r_index[2]); 4823 4915 r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); … … 4831 4923 else 4832 4924 { 4833 r_index = (( rel->r_index[2] << 16)4834 | ( rel->r_index[1] << 8)4925 r_index = (((unsigned int) rel->r_index[2] << 16) 4926 | ((unsigned int) rel->r_index[1] << 8) 4835 4927 | rel->r_index[0]); 4836 4928 r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); … … 4910 5002 { 4911 5003 h->indx = -2; 4912 h->written = false;5004 h->written = FALSE; 4913 5005 if (! aout_link_write_other_symbol (h, 4914 5006 (PTR) finfo)) 4915 return false;5007 return FALSE; 4916 5008 } 4917 5009 r_index = h->indx; … … 4926 5018 (finfo->info, name, input_bfd, input_section, 4927 5019 r_addr))) 4928 return false;5020 return FALSE; 4929 5021 r_index = 0; 4930 5022 } … … 4986 5078 else 4987 5079 { 4988 b oolean hundef;5080 bfd_boolean hundef; 4989 5081 4990 5082 /* We are generating an executable, and must do a full 4991 5083 relocation. */ 4992 hundef = false;5084 hundef = FALSE; 4993 5085 4994 5086 if (r_extern) … … 5009 5101 else 5010 5102 { 5011 hundef = true;5103 hundef = TRUE; 5012 5104 relocation = 0; 5013 5105 } … … 5027 5119 if (check_dynamic_reloc != NULL) 5028 5120 { 5029 b oolean skip;5121 bfd_boolean skip; 5030 5122 5031 5123 if (! ((*check_dynamic_reloc) 5032 5124 (finfo->info, input_bfd, input_section, h, 5033 5125 (PTR) rel, contents, &skip, &relocation))) 5034 return false;5126 return FALSE; 5035 5127 if (skip) 5036 5128 continue; … … 5050 5142 if (! ((*finfo->info->callbacks->undefined_symbol) 5051 5143 (finfo->info, name, input_bfd, input_section, 5052 r_addr, true)))5053 return false;5144 r_addr, TRUE))) 5145 return FALSE; 5054 5146 } 5055 5147 … … 5086 5178 (finfo->info, name, howto->name, 5087 5179 (bfd_vma) 0, input_bfd, input_section, r_addr))) 5088 return false;5180 return FALSE; 5089 5181 } 5090 5182 break; … … 5093 5185 } 5094 5186 5095 return true;5187 return TRUE; 5096 5188 } 5097 5189 5098 5190 /* Relocate an a.out section using extended a.out relocs. */ 5099 5191 5100 static b oolean5192 static bfd_boolean 5101 5193 aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, 5102 5194 rel_size, contents) … … 5108 5200 bfd_byte *contents; 5109 5201 { 5110 boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, 5111 bfd *, asection *, 5112 struct aout_link_hash_entry *, 5113 PTR, bfd_byte *, boolean *, 5114 bfd_vma *)); 5202 bfd_boolean (*check_dynamic_reloc) 5203 PARAMS ((struct bfd_link_info *, bfd *, asection *, 5204 struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, 5205 bfd_vma *)); 5115 5206 bfd *output_bfd; 5116 b oolean relocateable;5207 bfd_boolean relocateable; 5117 5208 struct external_nlist *syms; 5118 5209 char *strings; … … 5154 5245 if (bfd_header_big_endian (input_bfd)) 5155 5246 { 5156 r_index = (( rel->r_index[0] << 16)5157 | ( rel->r_index[1] << 8)5247 r_index = (((unsigned int) rel->r_index[0] << 16) 5248 | ((unsigned int) rel->r_index[1] << 8) 5158 5249 | rel->r_index[2]); 5159 5250 r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_BIG)); … … 5163 5254 else 5164 5255 { 5165 r_index = (( rel->r_index[2] << 16)5166 | ( rel->r_index[1] << 8)5256 r_index = (((unsigned int) rel->r_index[2] << 16) 5257 | ((unsigned int) rel->r_index[1] << 8) 5167 5258 | rel->r_index[0]); 5168 5259 r_extern = (0 != (rel->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE)); … … 5180 5271 modify the reloc accordingly. */ 5181 5272 if (r_extern 5182 || r_type == RELOC_BASE105183 || r_type == RELOC_BASE135184 || r_type == RELOC_BASE22)5273 || r_type == (unsigned int) RELOC_BASE10 5274 || r_type == (unsigned int) RELOC_BASE13 5275 || r_type == (unsigned int) RELOC_BASE22) 5185 5276 { 5186 5277 /* If we know the symbol this relocation is against, 5187 5278 convert it into a relocation against a section. This 5188 5279 is what the native linker does. */ 5189 if (r_type == RELOC_BASE105190 || r_type == RELOC_BASE135191 || r_type == RELOC_BASE22)5280 if (r_type == (unsigned int) RELOC_BASE10 5281 || r_type == (unsigned int) RELOC_BASE13 5282 || r_type == (unsigned int) RELOC_BASE22) 5192 5283 h = NULL; 5193 5284 else … … 5248 5339 { 5249 5340 h->indx = -2; 5250 h->written = false;5341 h->written = FALSE; 5251 5342 if (! aout_link_write_other_symbol (h, 5252 5343 (PTR) finfo)) 5253 return false;5344 return FALSE; 5254 5345 } 5255 5346 r_index = h->indx; … … 5264 5355 (finfo->info, name, input_bfd, input_section, 5265 5356 r_addr))) 5266 return false;5357 return FALSE; 5267 5358 r_index = 0; 5268 5359 } … … 5329 5420 else 5330 5421 { 5331 b oolean hundef;5422 bfd_boolean hundef; 5332 5423 bfd_reloc_status_type r; 5333 5424 5334 5425 /* We are generating an executable, and must do a full 5335 5426 relocation. */ 5336 hundef = false;5427 hundef = FALSE; 5337 5428 5338 5429 if (r_extern) … … 5353 5444 else 5354 5445 { 5355 hundef = true;5446 hundef = TRUE; 5356 5447 relocation = 0; 5357 5448 } 5358 5449 } 5359 else if (r_type == RELOC_BASE105360 || r_type == RELOC_BASE135361 || r_type == RELOC_BASE22)5450 else if (r_type == (unsigned int) RELOC_BASE10 5451 || r_type == (unsigned int) RELOC_BASE13 5452 || r_type == (unsigned int) RELOC_BASE22) 5362 5453 { 5363 5454 struct external_nlist *sym; … … 5367 5458 into the symbol table, even if r_extern is 0. */ 5368 5459 sym = syms + r_index; 5369 type = bfd_h_get_8 (input_bfd, sym->e_type);5460 type = H_GET_8 (input_bfd, sym->e_type); 5370 5461 if ((type & N_TYPE) == N_TEXT 5371 5462 || type == N_WEAKT) … … 5426 5517 if (check_dynamic_reloc != NULL) 5427 5518 { 5428 b oolean skip;5519 bfd_boolean skip; 5429 5520 5430 5521 if (! ((*check_dynamic_reloc) 5431 5522 (finfo->info, input_bfd, input_section, h, 5432 5523 (PTR) rel, contents, &skip, &relocation))) 5433 return false;5524 return FALSE; 5434 5525 if (skip) 5435 5526 continue; … … 5441 5532 if (hundef 5442 5533 && ! finfo->info->shared 5443 && r_type != RELOC_BASE105444 && r_type != RELOC_BASE135445 && r_type != RELOC_BASE22)5534 && r_type != (unsigned int) RELOC_BASE10 5535 && r_type != (unsigned int) RELOC_BASE13 5536 && r_type != (unsigned int) RELOC_BASE22) 5446 5537 { 5447 5538 const char *name; … … 5453 5544 if (! ((*finfo->info->callbacks->undefined_symbol) 5454 5545 (finfo->info, name, input_bfd, input_section, 5455 r_addr, true)))5456 return false;5546 r_addr, TRUE))) 5547 return FALSE; 5457 5548 } 5458 5549 5459 if (r_type != RELOC_SPARC_REV32)5550 if (r_type != (unsigned int) RELOC_SPARC_REV32) 5460 5551 r = MY_final_link_relocate (howto_table_ext + r_type, 5461 5552 input_bfd, input_section, … … 5486 5577 name = h->root.root.string; 5487 5578 else if (r_extern 5488 || r_type == RELOC_BASE105489 || r_type == RELOC_BASE135490 || r_type == RELOC_BASE22)5579 || r_type == (unsigned int) RELOC_BASE10 5580 || r_type == (unsigned int) RELOC_BASE13 5581 || r_type == (unsigned int) RELOC_BASE22) 5491 5582 name = strings + GET_WORD (input_bfd, 5492 5583 syms[r_index].e_strx); … … 5501 5592 (finfo->info, name, howto_table_ext[r_type].name, 5502 5593 r_addend, input_bfd, input_section, r_addr))) 5503 return false;5594 return FALSE; 5504 5595 } 5505 5596 break; … … 5509 5600 } 5510 5601 5511 return true;5602 return TRUE; 5512 5603 } 5513 5604 5514 5605 /* Handle a link order which is supposed to generate a reloc. */ 5515 5606 5516 static b oolean5607 static bfd_boolean 5517 5608 aout_link_reloc_link_order (finfo, o, p) 5518 5609 struct aout_final_link_info *finfo; … … 5528 5619 struct reloc_ext_external erel; 5529 5620 PTR rel_ptr; 5621 bfd_size_type amt; 5530 5622 5531 5623 pr = p->u.reloc.p; … … 5550 5642 h = ((struct aout_link_hash_entry *) 5551 5643 bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, 5552 pr->u.name, false, false, true));5644 pr->u.name, FALSE, FALSE, TRUE)); 5553 5645 if (h != (struct aout_link_hash_entry *) NULL 5554 5646 && h->indx >= 0) … … 5561 5653 symbol. */ 5562 5654 h->indx = -2; 5563 h->written = false;5655 h->written = FALSE; 5564 5656 if (! aout_link_write_other_symbol (h, (PTR) finfo)) 5565 return false;5657 return FALSE; 5566 5658 r_index = h->indx; 5567 5659 } … … 5571 5663 (finfo->info, pr->u.name, (bfd *) NULL, 5572 5664 (asection *) NULL, (bfd_vma) 0))) 5573 return false;5665 return FALSE; 5574 5666 r_index = 0; 5575 5667 } … … 5580 5672 { 5581 5673 bfd_set_error (bfd_error_bad_value); 5582 return false;5674 return FALSE; 5583 5675 } 5584 5676 … … 5593 5685 { 5594 5686 #ifdef MY_put_reloc 5595 MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto,5596 &srel);5687 MY_put_reloc (finfo->output_bfd, r_extern, r_index, p->offset, howto, 5688 &srel); 5597 5689 #else 5598 5690 { … … 5603 5695 int r_length; 5604 5696 5605 r_pcrel = howto->pc_relative;5697 r_pcrel = (int) howto->pc_relative; 5606 5698 r_baserel = (howto->type & 8) != 0; 5607 5699 r_jmptable = (howto->type & 16) != 0; … … 5650 5742 bfd_reloc_status_type r; 5651 5743 bfd_byte *buf; 5652 b oolean ok;5744 bfd_boolean ok; 5653 5745 5654 5746 size = bfd_get_reloc_size (howto); 5655 5747 buf = (bfd_byte *) bfd_zmalloc (size); 5656 5748 if (buf == (bfd_byte *) NULL) 5657 return false;5749 return FALSE; 5658 5750 r = MY_relocate_contents (howto, finfo->output_bfd, 5659 5751 (bfd_vma) pr->addend, buf); 5660 5752 switch (r) 5661 5753 { … … 5676 5768 { 5677 5769 free (buf); 5678 return false;5770 return FALSE; 5679 5771 } 5680 5772 break; 5681 5773 } 5682 ok = bfd_set_section_contents (finfo->output_bfd, o, 5683 (PTR) buf, 5684 (file_ptr) p->offset, 5685 size); 5774 ok = bfd_set_section_contents (finfo->output_bfd, o, (PTR) buf, 5775 (file_ptr) p->offset, size); 5686 5776 free (buf); 5687 5777 if (! ok) 5688 return false;5778 return FALSE; 5689 5779 } 5690 5780 } … … 5716 5806 } 5717 5807 5718 PUT_WORD (finfo->output_bfd, pr->addend, erel.r_addend);5808 PUT_WORD (finfo->output_bfd, (bfd_vma) pr->addend, erel.r_addend); 5719 5809 #endif /* MY_put_ext_reloc */ 5720 5810 … … 5722 5812 } 5723 5813 5814 amt = obj_reloc_entry_size (finfo->output_bfd); 5724 5815 if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 5725 || (bfd_write (rel_ptr, (bfd_size_type) 1, 5726 obj_reloc_entry_size (finfo->output_bfd), 5727 finfo->output_bfd) 5728 != obj_reloc_entry_size (finfo->output_bfd))) 5729 return false; 5816 || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt) 5817 return FALSE; 5730 5818 5731 5819 *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); … … 5738 5826 <= obj_datasec (finfo->output_bfd)->rel_filepos))); 5739 5827 5740 return true;5741 } 5828 return TRUE; 5829 } -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.