diff options
Diffstat (limited to 'contrib/binutils/bfd/aoutx.h')
-rw-r--r-- | contrib/binutils/bfd/aoutx.h | 985 |
1 files changed, 513 insertions, 472 deletions
diff --git a/contrib/binutils/bfd/aoutx.h b/contrib/binutils/bfd/aoutx.h index 70359d6..3282f87 100644 --- a/contrib/binutils/bfd/aoutx.h +++ b/contrib/binutils/bfd/aoutx.h @@ -1,24 +1,24 @@ /* BFD semi-generic back-end for a.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, - 2001, 2002 + 2001, 2002, 2003 Free Software Foundation, Inc. Written by Cygnus Support. -This file is part of BFD, the Binary File Descriptor library. + This file is part of BFD, the Binary File Descriptor library. -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SECTION @@ -105,9 +105,7 @@ DESCRIPTION in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in} to use the @file{@var{XXX}.mt} file (by setting "<<bfd_target=XXX>>") when your - configuration is selected. - -*/ + configuration is selected. */ /* Some assumptions: * Any BFD with D_PAGED set is ZMAGIC, and vice versa. @@ -131,14 +129,18 @@ DESCRIPTION #include "aout/stab_gnu.h" #include "aout/ar.h" -static boolean aout_get_external_symbols PARAMS ((bfd *)); -static boolean translate_from_native_sym_flags +static bfd_boolean aout_get_external_symbols + PARAMS ((bfd *)); +static bfd_boolean translate_from_native_sym_flags PARAMS ((bfd *, aout_symbol_type *)); -static boolean translate_to_native_sym_flags +static bfd_boolean translate_to_native_sym_flags PARAMS ((bfd *, asymbol *, struct external_nlist *)); -static void adjust_o_magic PARAMS ((bfd *, struct internal_exec *)); -static void adjust_z_magic PARAMS ((bfd *, struct internal_exec *)); -static void adjust_n_magic PARAMS ((bfd *, struct internal_exec *)); +static void adjust_o_magic + PARAMS ((bfd *, struct internal_exec *)); +static void adjust_z_magic + PARAMS ((bfd *, struct internal_exec *)); +static void adjust_n_magic + PARAMS ((bfd *, struct internal_exec *)); reloc_howto_type * NAME(aout,reloc_type_lookup) PARAMS ((bfd *, bfd_reloc_code_real_type)); @@ -153,9 +155,8 @@ DESCRIPTION The standard records contain only an address, a symbol index, and a type field. The extended records (used on 29ks and sparcs) also have a full integer for an - addend. + addend. */ -*/ #ifndef CTOR_TABLE_RELOC_HOWTO #define CTOR_TABLE_RELOC_IDX 2 #define CTOR_TABLE_RELOC_HOWTO(BFD) \ @@ -193,58 +194,59 @@ DESCRIPTION reloc_howto_type howto_table_ext[] = { - /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ - HOWTO(RELOC_8, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", false, 0,0x000000ff, false), - HOWTO(RELOC_16, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", false, 0,0x0000ffff, false), - HOWTO(RELOC_32, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", false, 0,0xffffffff, false), - HOWTO(RELOC_DISP8, 0, 0, 8, true, 0, complain_overflow_signed,0,"DISP8", false, 0,0x000000ff, false), - HOWTO(RELOC_DISP16, 0, 1, 16, true, 0, complain_overflow_signed,0,"DISP16", false, 0,0x0000ffff, false), - HOWTO(RELOC_DISP32, 0, 2, 32, true, 0, complain_overflow_signed,0,"DISP32", false, 0,0xffffffff, false), - HOWTO(RELOC_WDISP30,2, 2, 30, true, 0, complain_overflow_signed,0,"WDISP30", false, 0,0x3fffffff, false), - HOWTO(RELOC_WDISP22,2, 2, 22, true, 0, complain_overflow_signed,0,"WDISP22", false, 0,0x003fffff, false), - HOWTO(RELOC_HI22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"HI22", false, 0,0x003fffff, false), - HOWTO(RELOC_22, 0, 2, 22, false, 0, complain_overflow_bitfield,0,"22", false, 0,0x003fffff, false), - HOWTO(RELOC_13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"13", false, 0,0x00001fff, false), - HOWTO(RELOC_LO10, 0, 2, 10, false, 0, complain_overflow_dont,0,"LO10", false, 0,0x000003ff, false), - HOWTO(RELOC_SFA_BASE,0, 2, 32, false, 0, complain_overflow_bitfield,0,"SFA_BASE", false, 0,0xffffffff, false), - HOWTO(RELOC_SFA_OFF13,0,2, 32, false, 0, complain_overflow_bitfield,0,"SFA_OFF13",false, 0,0xffffffff, false), - HOWTO(RELOC_BASE10, 0, 2, 10, false, 0, complain_overflow_dont,0,"BASE10", false, 0,0x000003ff, false), - HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_signed,0,"BASE13", false, 0,0x00001fff, false), - HOWTO(RELOC_BASE22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"BASE22", false, 0,0x003fffff, false), - HOWTO(RELOC_PC10, 0, 2, 10, true, 0, complain_overflow_dont,0,"PC10", false, 0,0x000003ff, true), - HOWTO(RELOC_PC22, 10, 2, 22, true, 0, complain_overflow_signed,0,"PC22", false, 0,0x003fffff, true), - HOWTO(RELOC_JMP_TBL,2, 2, 30, true, 0, complain_overflow_signed,0,"JMP_TBL", false, 0,0x3fffffff, false), - HOWTO(RELOC_SEGOFF16,0, 2, 0, false, 0, complain_overflow_bitfield,0,"SEGOFF16", false, 0,0x00000000, false), - HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"GLOB_DAT", false, 0,0x00000000, false), - HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_SLOT", false, 0,0x00000000, false), - HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), - HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true), - HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true), + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ + HOWTO(RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", FALSE, 0,0x000000ff, FALSE), + HOWTO(RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", FALSE, 0,0x0000ffff, FALSE), + HOWTO(RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", FALSE, 0,0xffffffff, FALSE), + HOWTO(RELOC_DISP8, 0, 0, 8, TRUE, 0, complain_overflow_signed,0,"DISP8", FALSE, 0,0x000000ff, FALSE), + HOWTO(RELOC_DISP16, 0, 1, 16, TRUE, 0, complain_overflow_signed,0,"DISP16", FALSE, 0,0x0000ffff, FALSE), + HOWTO(RELOC_DISP32, 0, 2, 32, TRUE, 0, complain_overflow_signed,0,"DISP32", FALSE, 0,0xffffffff, FALSE), + HOWTO(RELOC_WDISP30,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"WDISP30", FALSE, 0,0x3fffffff, FALSE), + HOWTO(RELOC_WDISP22,2, 2, 22, TRUE, 0, complain_overflow_signed,0,"WDISP22", FALSE, 0,0x003fffff, FALSE), + HOWTO(RELOC_HI22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"HI22", FALSE, 0,0x003fffff, FALSE), + HOWTO(RELOC_22, 0, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"22", FALSE, 0,0x003fffff, FALSE), + HOWTO(RELOC_13, 0, 2, 13, FALSE, 0, complain_overflow_bitfield,0,"13", FALSE, 0,0x00001fff, FALSE), + HOWTO(RELOC_LO10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"LO10", FALSE, 0,0x000003ff, FALSE), + HOWTO(RELOC_SFA_BASE,0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_BASE", FALSE, 0,0xffffffff, FALSE), + HOWTO(RELOC_SFA_OFF13,0,2, 32, FALSE, 0, complain_overflow_bitfield,0,"SFA_OFF13",FALSE, 0,0xffffffff, FALSE), + HOWTO(RELOC_BASE10, 0, 2, 10, FALSE, 0, complain_overflow_dont,0,"BASE10", FALSE, 0,0x000003ff, FALSE), + HOWTO(RELOC_BASE13, 0, 2, 13, FALSE, 0, complain_overflow_signed,0,"BASE13", FALSE, 0,0x00001fff, FALSE), + HOWTO(RELOC_BASE22, 10, 2, 22, FALSE, 0, complain_overflow_bitfield,0,"BASE22", FALSE, 0,0x003fffff, FALSE), + HOWTO(RELOC_PC10, 0, 2, 10, TRUE, 0, complain_overflow_dont,0,"PC10", FALSE, 0,0x000003ff, TRUE), + HOWTO(RELOC_PC22, 10, 2, 22, TRUE, 0, complain_overflow_signed,0,"PC22", FALSE, 0,0x003fffff, TRUE), + HOWTO(RELOC_JMP_TBL,2, 2, 30, TRUE, 0, complain_overflow_signed,0,"JMP_TBL", FALSE, 0,0x3fffffff, FALSE), + HOWTO(RELOC_SEGOFF16,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"SEGOFF16", FALSE, 0,0x00000000, FALSE), + HOWTO(RELOC_GLOB_DAT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GLOB_DAT", FALSE, 0,0x00000000, FALSE), + HOWTO(RELOC_JMP_SLOT,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_SLOT", FALSE, 0,0x00000000, FALSE), + HOWTO(RELOC_RELATIVE,0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE), + HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), + HOWTO(0, 0, 0, 0, FALSE, 0, complain_overflow_dont, 0, "R_SPARC_NONE", FALSE,0,0x00000000,TRUE), #define RELOC_SPARC_REV32 RELOC_WDISP19 - HOWTO(RELOC_SPARC_REV32, 0, 2, 32, false, 0, complain_overflow_dont,0,"R_SPARC_REV32", false, 0,0xffffffff, false), + HOWTO(RELOC_SPARC_REV32, 0, 2, 32, FALSE, 0, complain_overflow_dont,0,"R_SPARC_REV32", FALSE, 0,0xffffffff, FALSE), }; /* Convert standard reloc records to "arelent" format (incl byte swap). */ -reloc_howto_type howto_table_std[] = { - /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone */ -HOWTO ( 0, 0, 0, 8, false, 0, complain_overflow_bitfield,0,"8", true, 0x000000ff,0x000000ff, false), -HOWTO ( 1, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"16", true, 0x0000ffff,0x0000ffff, false), -HOWTO ( 2, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"32", true, 0xffffffff,0xffffffff, false), -HOWTO ( 3, 0, 4, 64, false, 0, complain_overflow_bitfield,0,"64", true, 0xdeaddead,0xdeaddead, false), -HOWTO ( 4, 0, 0, 8, true, 0, complain_overflow_signed, 0,"DISP8", true, 0x000000ff,0x000000ff, false), -HOWTO ( 5, 0, 1, 16, true, 0, complain_overflow_signed, 0,"DISP16", true, 0x0000ffff,0x0000ffff, false), -HOWTO ( 6, 0, 2, 32, true, 0, complain_overflow_signed, 0,"DISP32", true, 0xffffffff,0xffffffff, false), -HOWTO ( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", true, 0xfeedface,0xfeedface, false), -HOWTO ( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false), -HOWTO ( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false), -HOWTO (10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false), +reloc_howto_type howto_table_std[] = +{ + /* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask pcdone. */ +HOWTO ( 0, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,"8", TRUE, 0x000000ff,0x000000ff, FALSE), +HOWTO ( 1, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"16", TRUE, 0x0000ffff,0x0000ffff, FALSE), +HOWTO ( 2, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"32", TRUE, 0xffffffff,0xffffffff, FALSE), +HOWTO ( 3, 0, 4, 64, FALSE, 0, complain_overflow_bitfield,0,"64", TRUE, 0xdeaddead,0xdeaddead, FALSE), +HOWTO ( 4, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,"DISP8", TRUE, 0x000000ff,0x000000ff, FALSE), +HOWTO ( 5, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,"DISP16", TRUE, 0x0000ffff,0x0000ffff, FALSE), +HOWTO ( 6, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,"DISP32", TRUE, 0xffffffff,0xffffffff, FALSE), +HOWTO ( 7, 0, 4, 64, TRUE, 0, complain_overflow_signed, 0,"DISP64", TRUE, 0xfeedface,0xfeedface, FALSE), +HOWTO ( 8, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"GOT_REL", FALSE, 0,0x00000000, FALSE), +HOWTO ( 9, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,"BASE16", FALSE,0xffffffff,0xffffffff, FALSE), +HOWTO (10, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,"BASE32", FALSE,0xffffffff,0xffffffff, FALSE), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), - HOWTO (16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false), + HOWTO (16, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"JMP_TABLE", FALSE, 0,0x00000000, FALSE), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -260,7 +262,7 @@ EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), - HOWTO (32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false), + HOWTO (32, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"RELATIVE", FALSE, 0,0x00000000, FALSE), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), @@ -268,7 +270,7 @@ EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), EMPTY_HOWTO (-1), - HOWTO (40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false), + HOWTO (40, 0, 2, 0, FALSE, 0, complain_overflow_bitfield,0,"BASEREL", FALSE, 0,0x00000000, FALSE), }; #define TABLE_SIZE(TABLE) (sizeof (TABLE) / sizeof (TABLE[0])) @@ -281,6 +283,7 @@ NAME(aout,reloc_type_lookup) (abfd,code) #define EXT(i, j) case i: return &howto_table_ext[j] #define STD(i, j) case i: return &howto_table_std[j] int ext = obj_reloc_entry_size (abfd) == RELOC_EXT_SIZE; + if (code == BFD_RELOC_CTOR) switch (bfd_get_arch_info (abfd)->bits_per_address) { @@ -291,6 +294,7 @@ NAME(aout,reloc_type_lookup) (abfd,code) code = BFD_RELOC_64; break; } + if (ext) switch (code) { @@ -313,9 +317,10 @@ NAME(aout,reloc_type_lookup) (abfd,code) default: return (reloc_howto_type *) NULL; } else - /* std relocs */ + /* std relocs. */ switch (code) { + STD (BFD_RELOC_8, 0); STD (BFD_RELOC_16, 1); STD (BFD_RELOC_32, 2); STD (BFD_RELOC_8_PCREL, 4); @@ -416,20 +421,20 @@ NAME(aout,swap_exec_header_out) (abfd, execp, raw_bytes) /* Make all the section for an a.out file. */ -boolean +bfd_boolean NAME(aout,make_sections) (abfd) bfd *abfd; { if (obj_textsec (abfd) == (asection *) NULL && bfd_make_section (abfd, ".text") == (asection *) NULL) - return false; + return FALSE; if (obj_datasec (abfd) == (asection *) NULL && bfd_make_section (abfd, ".data") == (asection *) NULL) - return false; + return FALSE; if (obj_bsssec (abfd) == (asection *) NULL && bfd_make_section (abfd, ".bss") == (asection *) NULL) - return false; - return true; + return FALSE; + return TRUE; } /* @@ -474,14 +479,15 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) *abfd->tdata.aout_data = *oldrawptr; abfd->tdata.aout_data->a.hdr = &rawptr->e; - *(abfd->tdata.aout_data->a.hdr) = *execp; /* Copy in the internal_exec struct */ + /* Copy in the internal_exec struct. */ + *(abfd->tdata.aout_data->a.hdr) = *execp; execp = abfd->tdata.aout_data->a.hdr; - /* Set the file flags */ + /* Set the file flags. */ abfd->flags = BFD_NO_FLAGS; if (execp->a_drsize || execp->a_trsize) abfd->flags |= HAS_RELOC; - /* Setting of EXEC_P has been deferred to the bottom of this function */ + /* Setting of EXEC_P has been deferred to the bottom of this function. */ if (execp->a_syms) abfd->flags |= HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS; if (N_DYNAMIC (*execp)) @@ -563,18 +569,18 @@ NAME(aout,some_aout_object_p) (abfd, execp, callback_to_real_object_p) obj_textsec (abfd)->size = N_TXTSIZE (*execp); obj_textsec (abfd)->raw_size = N_TXTSIZE (*execp); - /* data and bss are already filled in since they're so standard */ + /* Data and bss are already filled in since they're so standard. */ - /* The virtual memory addresses of the sections */ + /* The virtual memory addresses of the sections. */ obj_textsec (abfd)->vma = N_TXTADDR (*execp); obj_datasec (abfd)->vma = N_DATADDR (*execp); obj_bsssec (abfd)->vma = N_BSSADDR (*execp); - /* The file offsets of the sections */ + /* The file offsets of the sections. */ obj_textsec (abfd)->filepos = N_TXTOFF (*execp); obj_datasec (abfd)->filepos = N_DATOFF (*execp); - /* The file offsets of the relocation info */ + /* The file offsets of the relocation info. */ obj_textsec (abfd)->rel_filepos = N_TRELOFF (*execp); obj_datasec (abfd)->rel_filepos = N_DRELOFF (*execp); @@ -669,13 +675,13 @@ FUNCTION aout_@var{size}_mkobject SYNOPSIS - boolean aout_@var{size}_mkobject, (bfd *abfd); + bfd_boolean aout_@var{size}_mkobject, (bfd *abfd); DESCRIPTION Initialize BFD @var{abfd} for use with a.out files. */ -boolean +bfd_boolean NAME(aout,mkobject) (abfd) bfd *abfd; { @@ -686,7 +692,7 @@ NAME(aout,mkobject) (abfd) rawptr = (struct aout_data_struct *) bfd_zalloc (abfd, amt); if (rawptr == NULL) - return false; + return FALSE; abfd->tdata.aout_data = rawptr; exec_hdr (abfd) = &(rawptr->e); @@ -695,7 +701,7 @@ NAME(aout,mkobject) (abfd) obj_datasec (abfd) = (asection *) NULL; obj_bsssec (abfd) = (asection *) NULL; - return true; + return TRUE; } /* @@ -721,12 +727,12 @@ enum machine_type NAME(aout,machine_type) (arch, machine, unknown) enum bfd_architecture arch; unsigned long machine; - boolean *unknown; + bfd_boolean *unknown; { enum machine_type arch_flags; arch_flags = M_UNKNOWN; - *unknown = true; + *unknown = TRUE; switch (arch) { @@ -745,7 +751,7 @@ NAME(aout,machine_type) (arch, machine, unknown) switch (machine) { case 0: arch_flags = M_68010; break; - case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = false; break; + case bfd_mach_m68000: arch_flags = M_UNKNOWN; *unknown = FALSE; break; case bfd_mach_m68010: arch_flags = M_68010; break; case bfd_mach_m68020: arch_flags = M_68020; break; default: arch_flags = M_UNKNOWN; break; @@ -753,7 +759,9 @@ NAME(aout,machine_type) (arch, machine, unknown) break; case bfd_arch_i386: - if (machine == 0) + if (machine == 0 + || machine == bfd_mach_i386_i386 + || machine == bfd_mach_i386_i386_intel_syntax) arch_flags = M_386; break; @@ -790,8 +798,10 @@ NAME(aout,machine_type) (arch, machine, unknown) case bfd_mach_mips12000: case bfd_mach_mips16: case bfd_mach_mipsisa32: + case bfd_mach_mipsisa32r2: case bfd_mach_mips5: case bfd_mach_mipsisa64: + case bfd_mach_mipsisa64r2: case bfd_mach_mips_sb1: /* FIXME: These should be MIPS3, MIPS4, MIPS16, MIPS32, etc. */ arch_flags = M_MIPS2; @@ -813,7 +823,7 @@ NAME(aout,machine_type) (arch, machine, unknown) break; case bfd_arch_vax: - *unknown = false; + *unknown = FALSE; break; case bfd_arch_cris: @@ -826,7 +836,7 @@ NAME(aout,machine_type) (arch, machine, unknown) } if (arch_flags != M_UNKNOWN) - *unknown = false; + *unknown = FALSE; return arch_flags; } @@ -836,7 +846,7 @@ FUNCTION aout_@var{size}_set_arch_mach SYNOPSIS - boolean aout_@var{size}_set_arch_mach, + bfd_boolean aout_@var{size}_set_arch_mach, (bfd *, enum bfd_architecture arch, unsigned long machine)); @@ -847,25 +857,25 @@ DESCRIPTION can support the architecture required. */ -boolean +bfd_boolean NAME(aout,set_arch_mach) (abfd, arch, machine) bfd *abfd; enum bfd_architecture arch; unsigned long machine; { if (! bfd_default_set_arch_mach (abfd, arch, machine)) - return false; + return FALSE; if (arch != bfd_arch_unknown) { - boolean unknown; + bfd_boolean unknown; NAME(aout,machine_type) (arch, machine, &unknown); if (unknown) - return false; + return FALSE; } - /* Determine the size of a relocation entry */ + /* Determine the size of a relocation entry. */ switch (arch) { case bfd_arch_sparc: @@ -903,7 +913,7 @@ adjust_o_magic (abfd, execp) /* Data. */ if (!obj_datasec (abfd)->user_set_vma) { -#if 0 /* ?? Does alignment in the file image really matter? */ +#if 0 /* ?? Does alignment in the file image really matter? */ pad = align_power (vma, obj_datasec (abfd)->alignment_power) - vma; #endif obj_textsec (abfd)->_raw_size += pad; @@ -1110,7 +1120,7 @@ adjust_n_magic (abfd, execp) N_SET_MAGIC (*execp, NMAGIC); } -boolean +bfd_boolean NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) bfd *abfd; bfd_size_type *text_size; @@ -1119,10 +1129,10 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) struct internal_exec *execp = exec_hdr (abfd); if (! NAME(aout,make_sections) (abfd)) - return false; + return FALSE; if (adata (abfd).magic != undecided_magic) - return true; + return TRUE; obj_textsec (abfd)->_raw_size = align_power (obj_textsec (abfd)->_raw_size, @@ -1199,7 +1209,7 @@ NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end) obj_bsssec (abfd)->vma, obj_bsssec (abfd)->_raw_size); #endif - return true; + return TRUE; } /* @@ -1207,7 +1217,7 @@ FUNCTION aout_@var{size}_new_section_hook SYNOPSIS - boolean aout_@var{size}_new_section_hook, + bfd_boolean aout_@var{size}_new_section_hook, (bfd *abfd, asection *newsect)); @@ -1215,48 +1225,47 @@ DESCRIPTION Called by the BFD in response to a @code{bfd_make_section} request. */ -boolean +bfd_boolean NAME(aout,new_section_hook) (abfd, newsect) bfd *abfd; asection *newsect; { - /* align to double at least */ + /* Align to double at least. */ newsect->alignment_power = bfd_get_arch_info (abfd)->section_align_power; if (bfd_get_format (abfd) == bfd_object) - { - if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text")) - { - obj_textsec (abfd)= newsect; - newsect->target_index = N_TEXT; - return true; - } - - if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) - { - obj_datasec (abfd) = newsect; - newsect->target_index = N_DATA; - return true; - } + { + if (obj_textsec (abfd) == NULL && !strcmp (newsect->name, ".text")) + { + obj_textsec (abfd)= newsect; + newsect->target_index = N_TEXT; + return TRUE; + } - if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) - { - obj_bsssec (abfd) = newsect; - newsect->target_index = N_BSS; - return true; - } + if (obj_datasec (abfd) == NULL && !strcmp (newsect->name, ".data")) + { + obj_datasec (abfd) = newsect; + newsect->target_index = N_DATA; + return TRUE; + } - } + if (obj_bsssec (abfd) == NULL && !strcmp (newsect->name, ".bss")) + { + obj_bsssec (abfd) = newsect; + newsect->target_index = N_BSS; + return TRUE; + } + } - /* We allow more than three sections internally */ - return true; + /* We allow more than three sections internally. */ + return TRUE; } -boolean +bfd_boolean NAME(aout,set_section_contents) (abfd, section, location, offset, count) bfd *abfd; sec_ptr section; - PTR location; + const PTR location; file_ptr offset; bfd_size_type count; { @@ -1266,38 +1275,44 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count) if (! abfd->output_has_begun) { if (! NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end)) - return false; + return FALSE; } if (section == obj_bsssec (abfd)) { bfd_set_error (bfd_error_no_contents); - return false; + return FALSE; } if (section != obj_textsec (abfd) && section != obj_datasec (abfd)) { - (*_bfd_error_handler) - (_("%s: can not represent section `%s' in a.out object file format"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; + if (aout_section_merge_with_text_p (abfd, section)) + section->filepos = obj_textsec (abfd)->filepos + + (section->vma - obj_textsec (abfd)->vma); + else + { + (*_bfd_error_handler) + (_("%s: can not represent section `%s' in a.out object file format"), + bfd_get_filename (abfd), bfd_get_section_name (abfd, section)); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } } if (count != 0) { if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0 || bfd_bwrite (location, count, abfd) != count) - return false; + return FALSE; } - return true; + return TRUE; } /* Read the external symbols from an a.out file. */ -static boolean +static bfd_boolean aout_get_external_symbols (abfd) bfd *abfd; { @@ -1312,8 +1327,8 @@ aout_get_external_symbols (abfd) #ifdef USE_MMAP if (! bfd_get_file_window (abfd, obj_sym_filepos (abfd), exec_hdr (abfd)->a_syms, - &obj_aout_sym_window (abfd), true)) - return false; + &obj_aout_sym_window (abfd), TRUE)) + return FALSE; syms = (struct external_nlist *) obj_aout_sym_window (abfd).data; #else /* We allocate using malloc to make the values easy to free @@ -1322,14 +1337,14 @@ aout_get_external_symbols (abfd) syms = ((struct external_nlist *) bfd_malloc (count * EXTERNAL_NLIST_SIZE)); if (syms == (struct external_nlist *) NULL && count != 0) - return false; + return FALSE; amt = exec_hdr (abfd)->a_syms; if (bfd_seek (abfd, obj_sym_filepos (abfd), SEEK_SET) != 0 || bfd_bread (syms, amt, abfd) != amt) { free (syms); - return false; + return FALSE; } #endif @@ -1348,18 +1363,18 @@ aout_get_external_symbols (abfd) /* Get the size of the strings. */ if (bfd_seek (abfd, obj_str_filepos (abfd), SEEK_SET) != 0 || bfd_bread ((PTR) string_chars, amt, abfd) != amt) - return false; + return FALSE; stringsize = GET_WORD (abfd, string_chars); #ifdef USE_MMAP if (! bfd_get_file_window (abfd, obj_str_filepos (abfd), stringsize, - &obj_aout_string_window (abfd), true)) - return false; + &obj_aout_string_window (abfd), TRUE)) + return FALSE; strings = (char *) obj_aout_string_window (abfd).data; #else strings = (char *) bfd_malloc (stringsize + 1); if (strings == NULL) - return false; + return FALSE; /* Skip space for the string count in the buffer for convenience when using indexes. */ @@ -1367,7 +1382,7 @@ aout_get_external_symbols (abfd) if (bfd_bread (strings + BYTES_IN_WORD, amt, abfd) != amt) { free (strings); - return false; + return FALSE; } #endif @@ -1380,7 +1395,7 @@ aout_get_external_symbols (abfd) obj_aout_external_string_size (abfd) = stringsize; } - return true; + return TRUE; } /* Translate an a.out symbol into a BFD symbol. The desc, other, type @@ -1388,7 +1403,7 @@ aout_get_external_symbols (abfd) nlist structure. This function is responsible for setting symbol->flags and symbol->section, and adjusting symbol->value. */ -static boolean +static bfd_boolean translate_from_native_sym_flags (abfd, cache_ptr) bfd *abfd; aout_symbol_type *cache_ptr; @@ -1401,7 +1416,6 @@ translate_from_native_sym_flags (abfd, cache_ptr) asection *sec; /* This is a debugging symbol. */ - cache_ptr->symbol.flags = BSF_DEBUGGING; /* Work out the symbol section. */ @@ -1426,7 +1440,7 @@ translate_from_native_sym_flags (abfd, cache_ptr) cache_ptr->symbol.section = sec; cache_ptr->symbol.value -= sec->vma; - return true; + return TRUE; } /* Get the default visibility. This does not apply to all types, so @@ -1515,18 +1529,18 @@ translate_from_native_sym_flags (abfd, cache_ptr) amt = strlen (cache_ptr->symbol.name) + 1; copy = bfd_alloc (abfd, amt); if (copy == NULL) - return false; + return FALSE; strcpy (copy, cache_ptr->symbol.name); section = bfd_make_section (abfd, copy); if (section == NULL) - return false; + return FALSE; } amt = sizeof (arelent_chain); reloc = (arelent_chain *) bfd_alloc (abfd, amt); if (reloc == NULL) - return false; + return FALSE; /* Build a relocation entry for the constructor. */ switch (cache_ptr->type & N_TYPE) @@ -1639,12 +1653,12 @@ translate_from_native_sym_flags (abfd, cache_ptr) break; } - return true; + return TRUE; } /* Set the fields of SYM_POINTER according to CACHE_PTR. */ -static boolean +static bfd_boolean translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) bfd *abfd; asymbol *cache_ptr; @@ -1670,7 +1684,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) bfd_get_filename (abfd), cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*")); bfd_set_error (bfd_error_nonrepresentable_section); - return false; + return FALSE; } if (sec->output_section != NULL) @@ -1695,14 +1709,19 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) sym_pointer->e_type[0] = N_UNDF | N_EXT; else { - (*_bfd_error_handler) - (_("%s: can not represent section `%s' in a.out object file format"), - bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); - bfd_set_error (bfd_error_nonrepresentable_section); - return false; + if (aout_section_merge_with_text_p (abfd, sec)) + sym_pointer->e_type[0] |= N_TEXT; + else + { + (*_bfd_error_handler) + (_("%s: can not represent section `%s' in a.out object file format"), + bfd_get_filename (abfd), bfd_get_section_name (abfd, sec)); + bfd_set_error (bfd_error_nonrepresentable_section); + return FALSE; + } } - /* Turn the symbol from section relative to absolute again */ + /* Turn the symbol from section relative to absolute again. */ value += sec->vma + off; if ((cache_ptr->flags & BSF_WARNING) != 0) @@ -1718,6 +1737,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) if ((cache_ptr->flags & BSF_CONSTRUCTOR) != 0) { int type = ((aout_symbol_type *) cache_ptr)->type; + switch (type) { case N_ABS: type = N_SETA; break; @@ -1746,7 +1766,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer) PUT_WORD (abfd, value, sym_pointer->e_value); - return true; + return TRUE; } /* Native-level interface to symbols. */ @@ -1766,7 +1786,7 @@ NAME(aout,make_empty_symbol) (abfd) /* Translate a set of internal symbols into external symbols. */ -boolean +bfd_boolean NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) bfd *abfd; aout_symbol_type *in; @@ -1774,7 +1794,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) bfd_size_type count; char *str; bfd_size_type strsize; - boolean dynamic; + bfd_boolean dynamic; { struct external_nlist *ext_end; @@ -1796,7 +1816,7 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) else if (x < strsize) in->symbol.name = str + x; else - return false; + return FALSE; in->symbol.value = GET_SWORD (abfd, ext->e_value); in->desc = H_GET_16 (abfd, ext->e_desc); @@ -1805,20 +1825,20 @@ NAME(aout,translate_symbol_table) (abfd, in, ext, count, str, strsize, dynamic) in->symbol.udata.p = NULL; if (! translate_from_native_sym_flags (abfd, in)) - return false; + return FALSE; if (dynamic) in->symbol.flags |= BSF_DYNAMIC; } - return true; + return TRUE; } /* We read the symbols into a buffer, which is discarded when this function exits. We read the strings into a buffer large enough to hold them all plus all the cached symbol entries. */ -boolean +bfd_boolean NAME(aout,slurp_symbol_table) (abfd) bfd *abfd; { @@ -1826,20 +1846,20 @@ NAME(aout,slurp_symbol_table) (abfd) aout_symbol_type *cached; bfd_size_type cached_size; - /* If there's no work to be done, don't do any */ + /* If there's no work to be done, don't do any. */ if (obj_aout_symbols (abfd) != (aout_symbol_type *) NULL) - return true; + return TRUE; old_external_syms = obj_aout_external_syms (abfd); if (! aout_get_external_symbols (abfd)) - return false; + return FALSE; cached_size = obj_aout_external_sym_count (abfd); cached_size *= sizeof (aout_symbol_type); cached = (aout_symbol_type *) bfd_zmalloc (cached_size); if (cached == NULL && cached_size != 0) - return false; + return FALSE; /* Convert from external symbol information to internal. */ if (! (NAME(aout,translate_symbol_table) @@ -1848,10 +1868,10 @@ NAME(aout,slurp_symbol_table) (abfd) obj_aout_external_sym_count (abfd), obj_aout_external_strings (abfd), obj_aout_external_string_size (abfd), - false))) + FALSE))) { free (cached); - return false; + return FALSE; } bfd_get_symcount (abfd) = obj_aout_external_sym_count (abfd); @@ -1873,7 +1893,7 @@ NAME(aout,slurp_symbol_table) (abfd) obj_aout_external_syms (abfd) = NULL; } - return true; + return TRUE; } /* We use a hash table when writing out symbols so that we only write @@ -1886,8 +1906,9 @@ NAME(aout,slurp_symbol_table) (abfd) if BFD_TRADITIONAL_FORMAT is set. */ static bfd_size_type add_to_stringtab - PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, boolean)); -static boolean emit_stringtab PARAMS ((bfd *, struct bfd_strtab_hash *)); + PARAMS ((bfd *, struct bfd_strtab_hash *, const char *, bfd_boolean)); +static bfd_boolean emit_stringtab + PARAMS ((bfd *, struct bfd_strtab_hash *)); /* Get the index of a string in a strtab, adding it if it is not already present. */ @@ -1897,9 +1918,9 @@ add_to_stringtab (abfd, tab, str, copy) bfd *abfd; struct bfd_strtab_hash *tab; const char *str; - boolean copy; + bfd_boolean copy; { - boolean hash; + bfd_boolean hash; bfd_size_type index; /* An index of 0 always means the empty string. */ @@ -1908,9 +1929,9 @@ add_to_stringtab (abfd, tab, str, copy) /* Don't hash if BFD_TRADITIONAL_FORMAT is set, because SunOS dbx doesn't understand a hashed string table. */ - hash = true; + hash = TRUE; if ((abfd->flags & BFD_TRADITIONAL_FORMAT) != 0) - hash = false; + hash = FALSE; index = _bfd_stringtab_add (tab, str, hash, copy); @@ -1927,7 +1948,7 @@ add_to_stringtab (abfd, tab, str, copy) /* Write out a strtab. ABFD is already at the right location in the file. */ -static boolean +static bfd_boolean emit_stringtab (abfd, tab) register bfd *abfd; struct bfd_strtab_hash *tab; @@ -1938,12 +1959,12 @@ emit_stringtab (abfd, tab) /* The string table starts with the size. */ PUT_WORD (abfd, _bfd_stringtab_size (tab) + BYTES_IN_WORD, buffer); if (bfd_bwrite ((PTR) buffer, amt, abfd) != amt) - return false; + return FALSE; return _bfd_stringtab_emit (abfd, tab); } -boolean +bfd_boolean NAME(aout,write_syms) (abfd) bfd *abfd; { @@ -1953,7 +1974,7 @@ NAME(aout,write_syms) (abfd) strtab = _bfd_stringtab_init (); if (strtab == NULL) - return false; + return FALSE; for (count = 0; count < bfd_get_symcount (abfd); count++) { @@ -1962,7 +1983,7 @@ NAME(aout,write_syms) (abfd) struct external_nlist nsp; bfd_size_type amt; - indx = add_to_stringtab (abfd, strtab, g->name, false); + indx = add_to_stringtab (abfd, strtab, g->name, FALSE); if (indx == (bfd_size_type) -1) goto error_return; PUT_WORD (abfd, indx, (bfd_byte *) nsp.e_strx); @@ -1997,15 +2018,15 @@ NAME(aout,write_syms) (abfd) _bfd_stringtab_free (strtab); - return true; + return TRUE; error_return: _bfd_stringtab_free (strtab); - return false; + return FALSE; } long -NAME(aout,get_symtab) (abfd, location) +NAME(aout,canonicalize_symtab) (abfd, location) bfd *abfd; asymbol **location; { @@ -2023,7 +2044,7 @@ NAME(aout,get_symtab) (abfd, location) return bfd_get_symcount (abfd); } -/* Standard reloc stuff */ +/* Standard reloc stuff. */ /* Output standard relocation information to a file in target byte order. */ extern void NAME(aout,swap_std_reloc_out) @@ -2045,8 +2066,8 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) PUT_WORD (abfd, g->address, natptr->r_address); - r_length = g->howto->size ; /* Size as a power of two */ - r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ + r_length = g->howto->size ; /* Size as a power of two. */ + r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */ /* XXX This relies on relocs coming from a.out files. */ r_baserel = (g->howto->type & 8) != 0; r_jmptable = (g->howto->type & 16) != 0; @@ -2057,43 +2078,41 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma; #endif - /* name was clobbered by aout_write_syms to be symbol index */ + /* Name was clobbered by aout_write_syms to be symbol index. */ /* If this relocation is relative to a symbol then set the r_index to the symbols index, and the r_extern bit. Absolute symbols can come in in two ways, either as an offset from the abs section, or as a symbol which has an abs value. - check for that here - */ + check for that here. */ if (bfd_is_com_section (output_section) || bfd_is_abs_section (output_section) || bfd_is_und_section (output_section)) { if (bfd_abs_section_ptr->symbol == sym) - { - /* Whoops, looked like an abs symbol, but is really an offset - from the abs section */ - r_index = N_ABS; - r_extern = 0; - } + { + /* Whoops, looked like an abs symbol, but is + really an offset from the abs section. */ + r_index = N_ABS; + r_extern = 0; + } else - { - /* Fill in symbol */ - r_extern = 1; - r_index = (*(g->sym_ptr_ptr))->KEEPIT; - - } + { + /* Fill in symbol. */ + r_extern = 1; + r_index = (*(g->sym_ptr_ptr))->KEEPIT; + } } else { - /* Just an ordinary section */ + /* Just an ordinary section. */ r_extern = 0; r_index = output_section->target_index; } - /* now the fun stuff */ + /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { natptr->r_index[0] = r_index >> 16; @@ -2120,7 +2139,7 @@ NAME(aout,swap_std_reloc_out) (abfd, g, natptr) } } -/* Extended stuff */ +/* Extended stuff. */ /* Output extended relocation information to a file in target byte order. */ extern void NAME(aout,swap_ext_reloc_out) @@ -2153,7 +2172,6 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) Absolute symbols can come in in two ways, either as an offset from the abs section, or as a symbol which has an abs value. check for that here. */ - if (bfd_is_abs_section (bfd_get_section (sym))) { r_extern = 0; @@ -2170,12 +2188,12 @@ NAME(aout,swap_ext_reloc_out) (abfd, g, natptr) } else { - /* Just an ordinary section */ + /* Just an ordinary section. */ r_extern = 0; r_index = output_section->target_index; } - /* now the fun stuff */ + /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { natptr->r_index[0] = r_index >> 16; @@ -2256,7 +2274,7 @@ NAME(aout,swap_ext_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) cache_ptr->address = (GET_SWORD (abfd, bytes->r_address)); - /* now the fun stuff */ + /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { r_index = (((unsigned int) bytes->r_index[0] << 16) @@ -2315,7 +2333,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) cache_ptr->address = H_GET_32 (abfd, bytes->r_address); - /* now the fun stuff */ + /* Now the fun stuff. */ if (bfd_header_big_endian (abfd)) { r_index = (((unsigned int) bytes->r_index[0] << 16) @@ -2368,7 +2386,7 @@ NAME(aout,swap_std_reloc_in) (abfd, bytes, cache_ptr, symbols, symcount) /* Read and swap the relocs for a section. */ -boolean +bfd_boolean NAME(aout,slurp_reloc_table) (abfd, asect, symbols) bfd *abfd; sec_ptr asect; @@ -2384,10 +2402,10 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) bfd_size_type amt; if (asect->relocation) - return true; + return TRUE; if (asect->flags & SEC_CONSTRUCTOR) - return true; + return TRUE; if (asect == obj_datasec (abfd)) reloc_size = exec_hdr (abfd)->a_drsize; @@ -2398,11 +2416,11 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) else { bfd_set_error (bfd_error_invalid_operation); - return false; + return FALSE; } if (bfd_seek (abfd, asect->rel_filepos, SEEK_SET) != 0) - return false; + return FALSE; each_size = obj_reloc_entry_size (abfd); @@ -2411,20 +2429,20 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) amt = count * sizeof (arelent); reloc_cache = (arelent *) bfd_zmalloc (amt); if (reloc_cache == NULL && count != 0) - return false; + return FALSE; relocs = bfd_malloc (reloc_size); if (relocs == NULL && reloc_size != 0) { free (reloc_cache); - return false; + return FALSE; } if (bfd_bread (relocs, reloc_size, abfd) != reloc_size) { free (relocs); free (reloc_cache); - return false; + return FALSE; } cache_ptr = reloc_cache; @@ -2450,12 +2468,12 @@ NAME(aout,slurp_reloc_table) (abfd, asect, symbols) asect->relocation = reloc_cache; asect->reloc_count = cache_ptr - reloc_cache; - return true; + return TRUE; } /* Write out a relocation section into an object file. */ -boolean +bfd_boolean NAME(aout,squirt_out_relocs) (abfd, section) bfd *abfd; asection *section; @@ -2468,13 +2486,13 @@ NAME(aout,squirt_out_relocs) (abfd, section) bfd_size_type natsize; if (count == 0 || section->orelocation == NULL) - return true; + return TRUE; each_size = obj_reloc_entry_size (abfd); natsize = (bfd_size_type) each_size * count; native = (unsigned char *) bfd_zalloc (abfd, natsize); if (!native) - return false; + return FALSE; generic = section->orelocation; @@ -2498,14 +2516,15 @@ NAME(aout,squirt_out_relocs) (abfd, section) if (bfd_bwrite ((PTR) native, natsize, abfd) != natsize) { bfd_release (abfd, native); - return false; + return FALSE; } bfd_release (abfd, native); - return true; + return TRUE; } -/* This is stupid. This function should be a boolean predicate */ +/* This is stupid. This function should be a boolean predicate. */ + long NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols) bfd *abfd; @@ -2558,10 +2577,9 @@ NAME(aout,get_reloc_upper_bound) (abfd, asect) bfd_set_error (bfd_error_invalid_operation); return -1; } + if (asect->flags & SEC_CONSTRUCTOR) - { - return (sizeof (arelent *) * (asect->reloc_count+1)); - } + return (sizeof (arelent *) * (asect->reloc_count+1)); if (asect == obj_datasec (abfd)) return (sizeof (arelent *) @@ -2679,7 +2697,7 @@ NAME(aout,print_symbol) (abfd, afile, symbol, how) long NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) bfd *abfd; - boolean dynamic; + bfd_boolean dynamic; PTR *minisymsp; unsigned int *sizep; { @@ -2715,7 +2733,7 @@ NAME(aout,read_minisymbols) (abfd, dynamic, minisymsp, sizep) asymbol * NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) bfd *abfd; - boolean dynamic; + bfd_boolean dynamic; const PTR minisym; asymbol *sym; { @@ -2733,19 +2751,17 @@ NAME(aout,minisymbol_to_symbol) (abfd, dynamic, minisym, sym) (bfd_size_type) 1, obj_aout_external_strings (abfd), obj_aout_external_string_size (abfd), - false))) + FALSE))) return NULL; return sym; } -/* - provided a BFD, a section and an offset into the section, calculate - and return the name of the source file and the line nearest to the - wanted location. -*/ +/* Provided a BFD, a section and an offset into the section, calculate + and return the name of the source file and the line nearest to the + wanted location. */ -boolean +bfd_boolean NAME(aout,find_nearest_line) (abfd, section, symbols, offset, filename_ptr, functionname_ptr, line_ptr) bfd *abfd; @@ -2756,7 +2772,7 @@ NAME(aout,find_nearest_line) const char **functionname_ptr; unsigned int *line_ptr; { - /* Run down the file looking for the filename, function and linenumber */ + /* Run down the file looking for the filename, function and linenumber. */ asymbol **p; const char *directory_name = NULL; const char *main_file_name = NULL; @@ -2772,6 +2788,7 @@ NAME(aout,find_nearest_line) *filename_ptr = abfd->filename; *functionname_ptr = 0; *line_ptr = 0; + if (symbols != (asymbol **)NULL) { for (p = symbols; *p; p++) @@ -2859,12 +2876,13 @@ NAME(aout,find_nearest_line) break; case N_FUN: { - /* We'll keep this if it is nearer than the one we have already */ + /* We'll keep this if it is nearer than the one we have already. */ if (q->symbol.value >= low_func_vma && - q->symbol.value <= offset) { - low_func_vma = q->symbol.value; - func = (asymbol *)q; - } + q->symbol.value <= offset) + { + low_func_vma = q->symbol.value; + func = (asymbol *)q; + } else if (q->symbol.value > offset) goto done; } @@ -2886,6 +2904,7 @@ NAME(aout,find_nearest_line) filelen = 0; else filelen = strlen (directory_name) + strlen (main_file_name); + if (func == NULL) funclen = 0; else @@ -2893,6 +2912,7 @@ NAME(aout,find_nearest_line) if (adata (abfd).line_buf != NULL) free (adata (abfd).line_buf); + if (filelen + funclen == 0) adata (abfd).line_buf = buf = NULL; else @@ -2900,7 +2920,7 @@ NAME(aout,find_nearest_line) buf = (char *) bfd_malloc (filelen + funclen + 3); adata (abfd).line_buf = buf; if (buf == NULL) - return false; + return FALSE; } if (main_file_name != NULL) @@ -2930,20 +2950,20 @@ NAME(aout,find_nearest_line) buf[0] = bfd_get_symbol_leading_char (abfd); strcpy (buf + 1, function); } - /* Have to remove : stuff */ + /* Have to remove : stuff. */ colon = strchr (buf, ':'); if (colon != NULL) *colon = '\0'; *functionname_ptr = buf; } - return true; + return TRUE; } int NAME(aout,sizeof_headers) (abfd, execable) bfd *abfd; - boolean execable ATTRIBUTE_UNUSED; + bfd_boolean execable ATTRIBUTE_UNUSED; { return adata (abfd).exec_bytes_size; } @@ -2951,7 +2971,7 @@ NAME(aout,sizeof_headers) (abfd, execable) /* Free all information we have cached for this BFD. We can always read it again later if we need it. */ -boolean +bfd_boolean NAME(aout,bfd_free_cached_info) (abfd) bfd *abfd; { @@ -2959,7 +2979,7 @@ NAME(aout,bfd_free_cached_info) (abfd) if (bfd_get_format (abfd) != bfd_object || abfd->tdata.aout_data == NULL) - return true; + return TRUE; #define BFCI_FREE(x) if (x != NULL) { free (x); x = NULL; } BFCI_FREE (obj_aout_symbols (abfd)); @@ -2976,19 +2996,20 @@ NAME(aout,bfd_free_cached_info) (abfd) BFCI_FREE (o->relocation); #undef BFCI_FREE - return true; + return TRUE; } /* a.out link code. */ -static boolean aout_link_add_object_symbols +static bfd_boolean aout_link_add_object_symbols PARAMS ((bfd *, struct bfd_link_info *)); -static boolean aout_link_check_archive_element - PARAMS ((bfd *, struct bfd_link_info *, boolean *)); -static boolean aout_link_free_symbols PARAMS ((bfd *)); -static boolean aout_link_check_ar_symbols - PARAMS ((bfd *, struct bfd_link_info *, boolean *pneeded)); -static boolean aout_link_add_symbols +static bfd_boolean aout_link_check_archive_element + PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *)); +static bfd_boolean aout_link_free_symbols + PARAMS ((bfd *)); +static bfd_boolean aout_link_check_ar_symbols + PARAMS ((bfd *, struct bfd_link_info *, bfd_boolean *pneeded)); +static bfd_boolean aout_link_add_symbols PARAMS ((bfd *, struct bfd_link_info *)); /* Routine to create an entry in an a.out link hash table. */ @@ -3016,7 +3037,7 @@ NAME(aout,link_hash_newfunc) (entry, table, string) if (ret) { /* Set local fields. */ - ret->written = false; + ret->written = FALSE; ret->indx = -1; } @@ -3025,13 +3046,13 @@ NAME(aout,link_hash_newfunc) (entry, table, string) /* Initialize an a.out link hash table. */ -boolean +bfd_boolean NAME(aout,link_hash_table_init) (table, abfd, newfunc) struct aout_link_hash_table *table; bfd *abfd; - struct bfd_hash_entry *(*newfunc) PARAMS ((struct bfd_hash_entry *, - struct bfd_hash_table *, - const char *)); + struct bfd_hash_entry *(*newfunc) + PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, + const char *)); { return _bfd_link_hash_table_init (&table->root, abfd, newfunc); } @@ -3045,9 +3066,10 @@ NAME(aout,link_hash_table_create) (abfd) struct aout_link_hash_table *ret; bfd_size_type amt = sizeof (struct aout_link_hash_table); - ret = (struct aout_link_hash_table *) bfd_alloc (abfd, amt); + ret = (struct aout_link_hash_table *) bfd_malloc (amt); if (ret == NULL) return (struct bfd_link_hash_table *) NULL; + if (! NAME(aout,link_hash_table_init) (ret, abfd, NAME(aout,link_hash_newfunc))) { @@ -3060,7 +3082,7 @@ NAME(aout,link_hash_table_create) (abfd) /* Given an a.out BFD, add symbols to the global hash table as appropriate. */ -boolean +bfd_boolean NAME(aout,link_add_symbols) (abfd, info) bfd *abfd; struct bfd_link_info *info; @@ -3074,27 +3096,27 @@ NAME(aout,link_add_symbols) (abfd, info) (abfd, info, aout_link_check_archive_element); default: bfd_set_error (bfd_error_wrong_format); - return false; + return FALSE; } } /* Add symbols from an a.out object file. */ -static boolean +static bfd_boolean aout_link_add_object_symbols (abfd, info) bfd *abfd; struct bfd_link_info *info; { if (! aout_get_external_symbols (abfd)) - return false; + return FALSE; if (! aout_link_add_symbols (abfd, info)) - return false; + return FALSE; if (! info->keep_memory) { if (! aout_link_free_symbols (abfd)) - return false; + return FALSE; } - return true; + return TRUE; } /* Check a single archive element to see if we need to include it in @@ -3102,36 +3124,36 @@ aout_link_add_object_symbols (abfd, info) needed in the link or not. This is called from _bfd_generic_link_add_archive_symbols. */ -static boolean +static bfd_boolean aout_link_check_archive_element (abfd, info, pneeded) bfd *abfd; struct bfd_link_info *info; - boolean *pneeded; + bfd_boolean *pneeded; { if (! aout_get_external_symbols (abfd)) - return false; + return FALSE; if (! aout_link_check_ar_symbols (abfd, info, pneeded)) - return false; + return FALSE; if (*pneeded) { if (! aout_link_add_symbols (abfd, info)) - return false; + return FALSE; } if (! info->keep_memory || ! *pneeded) { if (! aout_link_free_symbols (abfd)) - return false; + return FALSE; } - return true; + return TRUE; } /* Free up the internal symbols read from an a.out file. */ -static boolean +static bfd_boolean aout_link_free_symbols (abfd) bfd *abfd; { @@ -3153,7 +3175,7 @@ aout_link_free_symbols (abfd) #endif obj_aout_external_strings (abfd) = (char *) NULL; } - return true; + return TRUE; } /* Look through the internal symbols to see if this object file should @@ -3163,17 +3185,17 @@ aout_link_free_symbols (abfd) known symbol but we do not include the object file in the link (unless there is some other reason to include it). */ -static boolean +static bfd_boolean aout_link_check_ar_symbols (abfd, info, pneeded) bfd *abfd; struct bfd_link_info *info; - boolean *pneeded; + bfd_boolean *pneeded; { register struct external_nlist *p; struct external_nlist *pend; char *strings; - *pneeded = false; + *pneeded = FALSE; /* Look through all the symbols. */ p = obj_aout_external_syms (abfd); @@ -3203,7 +3225,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded) } name = strings + GET_WORD (abfd, p->e_strx); - h = bfd_link_hash_lookup (info->hash, name, false, false, true); + h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); /* We are only interested in symbols that are currently undefined or common. */ @@ -3224,23 +3246,47 @@ aout_link_check_ar_symbols (abfd, info, pneeded) { /* This object file defines this symbol. We must link it in. This is true regardless of whether the current - definition of the symbol is undefined or common. If the - current definition is common, we have a case in which we - have already seen an object file including + definition of the symbol is undefined or common. + + If the current definition is common, we have a case in + which we have already seen an object file including: int a; - and this object file from the archive includes + and this object file from the archive includes: int a = 5; - In such a case we must include this object file. + In such a case, whether to include this object is target + dependant for backward compatibility. FIXME: The SunOS 4.1.3 linker will pull in the archive element if the symbol is defined in the .data section, but not if it is defined in the .text section. That - seems a bit crazy to me, and I haven't implemented it. - However, it might be correct. */ + seems a bit crazy to me, and it has not been implemented + yet. However, it might be correct. */ + if (h->type == bfd_link_hash_common) + { + int skip = 0; + + switch (info->common_skip_ar_aymbols) + { + case bfd_link_common_skip_text: + skip = (type == (N_TEXT | N_EXT)); + break; + case bfd_link_common_skip_data: + skip = (type == (N_DATA | N_EXT)); + break; + default: + case bfd_link_common_skip_all: + skip = 1; + break; + } + + if (skip) + continue; + } + if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; + return FALSE; + *pneeded = TRUE; + return TRUE; } if (type == (N_UNDF | N_EXT)) @@ -3267,9 +3313,9 @@ aout_link_check_ar_symbols (abfd, info, pneeded) if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; + return FALSE; + *pneeded = TRUE; + return TRUE; } /* Turn the current link symbol into a common symbol. It is already on the undefs list. */ @@ -3278,7 +3324,7 @@ aout_link_check_ar_symbols (abfd, info, pneeded) bfd_hash_allocate (&info->hash->table, sizeof (struct bfd_link_hash_common_entry))); if (h->u.c.p == NULL) - return false; + return FALSE; h->u.c.size = value; @@ -3315,33 +3361,32 @@ aout_link_check_ar_symbols (abfd, info, pneeded) if (h->type == bfd_link_hash_undefined) { if (! (*info->callbacks->add_archive_element) (info, abfd, name)) - return false; - *pneeded = true; - return true; + return FALSE; + *pneeded = TRUE; + return TRUE; } } } /* We do not need this object file. */ - return true; + return TRUE; } /* Add all symbols from an object file to the hash table. */ -static boolean +static bfd_boolean aout_link_add_symbols (abfd, info) bfd *abfd; struct bfd_link_info *info; { - boolean (*add_one_symbol) PARAMS ((struct bfd_link_info *, bfd *, - const char *, flagword, asection *, - bfd_vma, const char *, boolean, - boolean, - struct bfd_link_hash_entry **)); + bfd_boolean (*add_one_symbol) + PARAMS ((struct bfd_link_info *, bfd *, const char *, flagword, asection *, + bfd_vma, const char *, bfd_boolean, bfd_boolean, + struct bfd_link_hash_entry **)); struct external_nlist *syms; bfd_size_type sym_count; char *strings; - boolean copy; + bfd_boolean copy; struct aout_link_hash_entry **sym_hash; register struct external_nlist *p; struct external_nlist *pend; @@ -3351,15 +3396,15 @@ aout_link_add_symbols (abfd, info) sym_count = obj_aout_external_sym_count (abfd); strings = obj_aout_external_strings (abfd); if (info->keep_memory) - copy = false; + copy = FALSE; else - copy = true; + copy = TRUE; if (aout_backend_info (abfd)->add_dynamic_symbols != NULL) { if (! ((*aout_backend_info (abfd)->add_dynamic_symbols) (abfd, info, &syms, &sym_count, &strings))) - return false; + return FALSE; } /* We keep a list of the linker hash table entries that correspond @@ -3369,7 +3414,7 @@ aout_link_add_symbols (abfd, info) amt = sym_count * sizeof (struct aout_link_hash_entry *); sym_hash = (struct aout_link_hash_entry **) bfd_alloc (abfd, amt); if (sym_hash == NULL && sym_count != 0) - return false; + return FALSE; obj_aout_sym_hashes (abfd) = sym_hash; add_one_symbol = aout_backend_info (abfd)->add_one_symbol; @@ -3515,9 +3560,9 @@ aout_link_add_symbols (abfd, info) } if (! ((*add_one_symbol) - (info, abfd, name, flags, section, value, string, copy, false, + (info, abfd, name, flags, section, value, string, copy, FALSE, (struct bfd_link_hash_entry **) sym_hash))) - return false; + return FALSE; /* Restrict the maximum alignment of a common symbol based on the architecture, since a.out has no way to represent @@ -3543,7 +3588,7 @@ aout_link_add_symbols (abfd, info) ++sym_hash; } - return true; + return TRUE; } /* A hash table used for header files with N_BINCL entries. */ @@ -3606,27 +3651,27 @@ struct aout_final_link_info static struct bfd_hash_entry *aout_link_includes_newfunc PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); -static boolean aout_link_input_bfd +static bfd_boolean aout_link_input_bfd PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static boolean aout_link_write_symbols +static bfd_boolean aout_link_write_symbols PARAMS ((struct aout_final_link_info *, bfd *input_bfd)); -static boolean aout_link_write_other_symbol +static bfd_boolean aout_link_write_other_symbol PARAMS ((struct aout_link_hash_entry *, PTR)); -static boolean aout_link_input_section +static bfd_boolean aout_link_input_section PARAMS ((struct aout_final_link_info *, bfd *input_bfd, asection *input_section, file_ptr *reloff_ptr, bfd_size_type rel_size)); -static boolean aout_link_input_section_std +static bfd_boolean aout_link_input_section_std PARAMS ((struct aout_final_link_info *, bfd *input_bfd, asection *input_section, struct reloc_std_external *, bfd_size_type rel_size, bfd_byte *contents)); -static boolean aout_link_input_section_ext +static bfd_boolean aout_link_input_section_ext PARAMS ((struct aout_final_link_info *, bfd *input_bfd, asection *input_section, struct reloc_ext_external *, bfd_size_type rel_size, bfd_byte *contents)); static INLINE asection *aout_reloc_index_to_section PARAMS ((bfd *, int)); -static boolean aout_link_reloc_link_order +static bfd_boolean aout_link_reloc_link_order PARAMS ((struct aout_final_link_info *, asection *, struct bfd_link_order *)); @@ -3669,14 +3714,14 @@ aout_link_includes_newfunc (entry, table, string) of bfd_link_order structures which list all the input sections for the output section. */ -boolean +bfd_boolean NAME(aout,final_link) (abfd, info, callback) bfd *abfd; struct bfd_link_info *info; void (*callback) PARAMS ((bfd *, file_ptr *, file_ptr *, file_ptr *)); { struct aout_final_link_info aout_info; - boolean includes_hash_initialized = false; + bfd_boolean includes_hash_initialized = FALSE; register bfd *sub; bfd_size_type trsize, drsize; bfd_size_type max_contents_size; @@ -3686,7 +3731,7 @@ NAME(aout,final_link) (abfd, info, callback) file_ptr text_end; register struct bfd_link_order *p; asection *o; - boolean have_link_order_relocs; + bfd_boolean have_link_order_relocs; if (info->shared) abfd->flags |= DYNAMIC; @@ -3702,10 +3747,10 @@ NAME(aout,final_link) (abfd, info, callback) aout_link_includes_newfunc, 251)) goto error_return; - includes_hash_initialized = true; + includes_hash_initialized = TRUE; /* Figure out the largest section size. Also, if generating - relocateable output, count the relocs. */ + relocatable output, count the relocs. */ trsize = 0; drsize = 0; max_contents_size = 0; @@ -3715,7 +3760,7 @@ NAME(aout,final_link) (abfd, info, callback) { bfd_size_type sz; - if (info->relocateable) + if (info->relocatable) { if (bfd_get_flavour (sub) == bfd_target_aout_flavour) { @@ -3729,7 +3774,7 @@ NAME(aout,final_link) (abfd, info, callback) work out the number of relocs needed, and then multiply by the reloc size. */ (*_bfd_error_handler) - (_("%s: relocateable link from %s to %s not supported"), + (_("%s: relocatable link from %s to %s not supported"), bfd_get_filename (abfd), sub->xvec->name, abfd->xvec->name); bfd_set_error (bfd_error_invalid_operation); @@ -3759,7 +3804,7 @@ NAME(aout,final_link) (abfd, info, callback) } } - if (info->relocateable) + if (info->relocatable) { if (obj_textsec (abfd) != (asection *) NULL) trsize += (_bfd_count_link_order_relocs (obj_textsec (abfd) @@ -3825,7 +3870,7 @@ NAME(aout,final_link) (abfd, info, callback) struct aout_link_hash_entry *h; h = aout_link_hash_lookup (aout_hash_table (info), "__DYNAMIC", - false, false, false); + FALSE, FALSE, FALSE); if (h != NULL) aout_link_write_other_symbol (h, &aout_info); } @@ -3852,7 +3897,7 @@ NAME(aout,final_link) (abfd, info, callback) We use the output_has_begun field of the input BFDs to see whether we have already handled it. */ for (sub = info->input_bfds; sub != (bfd *) NULL; sub = sub->link_next) - sub->output_has_begun = false; + sub->output_has_begun = FALSE; /* Mark all sections which are to be included in the link. This will normally be every section. We need to do this so that we @@ -3861,13 +3906,11 @@ NAME(aout,final_link) (abfd, info, callback) for (o = abfd->sections; o != NULL; o = o->next) { for (p = o->link_order_head; p != NULL; p = p->next) - { - if (p->type == bfd_indirect_link_order) - p->u.indirect.section->linker_mark = (unsigned int) true; - } + if (p->type == bfd_indirect_link_order) + p->u.indirect.section->linker_mark = TRUE; } - have_link_order_relocs = false; + have_link_order_relocs = FALSE; for (o = abfd->sections; o != (asection *) NULL; o = o->next) { for (p = o->link_order_head; @@ -3885,14 +3928,14 @@ NAME(aout,final_link) (abfd, info, callback) { if (! aout_link_input_bfd (&aout_info, input_bfd)) goto error_return; - input_bfd->output_has_begun = true; + input_bfd->output_has_begun = TRUE; } } else if (p->type == bfd_section_reloc_link_order || p->type == bfd_symbol_reloc_link_order) { /* These are handled below. */ - have_link_order_relocs = true; + have_link_order_relocs = TRUE; } else { @@ -3952,7 +3995,7 @@ NAME(aout,final_link) (abfd, info, callback) if (includes_hash_initialized) { bfd_hash_table_free (&aout_info.includes.root); - includes_hash_initialized = false; + includes_hash_initialized = FALSE; } /* Finish up any dynamic linking we may be doing. */ @@ -3991,7 +4034,7 @@ NAME(aout,final_link) (abfd, info, callback) goto error_return; } - return true; + return TRUE; error_return: if (aout_info.contents != NULL) @@ -4004,12 +4047,12 @@ NAME(aout,final_link) (abfd, info, callback) free (aout_info.output_syms); if (includes_hash_initialized) bfd_hash_table_free (&aout_info.includes.root); - return false; + return FALSE; } /* Link an a.out input BFD into the output file. */ -static boolean +static bfd_boolean aout_link_input_bfd (finfo, input_bfd) struct aout_final_link_info *finfo; bfd *input_bfd; @@ -4027,16 +4070,16 @@ aout_link_input_bfd (finfo, input_bfd) } /* Get the symbols. We probably have them already, unless - finfo->info->keep_memory is false. */ + finfo->info->keep_memory is FALSE. */ if (! aout_get_external_symbols (input_bfd)) - return false; + return FALSE; sym_count = obj_aout_external_sym_count (input_bfd); /* Write out the symbols and get a map of the new indices. The map is placed into finfo->symbol_map. */ if (! aout_link_write_symbols (finfo, input_bfd)) - return false; + return FALSE; /* Relocate and write out the sections. These functions use the symbol map created by aout_link_write_symbols. The linker_mark @@ -4048,7 +4091,7 @@ aout_link_input_bfd (finfo, input_bfd) obj_textsec (input_bfd), &finfo->treloff, exec_hdr (input_bfd)->a_trsize)) - return false; + return FALSE; } if (obj_datasec (input_bfd)->linker_mark) { @@ -4056,7 +4099,7 @@ aout_link_input_bfd (finfo, input_bfd) obj_datasec (input_bfd), &finfo->dreloff, exec_hdr (input_bfd)->a_drsize)) - return false; + return FALSE; } /* If we are not keeping memory, we don't need the symbols any @@ -4065,16 +4108,16 @@ aout_link_input_bfd (finfo, input_bfd) if (! finfo->info->keep_memory) { if (! aout_link_free_symbols (input_bfd)) - return false; + return FALSE; } - return true; + return TRUE; } /* Adjust and write out the symbols for an a.out file. Set the new symbol indices into a symbol_map. */ -static boolean +static bfd_boolean aout_link_write_symbols (finfo, input_bfd) struct aout_final_link_info *finfo; bfd *input_bfd; @@ -4090,8 +4133,8 @@ aout_link_write_symbols (finfo, input_bfd) struct external_nlist *sym_end; struct aout_link_hash_entry **sym_hash; int *symbol_map; - boolean pass; - boolean skip_next; + bfd_boolean pass; + bfd_boolean skip_next; output_bfd = finfo->output_bfd; sym_count = obj_aout_external_sym_count (input_bfd); @@ -4105,16 +4148,16 @@ aout_link_write_symbols (finfo, input_bfd) if (strip != strip_all && (strip != strip_some || bfd_hash_lookup (finfo->info->keep_hash, input_bfd->filename, - false, false) != NULL) + FALSE, FALSE) != NULL) && discard != discard_all) { H_PUT_8 (output_bfd, N_TEXT, outsym->e_type); H_PUT_8 (output_bfd, 0, outsym->e_other); H_PUT_16 (output_bfd, 0, outsym->e_desc); strtab_index = add_to_stringtab (output_bfd, finfo->strtab, - input_bfd->filename, false); + input_bfd->filename, FALSE); if (strtab_index == (bfd_size_type) -1) - return false; + return FALSE; PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, (bfd_get_section_vma (output_bfd, @@ -4125,8 +4168,8 @@ aout_link_write_symbols (finfo, input_bfd) ++outsym; } - pass = false; - skip_next = false; + pass = FALSE; + skip_next = FALSE; sym = obj_aout_external_syms (input_bfd); sym_end = sym + sym_count; sym_hash = obj_aout_sym_hashes (input_bfd); @@ -4137,10 +4180,10 @@ aout_link_write_symbols (finfo, input_bfd) const char *name; int type; struct aout_link_hash_entry *h; - boolean skip; + bfd_boolean skip; asection *symsec; bfd_vma val = 0; - boolean copy; + bfd_boolean copy; /* We set *symbol_map to 0 above for all symbols. If it has already been set to -1 for this symbol, it means that we are @@ -4164,14 +4207,14 @@ aout_link_write_symbols (finfo, input_bfd) /* Pass this symbol through. It is the target of an indirect or warning symbol. */ val = GET_WORD (input_bfd, sym->e_value); - pass = false; + pass = FALSE; } else if (skip_next) { /* Skip this symbol, which is the target of an indirect symbol that we have changed to no longer be an indirect symbol. */ - skip_next = false; + skip_next = FALSE; continue; } else @@ -4213,34 +4256,34 @@ aout_link_write_symbols (finfo, input_bfd) { if ((type & N_TYPE) == N_INDR || type == N_WARNING) - skip_next = true; + skip_next = TRUE; *symbol_map = h->indx; continue; } /* See if we are stripping this symbol. */ - skip = false; + skip = FALSE; switch (strip) { case strip_none: break; case strip_debugger: if ((type & N_STAB) != 0) - skip = true; + skip = TRUE; break; case strip_some: - if (bfd_hash_lookup (finfo->info->keep_hash, name, false, false) + if (bfd_hash_lookup (finfo->info->keep_hash, name, FALSE, FALSE) == NULL) - skip = true; + skip = TRUE; break; case strip_all: - skip = true; + skip = TRUE; break; } if (skip) { if (h != (struct aout_link_hash_entry *) NULL) - h->written = true; + h->written = TRUE; continue; } @@ -4269,7 +4312,7 @@ aout_link_write_symbols (finfo, input_bfd) the indirect symbol was defined, we output it with the correct definition so the debugger will understand it. */ - pass = true; + pass = TRUE; val = GET_WORD (input_bfd, sym->e_value); symsec = NULL; } @@ -4285,7 +4328,7 @@ aout_link_write_symbols (finfo, input_bfd) a case we do not want to output the next symbol, which is the target of the indirection. */ if ((type & N_TYPE) == N_INDR) - skip_next = true; + skip_next = TRUE; symsec = NULL; @@ -4377,7 +4420,7 @@ aout_link_write_symbols (finfo, input_bfd) it is a local symbol see if we should discard it. */ if (h != (struct aout_link_hash_entry *) NULL) { - h->written = true; + h->written = TRUE; h->indx = obj_aout_external_sym_count (output_bfd); } else if ((type & N_TYPE) != N_SETT @@ -4393,15 +4436,15 @@ aout_link_write_symbols (finfo, input_bfd) case discard_l: if ((type & N_STAB) == 0 && bfd_is_local_label_name (input_bfd, name)) - skip = true; + skip = TRUE; break; case discard_all: - skip = true; + skip = TRUE; break; } if (skip) { - pass = false; + pass = FALSE; continue; } } @@ -4457,11 +4500,11 @@ aout_link_write_symbols (finfo, input_bfd) /* If we have already included a header file with the same value, then replace this one with an N_EXCL symbol. */ - copy = (boolean) (! finfo->info->keep_memory); + copy = (bfd_boolean) (! finfo->info->keep_memory); incl_entry = aout_link_includes_lookup (&finfo->includes, - name, true, copy); + name, TRUE, copy); if (incl_entry == NULL) - return false; + return FALSE; for (t = incl_entry->totals; t != NULL; t = t->next) if (t->total == val) break; @@ -4473,7 +4516,7 @@ aout_link_write_symbols (finfo, input_bfd) bfd_hash_allocate (&finfo->includes.root, sizeof *t)); if (t == NULL) - return false; + return FALSE; t->total = val; t->next = incl_entry->totals; incl_entry->totals = t; @@ -4518,7 +4561,7 @@ aout_link_write_symbols (finfo, input_bfd) H_PUT_8 (output_bfd, type, outsym->e_type); H_PUT_8 (output_bfd, H_GET_8 (input_bfd, sym->e_other), outsym->e_other); H_PUT_16 (output_bfd, H_GET_16 (input_bfd, sym->e_desc), outsym->e_desc); - copy = false; + copy = FALSE; if (! finfo->info->keep_memory) { /* name points into a string table which we are going to @@ -4527,12 +4570,12 @@ aout_link_write_symbols (finfo, input_bfd) if (h != (struct aout_link_hash_entry *) NULL) name = h->root.root.string; else - copy = true; + copy = TRUE; } strtab_index = add_to_stringtab (output_bfd, finfo->strtab, name, copy); if (strtab_index == (bfd_size_type) -1) - return false; + return FALSE; PUT_WORD (output_bfd, strtab_index, outsym->e_strx); PUT_WORD (output_bfd, val, outsym->e_value); *symbol_map = obj_aout_external_sym_count (output_bfd); @@ -4546,22 +4589,22 @@ aout_link_write_symbols (finfo, input_bfd) bfd_size_type outsym_size; if (bfd_seek (output_bfd, finfo->symoff, SEEK_SET) != 0) - return false; + return FALSE; outsym_size = outsym - finfo->output_syms; outsym_size *= EXTERNAL_NLIST_SIZE; if (bfd_bwrite ((PTR) finfo->output_syms, outsym_size, output_bfd) != outsym_size) - return false; + return FALSE; finfo->symoff += outsym_size; } - return true; + return TRUE; } /* Write out a symbol that was not associated with an a.out input object. */ -static boolean +static bfd_boolean aout_link_write_other_symbol (h, data) struct aout_link_hash_entry *h; PTR data; @@ -4578,7 +4621,7 @@ aout_link_write_other_symbol (h, data) { h = (struct aout_link_hash_entry *) h->root.u.i.link; if (h->root.type == bfd_link_hash_new) - return true; + return TRUE; } output_bfd = finfo->output_bfd; @@ -4594,17 +4637,17 @@ aout_link_write_other_symbol (h, data) } if (h->written) - return true; + return TRUE; - h->written = true; + h->written = TRUE; /* An indx of -2 means the symbol must be written. */ if (h->indx != -2 && (finfo->info->strip == strip_all || (finfo->info->strip == strip_some && bfd_hash_lookup (finfo->info->keep_hash, h->root.root.string, - false, false) == NULL))) - return true; + FALSE, FALSE) == NULL))) + return TRUE; switch (h->root.type) { @@ -4612,11 +4655,11 @@ aout_link_write_other_symbol (h, data) case bfd_link_hash_warning: abort (); /* Avoid variable not initialized warnings. */ - return true; + return TRUE; case bfd_link_hash_new: /* This can happen for set symbols when sets are not being built. */ - return true; + return TRUE; case bfd_link_hash_undefined: type = N_UNDF | N_EXT; val = 0; @@ -4653,14 +4696,14 @@ aout_link_write_other_symbol (h, data) case bfd_link_hash_indirect: /* We ignore these symbols, since the indirected symbol is already in the hash table. */ - return true; + return TRUE; } H_PUT_8 (output_bfd, type, outsym.e_type); H_PUT_8 (output_bfd, 0, outsym.e_other); H_PUT_16 (output_bfd, 0, outsym.e_desc); indx = add_to_stringtab (output_bfd, finfo->strtab, h->root.root.string, - false); + FALSE); if (indx == - (bfd_size_type) 1) { /* FIXME: No way to handle errors. */ @@ -4681,12 +4724,12 @@ aout_link_write_other_symbol (h, data) h->indx = obj_aout_external_sym_count (output_bfd); ++obj_aout_external_sym_count (output_bfd); - return true; + return TRUE; } /* Link an a.out section into the output file. */ -static boolean +static bfd_boolean aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, rel_size) struct aout_final_link_info *finfo; @@ -4703,7 +4746,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, if (! bfd_get_section_contents (input_bfd, input_section, (PTR) finfo->contents, (file_ptr) 0, input_size)) - return false; + return FALSE; /* Read in the relocs if we haven't already done it. */ if (aout_section_data (input_section) != NULL @@ -4716,7 +4759,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, { if (bfd_seek (input_bfd, input_section->rel_filepos, SEEK_SET) != 0 || bfd_bread (relocs, rel_size, input_bfd) != rel_size) - return false; + return FALSE; } } @@ -4726,14 +4769,14 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, if (! aout_link_input_section_std (finfo, input_bfd, input_section, (struct reloc_std_external *) relocs, rel_size, finfo->contents)) - return false; + return FALSE; } else { if (! aout_link_input_section_ext (finfo, input_bfd, input_section, (struct reloc_ext_external *) relocs, rel_size, finfo->contents)) - return false; + return FALSE; } /* Write out the section contents. */ @@ -4742,16 +4785,16 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, (PTR) finfo->contents, (file_ptr) input_section->output_offset, input_size)) - return false; + return FALSE; - /* If we are producing relocateable output, the relocs were + /* If we are producing relocatable output, the relocs were modified, and we now write them out. */ - if (finfo->info->relocateable && rel_size > 0) + if (finfo->info->relocatable && rel_size > 0) { if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0) - return false; + return FALSE; if (bfd_bwrite (relocs, rel_size, finfo->output_bfd) != rel_size) - return false; + return FALSE; *reloff_ptr += rel_size; /* Assert that the relocs have not run into the symbols, and @@ -4763,7 +4806,7 @@ aout_link_input_section (finfo, input_bfd, input_section, reloff_ptr, <= obj_datasec (finfo->output_bfd)->rel_filepos))); } - return true; + return TRUE; } /* Get the section corresponding to a reloc index. */ @@ -4793,7 +4836,7 @@ aout_reloc_index_to_section (abfd, indx) /* Relocate an a.out section using standard a.out relocs. */ -static boolean +static bfd_boolean aout_link_input_section_std (finfo, input_bfd, input_section, relocs, rel_size, contents) struct aout_final_link_info *finfo; @@ -4803,13 +4846,12 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, bfd_size_type rel_size; bfd_byte *contents; { - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, - bfd *, asection *, - struct aout_link_hash_entry *, - PTR, bfd_byte *, boolean *, - bfd_vma *)); + bfd_boolean (*check_dynamic_reloc) + PARAMS ((struct bfd_link_info *, bfd *, asection *, + struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, + bfd_vma *)); bfd *output_bfd; - boolean relocateable; + bfd_boolean relocatable; struct external_nlist *syms; char *strings; struct aout_link_hash_entry **sym_hashes; @@ -4825,7 +4867,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, BFD_ASSERT (input_bfd->xvec->header_byteorder == output_bfd->xvec->header_byteorder); - relocateable = finfo->info->relocateable; + relocatable = finfo->info->relocatable; syms = obj_aout_external_syms (input_bfd); strings = obj_aout_external_strings (input_bfd); sym_hashes = obj_aout_sym_hashes (input_bfd); @@ -4894,9 +4936,9 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, } #endif - if (relocateable) + if (relocatable) { - /* We are generating a relocateable output file, and must + /* We are generating a relocatable output file, and must modify the reloc accordingly. */ if (r_extern) { @@ -4951,10 +4993,10 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (h->indx < 0) { h->indx = -2; - h->written = false; + h->written = FALSE; if (! aout_link_write_other_symbol (h, (PTR) finfo)) - return false; + return FALSE; } r_index = h->indx; } @@ -4967,7 +5009,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (! ((*finfo->info->callbacks->unattached_reloc) (finfo->info, name, input_bfd, input_section, r_addr))) - return false; + return FALSE; r_index = 0; } } @@ -5027,11 +5069,11 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, } else { - boolean hundef; + bfd_boolean hundef; /* We are generating an executable, and must do a full relocation. */ - hundef = false; + hundef = FALSE; if (r_extern) { @@ -5050,7 +5092,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, relocation = 0; else { - hundef = true; + hundef = TRUE; relocation = 0; } } @@ -5068,12 +5110,12 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (check_dynamic_reloc != NULL) { - boolean skip; + bfd_boolean skip; if (! ((*check_dynamic_reloc) (finfo->info, input_bfd, input_section, h, (PTR) rel, contents, &skip, &relocation))) - return false; + return FALSE; if (skip) continue; } @@ -5091,8 +5133,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) (finfo->info, name, input_bfd, input_section, - r_addr, true))) - return false; + r_addr, TRUE))) + return FALSE; } r = MY_final_link_relocate (howto, @@ -5127,19 +5169,19 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs, if (! ((*finfo->info->callbacks->reloc_overflow) (finfo->info, name, howto->name, (bfd_vma) 0, input_bfd, input_section, r_addr))) - return false; + return FALSE; } break; } } } - return true; + return TRUE; } /* Relocate an a.out section using extended a.out relocs. */ -static boolean +static bfd_boolean aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, rel_size, contents) struct aout_final_link_info *finfo; @@ -5149,13 +5191,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, bfd_size_type rel_size; bfd_byte *contents; { - boolean (*check_dynamic_reloc) PARAMS ((struct bfd_link_info *, - bfd *, asection *, - struct aout_link_hash_entry *, - PTR, bfd_byte *, boolean *, - bfd_vma *)); + bfd_boolean (*check_dynamic_reloc) + PARAMS ((struct bfd_link_info *, bfd *, asection *, + struct aout_link_hash_entry *, PTR, bfd_byte *, bfd_boolean *, + bfd_vma *)); bfd *output_bfd; - boolean relocateable; + bfd_boolean relocatable; struct external_nlist *syms; char *strings; struct aout_link_hash_entry **sym_hashes; @@ -5171,7 +5212,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, BFD_ASSERT (input_bfd->xvec->header_byteorder == output_bfd->xvec->header_byteorder); - relocateable = finfo->info->relocateable; + relocatable = finfo->info->relocatable; syms = obj_aout_external_syms (input_bfd); strings = obj_aout_external_strings (input_bfd); sym_hashes = obj_aout_sym_hashes (input_bfd); @@ -5216,9 +5257,9 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, BFD_ASSERT (r_type < TABLE_SIZE (howto_table_ext)); - if (relocateable) + if (relocatable) { - /* We are generating a relocateable output file, and must + /* We are generating a relocatable output file, and must modify the reloc accordingly. */ if (r_extern || r_type == (unsigned int) RELOC_BASE10 @@ -5289,10 +5330,10 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (h->indx < 0) { h->indx = -2; - h->written = false; + h->written = FALSE; if (! aout_link_write_other_symbol (h, (PTR) finfo)) - return false; + return FALSE; } r_index = h->indx; } @@ -5305,7 +5346,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (! ((*finfo->info->callbacks->unattached_reloc) (finfo->info, name, input_bfd, input_section, r_addr))) - return false; + return FALSE; r_index = 0; } } @@ -5370,12 +5411,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, } else { - boolean hundef; + bfd_boolean hundef; bfd_reloc_status_type r; /* We are generating an executable, and must do a full relocation. */ - hundef = false; + hundef = FALSE; if (r_extern) { @@ -5394,7 +5435,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, relocation = 0; else { - hundef = true; + hundef = TRUE; relocation = 0; } } @@ -5467,12 +5508,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (check_dynamic_reloc != NULL) { - boolean skip; + bfd_boolean skip; if (! ((*check_dynamic_reloc) (finfo->info, input_bfd, input_section, h, (PTR) rel, contents, &skip, &relocation))) - return false; + return FALSE; if (skip) continue; } @@ -5494,8 +5535,8 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, name = strings + GET_WORD (input_bfd, syms[r_index].e_strx); if (! ((*finfo->info->callbacks->undefined_symbol) (finfo->info, name, input_bfd, input_section, - r_addr, true))) - return false; + r_addr, TRUE))) + return FALSE; } if (r_type != (unsigned int) RELOC_SPARC_REV32) @@ -5542,7 +5583,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, if (! ((*finfo->info->callbacks->reloc_overflow) (finfo->info, name, howto_table_ext[r_type].name, r_addend, input_bfd, input_section, r_addr))) - return false; + return FALSE; } break; } @@ -5550,12 +5591,12 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs, } } - return true; + return TRUE; } /* Handle a link order which is supposed to generate a reloc. */ -static boolean +static bfd_boolean aout_link_reloc_link_order (finfo, o, p) struct aout_final_link_info *finfo; asection *o; @@ -5592,7 +5633,7 @@ aout_link_reloc_link_order (finfo, o, p) r_extern = 1; h = ((struct aout_link_hash_entry *) bfd_wrapped_link_hash_lookup (finfo->output_bfd, finfo->info, - pr->u.name, false, false, true)); + pr->u.name, FALSE, FALSE, TRUE)); if (h != (struct aout_link_hash_entry *) NULL && h->indx >= 0) r_index = h->indx; @@ -5603,9 +5644,9 @@ aout_link_reloc_link_order (finfo, o, p) here. I don't think that will ever matter for a global symbol. */ h->indx = -2; - h->written = false; + h->written = FALSE; if (! aout_link_write_other_symbol (h, (PTR) finfo)) - return false; + return FALSE; r_index = h->indx; } else @@ -5613,7 +5654,7 @@ aout_link_reloc_link_order (finfo, o, p) if (! ((*finfo->info->callbacks->unattached_reloc) (finfo->info, pr->u.name, (bfd *) NULL, (asection *) NULL, (bfd_vma) 0))) - return false; + return FALSE; r_index = 0; } } @@ -5622,7 +5663,7 @@ aout_link_reloc_link_order (finfo, o, p) if (howto == 0) { bfd_set_error (bfd_error_bad_value); - return false; + return FALSE; } if (o == obj_textsec (finfo->output_bfd)) @@ -5692,12 +5733,12 @@ aout_link_reloc_link_order (finfo, o, p) bfd_size_type size; bfd_reloc_status_type r; bfd_byte *buf; - boolean ok; + bfd_boolean ok; size = bfd_get_reloc_size (howto); buf = (bfd_byte *) bfd_zmalloc (size); if (buf == (bfd_byte *) NULL) - return false; + return FALSE; r = MY_relocate_contents (howto, finfo->output_bfd, (bfd_vma) pr->addend, buf); switch (r) @@ -5718,7 +5759,7 @@ aout_link_reloc_link_order (finfo, o, p) (asection *) NULL, (bfd_vma) 0))) { free (buf); - return false; + return FALSE; } break; } @@ -5726,7 +5767,7 @@ aout_link_reloc_link_order (finfo, o, p) (file_ptr) p->offset, size); free (buf); if (! ok) - return false; + return FALSE; } } else @@ -5765,7 +5806,7 @@ aout_link_reloc_link_order (finfo, o, p) amt = obj_reloc_entry_size (finfo->output_bfd); if (bfd_seek (finfo->output_bfd, *reloff_ptr, SEEK_SET) != 0 || bfd_bwrite (rel_ptr, amt, finfo->output_bfd) != amt) - return false; + return FALSE; *reloff_ptr += obj_reloc_entry_size (finfo->output_bfd); @@ -5776,5 +5817,5 @@ aout_link_reloc_link_order (finfo, o, p) || (*reloff_ptr <= obj_datasec (finfo->output_bfd)->rel_filepos))); - return true; + return TRUE; } |