aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog60
-rw-r--r--bfd/Makefile.in17
-rw-r--r--bfd/coff-ia64.c12
-rw-r--r--bfd/configure.in2
-rw-r--r--bfd/efi-app-ia64.c6
-rw-r--r--bfd/libcoff.h4
-rw-r--r--bfd/libpei.h96
-rw-r--r--bfd/peXXigen.c (renamed from bfd/peigen.c)99
-rw-r--r--bfd/peicode.h22
9 files changed, 225 insertions, 93 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0df71602e67..346d0221894 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,63 @@
+2001-02-13 David Mosberger <davidm@hpl.hp.com>
+
+ * peicode.h (coff_swap_filehdr_out) [COFF_IMAGE_WITH_PE]: Define
+ as _bfd_XXi_only_swap_filehdr_out.
+ (pe_mkobject) [PEI_FORCE_MINIMUM_ALIGNMENT]: Set
+ pe->force_minimum_alignment to TRUE.
+ (pe_mkobject) [PEI_TARGET_SUBSYSTEM]: Set pe->target_subsystem to
+ PEI_TARGET_SUBSYSTEM.
+ (pe_print_private_bfd_data): Call
+ _bfd_XX_print_private_bfd_data_common() instead of
+ _bfd_pe_print_private_bfd_data_common().
+ (pe_bfd_copy_private_bfd_data): Call
+ _bfd_XX_bfd_copy_private_bfd_data_common() instead of
+ _bfd_pe_bfd_copy_private_bfd_data_common().
+ (coff_bfd_copy_private_section_data): Define as
+ _bfd_XX_bfd_copy_private_section_data instead of
+ _bfd_pe_bfd_copy_private_section_data.
+ (coff_get_symbol_info): Define as _bfd_XX_get_symbol_info instead
+ of a _bfd_pe_get_symbol_info.
+
+ * peigen.c: Delete.
+
+ * peXXigen.c: Renamed from peigen.c.
+ (COFF_WITH_XX): Define this macro (will get expanded into
+ COFF_WITH_pep or COFF_WITH_pe, depending on whether this is being
+ compiled as peigen.c or pepigen.c.
+ [COFF_WITH_pep]: Include "coff/ia64.h" instead of "coff/i386.h" to
+ define the canonical PEP structures and definitions.
+ (_bfd_XXi_swap_aouthdr_out): If pe->force_minimum_alignment is in
+ effect, enforce minimum file and section alignments. If
+ extra->Subsystem is IMAGE_SUBSYSTEM_UNKNOWN, set it to
+ pe->target_subsystem (this defaults to IMAGE_SUBSYSTEM_UNKNOWN,
+ so, by default, this is a no-op).
+
+ * libpei.h: Rename COFF_WITH_PEP to COFF_WITH_pep.
+ (_bfd_XX_bfd_copy_private_bfd_data_common): Add macros to map
+ _bfd_XXfoo to _bfd_pepfoo if COFF_WIT_PEP is defined and to
+ _bfd_pefoo if it's not defined. Use these macros to define
+ coff swap macros.
+
+ * libcoff.h (pe_tdata): Add members target_subsystem and
+ force_minimum_alignment.
+
+ * efi-app-ia64.c (COFF_WITH_pep): Rename COFF_WITH_PEP to
+ COFF_WITH_pep.
+ (PEI_TARGET_SUBSYSTEM): Rename from PEI_DEFAULT_TARGET_SUBSYSTEM.
+
+ * configure.in (bfd_efi_app_ia64_vec): Use pepigen.lo instead of
+ peigen.lo.
+
+ * coff-ia64.c: Rename COFF_WITH_PEP to COFF_WITH_pep.
+ (AOUTSZ): Rename PEP64AOUTSZ and PEP64AOUTHDR to PEPAOUTSZ and
+ PEPAOUTHDR.
+
+ * Makefile.in (BFD64_BACKENDS): Mention pepigen.lo.
+ (BFD64_BACKENDS_CFILES): Mention pepigen.c
+ (peigen.c): Add rule to generate from peXXigen.c.
+ (pepigen.c): Ditto.
+ (pepigen.lo): List dependencies for pepigen.lo.
+
2001-02-13 Alan Modra <alan@linuxcare.com.au>
* elf32-hppa.c (elf32_hppa_set_gp): Handle weak $global$. If
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 1351aaa7f53..9348a5d88a7 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -1,6 +1,6 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -540,6 +540,7 @@ BFD64_BACKENDS = \
coff64-rs6000.lo \
demo64.lo \
efi-app-ia64.lo \
+ pepigen.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
@@ -559,6 +560,7 @@ BFD64_BACKENDS_CFILES = \
coff64-rs6000.c \
demo64.c \
efi-app-ia64.c \
+ pepigen.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
@@ -1143,6 +1145,16 @@ $(BFD_MACHINES): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
$(BFD_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
+peigen.c : peXXigen.c
+ rm -f peigen.c
+ sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
+ mv -f peigen.new peigen.c
+
+pepigen.c : peXXigen.c
+ rm -f pepigen.c
+ sed -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
+ mv -f pepigen.new pepigen.c
+
# Install BFD include file, and others that it needs.
install-data-local: $(BFD_H)
@$(NORMAL_INSTALL)
@@ -1739,6 +1751,9 @@ pei-mips.lo: pei-mips.c $(INCDIR)/filenames.h pe-mips.c \
peigen.lo: peigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/i386.h $(INCDIR)/coff/pe.h libcoff.h \
$(INCDIR)/bfdlink.h libpei.h
+pepigen.lo: pepigen.c $(INCDIR)/filenames.h $(INCDIR)/coff/internal.h \
+ $(INCDIR)/coff/ia64.h $(INCDIR)/coff/pe.h libcoff.h \
+ $(INCDIR)/bfdlink.h libpei.h
ppcboot.lo: ppcboot.c $(INCDIR)/filenames.h
reloc16.lo: reloc16.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
genlink.h $(INCDIR)/coff/internal.h libcoff.h
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c
index 1f2b4458f3d..8a23a6d8174 100644
--- a/bfd/coff-ia64.c
+++ b/bfd/coff-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
- Copyright 1999 Free Software Foundation, Inc.
+ Copyright 1999, 2001 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -21,13 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
-
#include "coff/ia64.h"
-
#include "coff/internal.h"
-
#include "coff/pe.h"
-
#include "libcoff.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
@@ -43,10 +39,10 @@ static reloc_howto_type howto_table[] =
#define BADMAG(x) IA64BADMAG(x)
#define IA64 1 /* Customize coffcode.h */
-#ifdef COFF_WITH_PEP64
+#ifdef COFF_WITH_pep
# undef AOUTSZ
-# define AOUTSZ PEP64AOUTSZ
-# define PEAOUTHDR PEP64AOUTHDR
+# define AOUTSZ PEPAOUTSZ
+# define PEAOUTHDR PEPAOUTHDR
#endif
#define RTYPE2HOWTO(cache_ptr, dst) \
diff --git a/bfd/configure.in b/bfd/configure.in
index a65cb915193..3ced576157a 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -477,7 +477,7 @@ do
b_out_vec_big_host) tb="$tb bout.lo aout32.lo" ;;
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
bfd_efi_app_ia32_vec) tb="$tb efi-app-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo peigen.lo cofflink.lo"
+ bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"
target64=true ;;
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
target64=true ;;
diff --git a/bfd/efi-app-ia64.c b/bfd/efi-app-ia64.c
index b3182dc8b3f..4569c4210d7 100644
--- a/bfd/efi-app-ia64.c
+++ b/bfd/efi-app-ia64.c
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 EFI application files.
- Copyright 1999 Free Software Foundation, Inc.
+ Copyright 1999, 2001 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -25,11 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define TARGET_NAME "efi-app-ia64"
#define COFF_IMAGE_WITH_PE
#define COFF_WITH_PE
-#define COFF_WITH_PEP64
+#define COFF_WITH_pep
#define PCRELOFFSET true
#define TARGET_UNDERSCORE '_'
#define COFF_LONG_SECTION_NAMES
-#define PEI_DEFAULT_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
+#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
#define PEI_FORCE_MINIMUM_ALIGNMENT
#include "coff-ia64.c"
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index 511553865fe..dcbbbcf22b7 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -1,5 +1,5 @@
/* BFD COFF object file private structure.
- Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2001
Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -121,6 +121,8 @@ typedef struct pe_tdata
int has_reloc_section;
boolean (*in_reloc_p) PARAMS((bfd *, reloc_howto_type *));
flagword real_flags;
+ int target_subsystem;
+ boolean force_minimum_alignment;
} pe_data_type;
#define pe_data(bfd) ((bfd)->tdata.pe_obj_data)
diff --git a/bfd/libpei.h b/bfd/libpei.h
index db47e374818..e112441e830 100644
--- a/bfd/libpei.h
+++ b/bfd/libpei.h
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -192,7 +192,7 @@ PE/PEI rearrangement (and code added): Donn Terry
#define PUT_SCNHDR_LNNOPTR bfd_h_put_32
#endif
-#ifdef COFF_WITH_PEP64
+#ifdef COFF_WITH_pep
#define GET_OPTHDR_IMAGE_BASE bfd_h_get_64
#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_64
@@ -206,7 +206,25 @@ PE/PEI rearrangement (and code added): Donn Terry
#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_64
#define GET_PDATA_ENTRY bfd_get_64
-#else /* !COFF_WITH_PEP64 */
+#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pep_bfd_copy_private_bfd_data_common
+#define _bfd_XX_bfd_copy_private_section_data _bfd_pep_bfd_copy_private_section_data
+#define _bfd_XX_get_symbol_info _bfd_pep_get_symbol_info
+#define _bfd_XX_only_swap_filehdr_out _bfd_pep_only_swap_filehdr_out
+#define _bfd_XX_print_private_bfd_data_common _bfd_pep_print_private_bfd_data_common
+#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
+#define _bfd_XXi_final_link_postscript _bfd_pepi_final_link_postscript
+#define _bfd_XXi_only_swap_filehdr_out _bfd_pepi_only_swap_filehdr_out
+#define _bfd_XXi_swap_aouthdr_in _bfd_pepi_swap_aouthdr_in
+#define _bfd_XXi_swap_aouthdr_out _bfd_pepi_swap_aouthdr_out
+#define _bfd_XXi_swap_aux_in _bfd_pepi_swap_aux_in
+#define _bfd_XXi_swap_aux_out _bfd_pepi_swap_aux_out
+#define _bfd_XXi_swap_lineno_in _bfd_pepi_swap_lineno_in
+#define _bfd_XXi_swap_lineno_out _bfd_pepi_swap_lineno_out
+#define _bfd_XXi_swap_scnhdr_out _bfd_pepi_swap_scnhdr_out
+#define _bfd_XXi_swap_sym_in _bfd_pepi_swap_sym_in
+#define _bfd_XXi_swap_sym_out _bfd_pepi_swap_sym_out
+
+#else /* !COFF_WITH_pep */
#define GET_OPTHDR_IMAGE_BASE bfd_h_get_32
#define PUT_OPTHDR_IMAGE_BASE bfd_h_put_32
@@ -220,7 +238,25 @@ PE/PEI rearrangement (and code added): Donn Terry
#define PUT_OPTHDR_SIZE_OF_HEAP_COMMIT bfd_h_put_32
#define GET_PDATA_ENTRY bfd_get_32
-#endif /* !COFF_WITH_PEP64 */
+#define _bfd_XX_bfd_copy_private_bfd_data_common _bfd_pe_bfd_copy_private_bfd_data_common
+#define _bfd_XX_bfd_copy_private_section_data _bfd_pe_bfd_copy_private_section_data
+#define _bfd_XX_get_symbol_info _bfd_pe_get_symbol_info
+#define _bfd_XX_only_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
+#define _bfd_XX_print_private_bfd_data_common _bfd_pe_print_private_bfd_data_common
+#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
+#define _bfd_XXi_final_link_postscript _bfd_pei_final_link_postscript
+#define _bfd_XXi_only_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
+#define _bfd_XXi_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
+#define _bfd_XXi_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
+#define _bfd_XXi_swap_aux_in _bfd_pei_swap_aux_in
+#define _bfd_XXi_swap_aux_out _bfd_pei_swap_aux_out
+#define _bfd_XXi_swap_lineno_in _bfd_pei_swap_lineno_in
+#define _bfd_XXi_swap_lineno_out _bfd_pei_swap_lineno_out
+#define _bfd_XXi_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
+#define _bfd_XXi_swap_sym_in _bfd_pei_swap_sym_in
+#define _bfd_XXi_swap_sym_out _bfd_pei_swap_sym_out
+
+#endif /* !COFF_WITH_pep */
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
@@ -234,51 +270,51 @@ PE/PEI rearrangement (and code added): Donn Terry
implementations architecture types, and actually appear in
peigen.c. */
-void _bfd_pei_swap_sym_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_in _bfd_pei_swap_sym_in
+void _bfd_XXi_swap_sym_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_sym_in _bfd_XXi_swap_sym_in
-unsigned int _bfd_pei_swap_sym_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_sym_out _bfd_pei_swap_sym_out
+unsigned int _bfd_XXi_swap_sym_out PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_sym_out _bfd_XXi_swap_sym_out
-void _bfd_pei_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_in _bfd_pei_swap_aux_in
+void _bfd_XXi_swap_aux_in PARAMS ((bfd *, PTR, int, int, int, int, PTR));
+#define coff_swap_aux_in _bfd_XXi_swap_aux_in
-unsigned int _bfd_pei_swap_aux_out \
+unsigned int _bfd_XXi_swap_aux_out \
PARAMS ((bfd *, PTR, int, int, int, int, PTR));
-#define coff_swap_aux_out _bfd_pei_swap_aux_out
+#define coff_swap_aux_out _bfd_XXi_swap_aux_out
-void _bfd_pei_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_in _bfd_pei_swap_lineno_in
+void _bfd_XXi_swap_lineno_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_lineno_in _bfd_XXi_swap_lineno_in
-unsigned int _bfd_pei_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_lineno_out _bfd_pei_swap_lineno_out
+unsigned int _bfd_XXi_swap_lineno_out PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_lineno_out _bfd_XXi_swap_lineno_out
-void _bfd_pei_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
-#define coff_swap_aouthdr_in _bfd_pei_swap_aouthdr_in
+void _bfd_XXi_swap_aouthdr_in PARAMS ((bfd*, PTR, PTR));
+#define coff_swap_aouthdr_in _bfd_XXi_swap_aouthdr_in
-unsigned int _bfd_pei_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
-#define coff_swap_aouthdr_out _bfd_pei_swap_aouthdr_out
+unsigned int _bfd_XXi_swap_aouthdr_out PARAMS ((bfd *, PTR, PTR));
+#define coff_swap_aouthdr_out _bfd_XXi_swap_aouthdr_out
-unsigned int _bfd_pei_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
-#define coff_swap_scnhdr_out _bfd_pei_swap_scnhdr_out
+unsigned int _bfd_XXi_swap_scnhdr_out PARAMS ((bfd *, PTR, PTR));
+#define coff_swap_scnhdr_out _bfd_XXi_swap_scnhdr_out
-boolean _bfd_pe_print_private_bfd_data_common PARAMS ((bfd *, PTR));
+boolean _bfd_XX_print_private_bfd_data_common PARAMS ((bfd *, PTR));
-boolean _bfd_pe_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
+boolean _bfd_XX_bfd_copy_private_bfd_data_common PARAMS ((bfd *, bfd *));
-void _bfd_pe_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
+void _bfd_XX_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *));
-boolean _bfd_pei_final_link_postscript
+boolean _bfd_XXi_final_link_postscript
PARAMS ((bfd *, struct coff_final_link_info *));
#ifndef coff_final_link_postscript
-#define coff_final_link_postscript _bfd_pei_final_link_postscript
+#define coff_final_link_postscript _bfd_XXi_final_link_postscript
#endif
/* The following are needed only for ONE of pe or pei, but don't
otherwise vary; peicode.h fixes up ifdefs but we provide the
prototype. */
-unsigned int _bfd_pe_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-unsigned int _bfd_pei_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
-boolean _bfd_pe_bfd_copy_private_section_data
+unsigned int _bfd_XX_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
+unsigned int _bfd_XXi_only_swap_filehdr_out PARAMS ((bfd*, PTR, PTR));
+boolean _bfd_XX_bfd_copy_private_section_data
PARAMS ((bfd *, asection *, bfd *, asection *));
diff --git a/bfd/peigen.c b/bfd/peXXigen.c
index 699c7267b28..8d819f26b17 100644
--- a/bfd/peigen.c
+++ b/bfd/peXXigen.c
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI; the common executable parts.
- Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
+ Copyright 1995, 96, 97, 98, 99, 2000, 2001 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -53,6 +53,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
wasting too much time.
*/
+/* This expands into COFF_WITH_pe or COFF_WITH_pep depending on whether
+ we're compiling for straight PE or PE+. */
+#define COFF_WITH_XX
+
#include "bfd.h"
#include "sysdep.h"
#include "libbfd.h"
@@ -64,12 +68,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
within PE/PEI, so we get them from there. FIXME: The lack of
variance is an assumption which may prove to be incorrect if new
PE/PEI targets are created. */
-#include "coff/i386.h"
+#ifdef COFF_WITH_pep
+# include "coff/ia64.h"
+#else
+# include "coff/i386.h"
+#endif
#include "coff/pe.h"
#include "libcoff.h"
#include "libpei.h"
+#ifdef COFF_WITH_pep
+# undef AOUTSZ
+# define AOUTSZ PEPAOUTSZ
+# define PEAOUTHDR PEPAOUTHDR
+#endif
+
/* FIXME: This file has various tests of POWERPC_LE_PE. Those tests
worked when the code was in peicode.h, but no longer work now that
the code is in peigen.c. PowerPC NT is said to be dead. If
@@ -84,7 +98,7 @@ static boolean pe_print_reloc PARAMS ((bfd *, PTR));
/**********************************************************************/
void
-_bfd_pei_swap_sym_in (abfd, ext1, in1)
+_bfd_XXi_swap_sym_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
@@ -207,7 +221,7 @@ _bfd_pei_swap_sym_in (abfd, ext1, in1)
}
unsigned int
-_bfd_pei_swap_sym_out (abfd, inp, extp)
+_bfd_XXi_swap_sym_out (abfd, inp, extp)
bfd *abfd;
PTR inp;
PTR extp;
@@ -241,7 +255,7 @@ _bfd_pei_swap_sym_out (abfd, inp, extp)
}
void
-_bfd_pei_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
+_bfd_XXi_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
bfd *abfd;
PTR ext1;
int type;
@@ -320,7 +334,7 @@ _bfd_pei_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
}
unsigned int
-_bfd_pei_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
+_bfd_XXi_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
bfd *abfd;
PTR inp;
int type;
@@ -401,7 +415,7 @@ _bfd_pei_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
}
void
-_bfd_pei_swap_lineno_in (abfd, ext1, in1)
+_bfd_XXi_swap_lineno_in (abfd, ext1, in1)
bfd *abfd;
PTR ext1;
PTR in1;
@@ -414,7 +428,7 @@ _bfd_pei_swap_lineno_in (abfd, ext1, in1)
}
unsigned int
-_bfd_pei_swap_lineno_out (abfd, inp, outp)
+_bfd_XXi_swap_lineno_out (abfd, inp, outp)
bfd *abfd;
PTR inp;
PTR outp;
@@ -429,7 +443,7 @@ _bfd_pei_swap_lineno_out (abfd, inp, outp)
}
void
-_bfd_pei_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
+_bfd_XXi_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
bfd *abfd;
PTR aouthdr_ext1;
PTR aouthdr_int1;
@@ -451,7 +465,7 @@ _bfd_pei_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
GET_AOUTHDR_ENTRY (abfd, (bfd_byte *) aouthdr_ext->entry);
aouthdr_int->text_start =
GET_AOUTHDR_TEXT_START (abfd, (bfd_byte *) aouthdr_ext->text_start);
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
aouthdr_int->data_start =
GET_AOUTHDR_DATA_START (abfd, (bfd_byte *) aouthdr_ext->data_start);
@@ -504,18 +518,18 @@ _bfd_pei_swap_aouthdr_in (abfd, aouthdr_ext1, aouthdr_int1)
if (aouthdr_int->entry)
{
aouthdr_int->entry += a->ImageBase;
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
aouthdr_int->entry &= 0xffffffff;
#endif
}
if (aouthdr_int->tsize)
{
aouthdr_int->text_start += a->ImageBase;
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
aouthdr_int->text_start &= 0xffffffff;
#endif
}
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
if (aouthdr_int->dsize)
{
@@ -566,32 +580,27 @@ add_data_entry (abfd, aout, idx, name, base)
}
unsigned int
-_bfd_pei_swap_aouthdr_out (abfd, in, out)
+_bfd_XXi_swap_aouthdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
{
struct internal_aouthdr *aouthdr_in = (struct internal_aouthdr *) in;
- struct internal_extra_pe_aouthdr *extra = &pe_data (abfd)->pe_opthdr;
+ pe_data_type *pe = pe_data (abfd);
+ struct internal_extra_pe_aouthdr *extra = &pe->pe_opthdr;
PEAOUTHDR *aouthdr_out = (PEAOUTHDR *) out;
bfd_vma sa, fa, ib;
- /* The following definitely is required for EFI applications.
- Perhaps it's needed for other PEI targets as well, but I don't
- know that for a fact, so we play it safe here and tweak the
- alignments only if PEI_FORCE_MINIMUM_ALIGNMENT is
- defined. --davidm */
-#ifdef PEI_FORCE_MINIMUM_ALIGNMENT
- if (!extra->FileAlignment)
- extra->FileAlignment = PE_DEF_FILE_ALIGNMENT;
- if (!extra->SectionAlignment)
- extra->SectionAlignment = PE_DEF_SECTION_ALIGNMENT;
-#endif
+ if (pe->force_minimum_alignment)
+ {
+ if (!extra->FileAlignment)
+ extra->FileAlignment = PE_DEF_FILE_ALIGNMENT;
+ if (!extra->SectionAlignment)
+ extra->SectionAlignment = PE_DEF_SECTION_ALIGNMENT;
+ }
-#ifdef PEI_DEFAULT_TARGET_SUBSYSTEM
if (extra->Subsystem == IMAGE_SUBSYSTEM_UNKNOWN)
- extra->Subsystem = PEI_DEFAULT_TARGET_SUBSYSTEM;
-#endif
+ extra->Subsystem = pe->target_subsystem;
sa = extra->SectionAlignment;
fa = extra->FileAlignment;
@@ -600,17 +609,23 @@ _bfd_pei_swap_aouthdr_out (abfd, in, out)
if (aouthdr_in->tsize)
{
aouthdr_in->text_start -= ib;
+#ifndef COFF_WITH_pep
aouthdr_in->text_start &= 0xffffffff;
+#endif
}
if (aouthdr_in->dsize)
{
aouthdr_in->data_start -= ib;
+#ifndef COFF_WITH_pep
aouthdr_in->data_start &= 0xffffffff;
+#endif
}
if (aouthdr_in->entry)
{
aouthdr_in->entry -= ib;
+#ifndef COFF_WITH_pep
aouthdr_in->entry &= 0xffffffff;
+#endif
}
#define FA(x) (((x) + fa -1 ) & (- fa))
@@ -644,7 +659,7 @@ _bfd_pei_swap_aouthdr_out (abfd, in, out)
in this slot by MSVC; it doesn't seem to cause problems (so far),
but since it's the best we've got, use it. It does do the right
thing for .pdata. */
- if (pe_data (abfd)->has_reloc_section)
+ if (pe->has_reloc_section)
add_data_entry (abfd, extra, 5, ".reloc", ib);
{
@@ -692,7 +707,7 @@ _bfd_pei_swap_aouthdr_out (abfd, in, out)
PUT_AOUTHDR_TEXT_START (abfd, aouthdr_in->text_start,
(bfd_byte *) aouthdr_out->standard.text_start);
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
/* PE32+ does not have data_start member! */
PUT_AOUTHDR_DATA_START (abfd, aouthdr_in->data_start,
(bfd_byte *) aouthdr_out->standard.data_start);
@@ -755,7 +770,7 @@ _bfd_pei_swap_aouthdr_out (abfd, in, out)
}
unsigned int
-_bfd_pei_only_swap_filehdr_out (abfd, in, out)
+_bfd_XXi_only_swap_filehdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
@@ -878,7 +893,7 @@ _bfd_pei_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_pe_only_swap_filehdr_out (abfd, in, out)
+_bfd_XX_only_swap_filehdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
@@ -899,7 +914,7 @@ _bfd_pe_only_swap_filehdr_out (abfd, in, out)
}
unsigned int
-_bfd_pei_swap_scnhdr_out (abfd, in, out)
+_bfd_XXi_swap_scnhdr_out (abfd, in, out)
bfd *abfd;
PTR in;
PTR out;
@@ -1544,7 +1559,7 @@ pe_print_pdata (abfd, vfile)
bfd *abfd;
PTR vfile;
{
-#ifdef COFF_WITH_PEP64
+#ifdef COFF_WITH_pep
# define PDATA_ROW_SIZE (3*8)
#else
# define PDATA_ROW_SIZE (5*4)
@@ -1570,7 +1585,7 @@ pe_print_pdata (abfd, vfile)
fprintf (file,
_("\nThe Function Table (interpreted .pdata section contents)\n"));
-#ifdef COFF_WITH_PEP64
+#ifdef COFF_WITH_pep
fprintf (file,
_(" vma:\t\t\tBegin Address End Address Unwind Info\n"));
#else
@@ -1629,7 +1644,7 @@ pe_print_pdata (abfd, vfile)
fprintf_vma (file, begin_addr); fputc (' ', file);
fprintf_vma (file, end_addr); fputc (' ', file);
fprintf_vma (file, eh_handler);
-#ifndef COFF_WITH_PEP64
+#ifndef COFF_WITH_pep
fputc (' ', file);
fprintf_vma (file, eh_data); fputc (' ', file);
fprintf_vma (file, prolog_end_addr);
@@ -1780,7 +1795,7 @@ pe_print_reloc (abfd, vfile)
/* Print out the program headers. */
boolean
-_bfd_pe_print_private_bfd_data_common (abfd, vfile)
+_bfd_XX_print_private_bfd_data_common (abfd, vfile)
bfd *abfd;
PTR vfile;
{
@@ -1892,7 +1907,7 @@ _bfd_pe_print_private_bfd_data_common (abfd, vfile)
to the output bfd. */
boolean
-_bfd_pe_bfd_copy_private_bfd_data_common (ibfd, obfd)
+_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd)
bfd *ibfd, *obfd;
{
/* One day we may try to grok other private data. */
@@ -1915,7 +1930,7 @@ _bfd_pe_bfd_copy_private_bfd_data_common (ibfd, obfd)
/* Copy private section data. */
boolean
-_bfd_pe_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
+_bfd_XX_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
bfd *ibfd;
asection *isec;
bfd *obfd;
@@ -1952,7 +1967,7 @@ _bfd_pe_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
}
void
-_bfd_pe_get_symbol_info (abfd, symbol, ret)
+_bfd_XX_get_symbol_info (abfd, symbol, ret)
bfd *abfd;
asymbol *symbol;
symbol_info *ret;
@@ -1972,7 +1987,7 @@ _bfd_pe_get_symbol_info (abfd, symbol, ret)
access. */
boolean
-_bfd_pei_final_link_postscript (abfd, pfinfo)
+_bfd_XXi_final_link_postscript (abfd, pfinfo)
bfd *abfd;
struct coff_final_link_info *pfinfo;
{
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 666e68c115d..a537a7d4bd6 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -1,5 +1,5 @@
/* Support for the generic parts of PE/PEI, for BFD.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
Written by Cygnus Solutions.
This file is part of BFD, the Binary File Descriptor library.
@@ -221,9 +221,9 @@ coff_swap_filehdr_in (abfd, src, dst)
}
#ifdef COFF_IMAGE_WITH_PE
-#define coff_swap_filehdr_out _bfd_pei_only_swap_filehdr_out
+# define coff_swap_filehdr_out _bfd_XXi_only_swap_filehdr_out
#else
-#define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
+# define coff_swap_filehdr_out _bfd_pe_only_swap_filehdr_out
#endif
static void
@@ -302,6 +302,14 @@ pe_mkobject (abfd)
/* in_reloc_p is architecture dependent. */
pe->in_reloc_p = in_reloc_p;
+
+#ifdef PEI_FORCE_MINIMUM_ALIGNMENT
+ pe->force_minimum_alignment = 1;
+#endif
+#ifdef PEI_TARGET_SUBSYSTEM
+ pe->target_subsystem = PEI_TARGET_SUBSYSTEM;
+#endif
+
return true;
}
@@ -365,7 +373,7 @@ pe_print_private_bfd_data (abfd, vfile)
{
FILE *file = (FILE *) vfile;
- if (!_bfd_pe_print_private_bfd_data_common (abfd, vfile))
+ if (!_bfd_XX_print_private_bfd_data_common (abfd, vfile))
return false;
if (pe_saved_coff_bfd_print_private_bfd_data != NULL)
@@ -385,7 +393,7 @@ static boolean
pe_bfd_copy_private_bfd_data (ibfd, obfd)
bfd *ibfd, *obfd;
{
- if (!_bfd_pe_bfd_copy_private_bfd_data_common (ibfd, obfd))
+ if (!_bfd_XX_bfd_copy_private_bfd_data_common (ibfd, obfd))
return false;
if (pe_saved_coff_bfd_copy_private_bfd_data)
@@ -395,9 +403,9 @@ pe_bfd_copy_private_bfd_data (ibfd, obfd)
}
#define coff_bfd_copy_private_section_data \
- _bfd_pe_bfd_copy_private_section_data
+ _bfd_XX_bfd_copy_private_section_data
-#define coff_get_symbol_info _bfd_pe_get_symbol_info
+#define coff_get_symbol_info _bfd_XX_get_symbol_info
#ifdef COFF_IMAGE_WITH_PE