+2009-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/10074
+ * coffcode.h (bfd_pei_p): New.
+
+ * config.bfd: Remove bfd_efi_bsdrv_ia32_vec,
+ bfd_efi_rtdrv_ia32_vec, bfd_efi_bsdrv_x86_64_vec,
+ bfd_efi_rtdrv_x86_64_vec, bfd_efi_bsdrv_ia64_vec and
+ bfd_efi_rtdrv_ia64_vec. Replace bfd_efi_app_ia32_vec,
+ bfd_efi_app_x86_64_vec and bfd_efi_app_ia64_vec with
+ i386pei_vec, x86_64pei_vec and bfd_pei_ia64_vec, respectively.
+
+ * configure.in: Remove bfd_efi_bsdrv_ia32_vec,
+ bfd_efi_rtdrv_ia32_vec, bfd_efi_bsdrv_x86_64_vec,
+ bfd_efi_rtdrv_x86_64_vec,
+ bfd_efi_bsdrv_ia64_vec and bfd_efi_rtdrv_ia64_vec. Replace
+ bfd_efi_ia64_vec with bfd_pei_ia64_vec.
+ * targets.c: Likewise.
+
+ * configure: Regenerated.
+ * libcoff.h: Likewise.
+ * Makefile.in: Likewise.
+
+ * efi-app-ia32.c: Removed.
+ * efi-app-x86_64.c: Likewise.
+ * efi-bsdrv-ia32.c: Likewise.
+ * efi-bsdrv-ia64.c: Likewise.
+ * efi-bsdrv-x86_64.c: Likewise.
+ * efi-rtdrv-ia32.c: Likewise.
+ * efi-rtdrv-ia64.c: Likewise.
+ * efi-rtdrv-x86_64.c: Likewise.
+ * efi-rtdrv-ia32.c: Likewise.
+
+ * efi-app-ia64.c: Moved to ...
+ * pei-ia64.c: This.
+ (TARGET_SYM): Set to bfd_pei_ia64_vec.
+ (TARGET_NAME): Set to pei-ia64.
+
+ * libpei.h (bfd_target_pei_p): Removed.
+ (bfd_target_pei_arch): Likewise.
+ (bfd_target_efi_app_p): Likewise.
+ (bfd_target_efi_app_arch): Likewise.
+ (bfd_target_efi_bsdrv_p): Likewise.
+ (bfd_target_efi_bsdrv_arch): Likewise.
+ (bfd_target_efi_rtdrv_p): Likewise.
+ (bfd_target_efi_rtdrv_arch): Likewise.
+ (bfd_pe_executable_p): Likewise.
+
+ * Makefile.am (BFD32_BACKENDS): Remove efi-app-ia32.lo,
+ efi-bsdrv-ia32.lo and efi-rtdrv-ia32.lo.
+ (BFD32_BACKENDS_CFILES): Remove efi-app-ia32.c, efi-bsdrv-ia32.c
+ and efi-rtdrv-ia32.c.
+ (BFD64_BACKENDS): Remove efi-app-ia64.lo, efi-bsdrv-ia64.lo,
+ efi-rtdrv-ia64.lo, efi-app-x86_64.lo, efi-bsdrv-x86_64.lo and
+ efi-rtdrv-x86_64.lo. Add pei-ia64.lo.
+ (BFD64_BACKENDS_CFILES): Remove efi-app-ia64.c, efi-bsdrv-ia64.c,
+ efi-rtdrv-ia64.c, efi-app-x86_64.c, efi-bsdrv-x86_64.c and
+ efi-rtdrv-x86_64.c. Add pei-ia64.c.
+ (efi-app-ia64.lo): Removed.
+ (efi-bsdrv-ia32.lo): Likewise.
+ (efi-rtdrv-ia32.lo): Likewise.
+ (efi-app-ia64.lo): Likewise.
+ (efi-bsdrv-ia64.lo): Likewise.
+ (efi-rtdrv-ia64.lo): Likewise.
+ (efi-app-x86_64.lo): Likewise.
+ (efi-bsdrv-x86_64.lo): Likewise.
+ (efi-rtdrv-x86_64.lo): Likewise.
+ (pei-ia64.lo): New.
+
+ * peicode.h (coff_swap_scnhdr_in): Replace bfd_pe_executable_p
+ with bfd_pei_p.
+ (arch_type): Removed.
+ (pe_arch): Likewise.
+ (pe_bfd_object_p): Just return coff_object_p.
+
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Replace
+ bfd_pe_executable_p with bfd_pei_p.
+
2009-04-17 Christophe Lyon <christophe.lyon@st.com>
* elf32-arm.c (elf32_arm_size_stubs): Handle long branches through
dwarf1.lo \
ecoff.lo \
ecofflink.lo \
- efi-app-ia32.lo \
- efi-bsdrv-ia32.lo \
- efi-rtdrv-ia32.lo \
elf.lo \
elf32-am33lin.lo \
elf32-arc.lo \
dwarf1.c \
ecoff.c \
ecofflink.c \
- efi-app-ia32.c \
- efi-bsdrv-ia32.c \
- efi-rtdrv-ia32.c \
elf.c \
elf32-am33lin.c \
elf32-arc.c \
coff-alpha.lo \
coff64-rs6000.lo \
demo64.lo \
- efi-app-ia64.lo \
- efi-bsdrv-ia64.lo \
- efi-rtdrv-ia64.lo \
- efi-app-x86_64.lo \
- efi-bsdrv-x86_64.lo \
- efi-rtdrv-x86_64.lo \
+ pei-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
coff-alpha.c \
coff64-rs6000.c \
demo64.c \
- efi-app-ia64.c \
- efi-bsdrv-ia64.c \
- efi-rtdrv-ia64.c \
- efi-app-x86_64.c \
- efi-bsdrv-x86_64.c \
- efi-rtdrv-x86_64.c \
+ pei-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
$(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \
libecoff.h
-efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-bsdrv-ia32.lo: efi-bsdrv-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-rtdrv-ia32.lo: efi-rtdrv-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/libiberty.h \
$(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
-efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
+pei-ia64.lo: pei-ia64.c $(INCDIR)/filenames.h \
coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
$(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-efi-bsdrv-ia64.lo: efi-bsdrv-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-rtdrv-ia64.lo: efi-rtdrv-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
-efi-bsdrv-x86_64.lo: efi-bsdrv-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
-efi-rtdrv-x86_64.lo: efi-rtdrv-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h bfd_stdint.h \
dwarf1.lo \
ecoff.lo \
ecofflink.lo \
- efi-app-ia32.lo \
- efi-bsdrv-ia32.lo \
- efi-rtdrv-ia32.lo \
elf.lo \
elf32-am33lin.lo \
elf32-arc.lo \
dwarf1.c \
ecoff.c \
ecofflink.c \
- efi-app-ia32.c \
- efi-bsdrv-ia32.c \
- efi-rtdrv-ia32.c \
elf.c \
elf32-am33lin.c \
elf32-arc.c \
coff-alpha.lo \
coff64-rs6000.lo \
demo64.lo \
- efi-app-ia64.lo \
- efi-bsdrv-ia64.lo \
- efi-rtdrv-ia64.lo \
- efi-app-x86_64.lo \
- efi-bsdrv-x86_64.lo \
- efi-rtdrv-x86_64.lo \
+ pei-ia64.lo \
elf64-x86-64.lo \
elf64-alpha.lo \
elf64-hppa.lo \
coff-alpha.c \
coff64-rs6000.c \
demo64.c \
- efi-app-ia64.c \
- efi-bsdrv-ia64.c \
- efi-rtdrv-ia64.c \
- efi-app-x86_64.c \
- efi-bsdrv-x86_64.c \
- efi-rtdrv-x86_64.c \
+ pei-ia64.c \
elf64-x86-64.c \
elf64-alpha.c \
elf64-hppa.c \
$(INCDIR)/aout/stab.def $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h libcoff.h \
libecoff.h
-efi-app-ia32.lo: efi-app-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-bsdrv-ia32.lo: efi-bsdrv-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-rtdrv-ia32.lo: efi-rtdrv-ia32.c $(INCDIR)/filenames.h \
- coff-i386.c $(INCDIR)/hashtab.h $(INCDIR)/coff/i386.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
elf.lo: elf.c $(INCDIR)/filenames.h $(INCDIR)/bfdlink.h \
$(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/libiberty.h \
$(INCDIR)/hashtab.h $(INCDIR)/aout/sun4.h libaout.h \
$(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h aout-target.h
-efi-app-ia64.lo: efi-app-ia64.c $(INCDIR)/filenames.h \
+pei-ia64.lo: pei-ia64.c $(INCDIR)/filenames.h \
coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
$(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
peicode.h libpei.h
-efi-bsdrv-ia64.lo: efi-bsdrv-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-rtdrv-ia64.lo: efi-rtdrv-ia64.c $(INCDIR)/filenames.h \
- coff-ia64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/ia64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
- peicode.h libpei.h
-efi-app-x86_64.lo: efi-app-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
-efi-bsdrv-x86_64.lo: efi-bsdrv-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
-efi-rtdrv-x86_64.lo: efi-rtdrv-x86_64.c $(INCDIR)/filenames.h \
- coff-x86_64.c $(INCDIR)/hashtab.h $(INCDIR)/coff/x86_64.h \
- $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h \
- coffcode.h peicode.h libpei.h
elf64-x86-64.lo: elf64-x86-64.c $(INCDIR)/filenames.h \
$(INCDIR)/bfdlink.h $(INCDIR)/hashtab.h elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h bfd_stdint.h \
.#define bfd_coff_print_pdata(a,p) \
. ((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p))
.
+.{* Macro: Returns true if the bfd is a PE executable as opposed to a
+. PE object file. *}
+.#define bfd_pei_p(abfd) \
+. (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
*/
/* See whether the magic number matches. */
;;
ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_ia64_little_vec
- targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec bfd_efi_bsdrv_ia64_vec bfd_efi_rtdrv_ia64_vec"
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_pei_ia64_vec"
want64=true
;;
ia64*-*-hpux*)
;;
i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
targ_defvec=bfd_elf32_i386_freebsd_vec
- targ_selvecs="bfd_elf32_i386_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec i386coff_vec"
- targ64_selvecs="bfd_elf64_x86_64_freebsd_vec bfd_elf64_x86_64_vec bfd_efi_app_x86_64_vec bfd_efi_bsdrv_x86_64_vec bfd_efi_rtdrv_x86_64_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386pei_vec i386coff_vec"
+ targ64_selvecs="bfd_elf64_x86_64_freebsd_vec bfd_elf64_x86_64_vec x86_64pei_vec"
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*)
;;
i[3-7]86-*-linux-*)
targ_defvec=bfd_elf32_i386_vec
- targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec"
+ targ_selvecs="i386linux_vec i386pei_vec"
targ64_selvecs=bfd_elf64_x86_64_vec
;;
#ifdef BFD64
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=bfd_elf64_x86_64_freebsd_vec
- targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec bfd_efi_app_x86_64_vec bfd_efi_bsdrv_x86_64_vec bfd_efi_rtdrv_x86_64_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec"
+ targ_selvecs="bfd_elf32_i386_freebsd_vec i386coff_vec i386pei_vec x86_64pei_vec bfd_elf32_i386_vec bfd_elf64_x86_64_vec"
want64=true
;;
x86_64-*-netbsd* | x86_64-*-openbsd*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec bfd_efi_app_x86_64_vec bfd_efi_bsdrv_x86_64_vec bfd_efi_rtdrv_x86_64_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec i386pei_vec x86_64pei_vec"
want64=true
;;
x86_64-*-linux-*)
targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec bfd_efi_bsdrv_ia32_vec bfd_efi_rtdrv_ia32_vec bfd_efi_app_x86_64_vec bfd_efi_bsdrv_x86_64_vec bfd_efi_rtdrv_x86_64_vec"
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec i386pei_vec x86_64pei_vec"
want64=true
;;
x86_64-*-mingw*)
armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
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_bsdrv_ia32_vec) tb="$tb efi-bsdrv-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_rtdrv_ia32_vec) tb="$tb efi-rtdrv-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_bsdrv_x86_64_vec) tb="$tb efi-bsdrv-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_rtdrv_x86_64_vec) tb="$tb efi-rtdrv-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
- bfd_efi_bsdrv_ia64_vec) tb="$tb efi-bsdrv-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
- bfd_efi_rtdrv_ia64_vec) tb="$tb efi-rtdrv-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_pei_ia64_vec) tb="$tb pei-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
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_bsdrv_ia32_vec) tb="$tb efi-bsdrv-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_rtdrv_ia32_vec) tb="$tb efi-rtdrv-ia32.lo peigen.lo cofflink.lo" ;;
- bfd_efi_app_x86_64_vec) tb="$tb efi-app-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_bsdrv_x86_64_vec) tb="$tb efi-bsdrv-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_rtdrv_x86_64_vec) tb="$tb efi-rtdrv-x86_64.lo pex64igen.lo cofflink.lo" ;target_size=64;;
- bfd_efi_app_ia64_vec) tb="$tb efi-app-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
- bfd_efi_bsdrv_ia64_vec) tb="$tb efi-bsdrv-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
- bfd_efi_rtdrv_ia64_vec) tb="$tb efi-rtdrv-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
+ bfd_pei_ia64_vec) tb="$tb pei-ia64.lo pepigen.lo cofflink.lo"; target_size=64 ;;
bfd_elf32_am33lin_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
bfd_elf32_bfin_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
+++ /dev/null
-/* BFD back-end for Intel IA-32 EFI application files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
- Contributed by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_app_ia32_vec
-#define TARGET_NAME "efi-app-ia32"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-i386.c"
+++ /dev/null
-/* BFD back-end for HP/Intel IA-64 EFI application files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
- Contributed by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_app_ia64_vec
-#define TARGET_NAME "efi-app-ia64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-ia64.c"
+++ /dev/null
-/* BFD back-end for Intel64 UEFI application files.
- Copyright 2007, 2009 Free Software Foundation, Inc.
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_app_x86_64_vec
-#define TARGET_NAME "efi-app-x86_64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-x86_64.c"
+++ /dev/null
-/* BFD back-end for Intel IA-32 EFI Boot Service driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-ia32.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_bsdrv_ia32_vec
-#define TARGET_NAME "efi-bsdrv-ia32"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-i386.c"
+++ /dev/null
-/* BFD back-end for HP/Intel IA-64 EFI Boot Service driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-ia64.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_bsdrv_ia64_vec
-#define TARGET_NAME "efi-bsdrv-ia64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-ia64.c"
+++ /dev/null
-/* BFD back-end for Intel64 UEFI Boot Service driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-x86_64.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_bsdrv_x86_64_vec
-#define TARGET_NAME "efi-bsdrv-x86_64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-x86_64.c"
+++ /dev/null
-/* BFD back-end for Intel IA-32 EFI runtime driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-ia32.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_rtdrv_ia32_vec
-#define TARGET_NAME "efi-rtdrv-ia32"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-i386.c"
+++ /dev/null
-/* BFD back-end for HP/Intel IA-64 EFI runtime driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-ia64.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_rtdrv_ia64_vec
-#define TARGET_NAME "efi-rtdrv-ia64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-ia64.c"
+++ /dev/null
-/* BFD back-end for Intel64 UEFI runtime driver files.
- Copyright 1999, 2000, 2001, 2002, 2007, 2008, 2009 Free Software Foundation, Inc.
- Contributed by Peter Jones <pjones@redhat.com>
- Based on efi-app-x86_64.c by David Mosberger <davidm@hpl.hp.com>
-
- 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 3 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.
-
- 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., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-#include "sysdep.h"
-#include "bfd.h"
-
-#define TARGET_SYM bfd_efi_rtdrv_x86_64_vec
-#define TARGET_NAME "efi-rtdrv-x86_64"
-#define COFF_IMAGE_WITH_PE
-#define COFF_WITH_PE
-#define COFF_WITH_pep
-#define PCRELOFFSET TRUE
-#define TARGET_UNDERSCORE '_'
-/* Long section names not allowed in executable images, only object files. */
-#define COFF_LONG_SECTION_NAMES 0
-#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER
-#define PEI_FORCE_MINIMUM_ALIGNMENT
-
-#include "coff-x86_64.c"
#define bfd_coff_print_pdata(a,p) \
((coff_backend_info (a)->_bfd_coff_print_pdata) (a, p))
+/* Macro: Returns true if the bfd is a PE executable as opposed to a
+ PE object file. */
+#define bfd_pei_p(abfd) \
+ (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
#endif /* !COFF_WITH_pep */
-/* Returns true if the target is a PE executable target. */
-#define bfd_target_pei_p(xvec) \
- (CONST_STRNEQ ((xvec)->name, "pei-"))
-
-/* Return the arch string of a PE executable target. */
-#define bfd_target_pei_arch(xvec) \
- ((xvec)->name + sizeof ("pei-") - 1)
-
-/* Returns true if the target is an EFI application target. */
-#define bfd_target_efi_app_p(xvec) \
- (CONST_STRNEQ ((xvec)->name, "efi-app-"))
-
-/* Return the arch string of an EFI application target. */
-#define bfd_target_efi_app_arch(xvec) \
- ((xvec)->name + sizeof ("efi-app-") - 1)
-
-/* Returns true if the target is an EFI Boot Service driver target. */
-#define bfd_target_efi_bsdrv_p(xvec) \
- (CONST_STRNEQ ((xvec)->name, "efi-bsdrv-"))
-
-/* Return the arch string of an EFI Boot Service driver target. */
-#define bfd_target_efi_bsdrv_arch(xvec) \
- ((xvec)->name + sizeof ("efi-bsdrv-") - 1)
-
-/* Returns true if the target is an EFI runtime driver target. */
-#define bfd_target_efi_rtdrv_p(xvec) \
- (CONST_STRNEQ ((xvec)->name, "efi-rtdrv-"))
-
-/* Return the arch string of an EFI runtime driver target. */
-#define bfd_target_efi_rtdrv_arch(xvec) \
- ((xvec)->name + sizeof ("efi-rtdrv-") - 1)
-
-/* Macro: Returns true if the bfd is a PE executable as opposed to a
- PE object file. */
-#define bfd_pe_executable_p(abfd) \
- ( bfd_target_pei_p ((abfd)->xvec) \
- || bfd_target_efi_app_p ((abfd)->xvec) \
- || bfd_target_efi_bsdrv_p ((abfd)->xvec) \
- || bfd_target_efi_rtdrv_p ((abfd)->xvec))
-
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
int coff_swap_reloc_out
sometimes). */
if ((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0)
{
- if (bfd_pe_executable_p (abfd))
+ if (bfd_pei_p (abfd))
{
ps = scnhdr_int->s_size;
ss = 0;
}
else
{
- if (bfd_pe_executable_p (abfd))
+ if (bfd_pei_p (abfd))
ps = scnhdr_int->s_paddr;
else
ps = 0;
--- /dev/null
+/* BFD back-end for HP/Intel IA-64 PE IMAGE COFF files.
+ Copyright 1999, 2000, 2001, 2002, 2007, 2009 Free Software Foundation, Inc.
+ Contributed by David Mosberger <davidm@hpl.hp.com>
+
+ This implementation only supports objcopy to ouput IA-64 PE IMAGE COFF
+ files.
+
+ 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 3 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.
+
+ 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., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+#include "sysdep.h"
+#include "bfd.h"
+
+#define TARGET_SYM bfd_pei_ia64_vec
+#define TARGET_NAME "pei-ia64"
+#define COFF_IMAGE_WITH_PE
+#define COFF_WITH_PE
+#define COFF_WITH_pep
+#define PCRELOFFSET TRUE
+#define TARGET_UNDERSCORE '_'
+/* Long section names not allowed in executable images, only object files. */
+#define COFF_LONG_SECTION_NAMES 0
+#define PEI_TARGET_SUBSYSTEM IMAGE_SUBSYSTEM_EFI_APPLICATION
+#define PEI_FORCE_MINIMUM_ALIGNMENT
+
+#include "coff-ia64.c"
use the virtual size (stored in s_paddr) instead. */
if (scnhdr_int->s_paddr > 0
&& (((scnhdr_int->s_flags & IMAGE_SCN_CNT_UNINITIALIZED_DATA) != 0
- && (! bfd_pe_executable_p (abfd) || scnhdr_int->s_size == 0))
- || (bfd_pe_executable_p (abfd) && (scnhdr_int->s_size > scnhdr_int->s_paddr))))
+ && (! bfd_pei_p (abfd) || scnhdr_int->s_size == 0))
+ || (bfd_pei_p (abfd) && (scnhdr_int->s_size > scnhdr_int->s_paddr))))
/* This code used to set scnhdr_int->s_paddr to 0. However,
coff_set_alignment_hook stores s_paddr in virt_size, which
only works if it correctly holds the virtual size of the
return abfd->xvec;
}
-enum arch_type
-{
- arch_type_unknown,
- arch_type_i386,
- arch_type_x86_64
-};
-
-static enum arch_type
-pe_arch (const char *arch)
-{
- if (strcmp (arch, "i386") == 0 || strcmp (arch, "ia32") == 0)
- return arch_type_i386;
-
- if (strcmp (arch, "x86_64") == 0 || strcmp (arch, "x86-64") == 0)
- return arch_type_x86_64;
-
- return arch_type_unknown;
-}
-
static const bfd_target *
pe_bfd_object_p (bfd * abfd)
{
struct external_PEI_DOS_hdr dos_hdr;
struct external_PEI_IMAGE_hdr image_hdr;
file_ptr offset;
- const bfd_target *target;
- struct bfd_preserve preserve;
/* Detect if this a Microsoft Import Library Format element. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0
return NULL;
}
- preserve.marker = NULL;
- if (! bfd_preserve_save (abfd, &preserve))
- return NULL;
-
- target = coff_object_p (abfd);
- if (target)
- {
- pe_data_type *pe = pe_data (abfd);
- struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
- bfd_boolean efi = i->Subsystem == IMAGE_SUBSYSTEM_EFI_APPLICATION
- || i->Subsystem == IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER
- || i->Subsystem == IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER;
- enum arch_type arch;
- const bfd_target * const *target_ptr;
-
- /* Get the machine. */
- if (bfd_target_efi_app_p (abfd->xvec))
- arch = pe_arch (bfd_target_efi_app_arch (abfd->xvec));
- else if (bfd_target_efi_bsdrv_p (abfd->xvec))
- arch = pe_arch (bfd_target_efi_bsdrv_arch (abfd->xvec));
- else if (bfd_target_efi_rtdrv_p (abfd->xvec))
- arch = pe_arch (bfd_target_efi_rtdrv_arch (abfd->xvec));
- else
- arch = pe_arch (bfd_target_pei_arch (abfd->xvec));
-
- /* Don't check PE vs. EFI if arch is unknown. */
- if (arch == arch_type_unknown)
- {
- bfd_preserve_finish (abfd, &preserve);
- return target;
- }
-
- for (target_ptr = bfd_target_vector; *target_ptr != NULL;
- target_ptr++)
- {
- if (*target_ptr == target
- || (*target_ptr)->flavour != bfd_target_coff_flavour)
- continue;
-
- if (bfd_target_efi_app_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_efi_app_arch (*target_ptr)) != arch)
- continue;
-
- if (efi)
- {
- /* TARGET_PTR is an EFI backend. Don't match
- TARGET with a EFI file. */
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
- else if (bfd_target_efi_bsdrv_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_efi_bsdrv_arch (*target_ptr)) != arch)
- continue;
-
- if (efi)
- {
- /* TARGET_PTR is an EFI backend. Don't match
- TARGET with a EFI file. */
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
- else if (bfd_target_efi_rtdrv_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_efi_rtdrv_arch (*target_ptr)) != arch)
- continue;
-
- if (efi)
- {
-no_match:
- /* TARGET_PTR is an EFI backend. Don't match
- TARGET with a EFI file. */
- bfd_preserve_restore (abfd, &preserve);
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
- }
- else if (bfd_target_pei_p (*target_ptr))
- {
- /* Skip incompatible arch. */
- if (pe_arch (bfd_target_pei_arch (*target_ptr)) != arch)
- continue;
-
- if (!efi)
- {
- /* TARGET_PTR is a PE backend. Don't match
- TARGET with a PE file. */
- goto no_match;
- }
- }
- }
-
- bfd_preserve_finish (abfd, &preserve);
- }
- else
- bfd_preserve_restore (abfd, &preserve);
-
- return target;
+ return coff_object_p (abfd);
}
#define coff_object_p pe_bfd_object_p
extern const bfd_target armpei_little_vec;
extern const bfd_target b_out_vec_big_host;
extern const bfd_target b_out_vec_little_host;
-extern const bfd_target bfd_efi_app_ia32_vec;
-extern const bfd_target bfd_efi_bsdrv_ia32_vec;
-extern const bfd_target bfd_efi_rtdrv_ia32_vec;
-extern const bfd_target bfd_efi_app_x86_64_vec;
-extern const bfd_target bfd_efi_bsdrv_x86_64_vec;
-extern const bfd_target bfd_efi_rtdrv_x86_64_vec;
-extern const bfd_target bfd_efi_app_ia64_vec;
-extern const bfd_target bfd_efi_bsdrv_ia64_vec;
-extern const bfd_target bfd_efi_rtdrv_ia64_vec;
+extern const bfd_target bfd_pei_ia64_vec;
extern const bfd_target bfd_elf32_avr_vec;
extern const bfd_target bfd_elf32_bfin_vec;
extern const bfd_target bfd_elf32_bfinfdpic_vec;
&armpei_little_vec,
&b_out_vec_big_host,
&b_out_vec_little_host,
- &bfd_efi_app_ia32_vec,
- &bfd_efi_bsdrv_ia32_vec,
- &bfd_efi_rtdrv_ia32_vec,
#ifdef BFD64
- &bfd_efi_app_x86_64_vec,
- &bfd_efi_bsdrv_x86_64_vec,
- &bfd_efi_rtdrv_x86_64_vec,
- &bfd_efi_app_ia64_vec,
- &bfd_efi_bsdrv_ia64_vec,
- &bfd_efi_rtdrv_ia64_vec,
+ &bfd_pei_ia64_vec,
#endif
&bfd_elf32_avr_vec,
&bfd_elf32_bfin_vec,
+2009-04-17 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/10074
+ * objcopy.c: Include coff/i386.h and coff/pe.h.
+ (pe_file_alignment): New.
+ (pe_heap_commit): Likewise.
+ (pe_heap_reserve): Likewise.
+ (pe_image_base): Likewise.
+ (pe_section_alignment): Likewise.
+ (pe_stack_commit): Likewise.
+ (pe_stack_reserve): Likewise.
+ (pe_subsystem): Likewise.
+ (pe_major_subsystem_version): Likewise.
+ (pe_minor_subsystem_version): Likewise.
+ (set_pe_subsystem): Likewise.
+ (convert_efi_target): Likewise.
+ (command_line_switch): Add OPTION_FILE_ALIGNMENT,
+ OPTION_HEAP, OPTION_IMAGE_BASE, OPTION_SECTION_ALIGNMENT,
+ OPTION_STACK and OPTION_SUBSYSTEM.
+ (copy_options): Likewise.
+ (copy_usage): Add --file-alignment, --heap, --image-base,
+ --section-alignment, --stack and --subsystem.
+ (copy_object): Set up PE parameters.
+ (copy_main): Process Add OPTION_FILE_ALIGNMENT,
+ OPTION_HEAP, OPTION_IMAGE_BASE, OPTION_SECTION_ALIGNMENT,
+ OPTION_STACK and OPTION_SUBSYSTEM. Convert EFI target to
+ PEI target.
+
+ * NEWS: Mention --file-alignment, --heap, --image-base,
+ --section-alignment, --stack and --subsystem command line
+ options for objcopy.
+
+ * doc/binutils.texi: Document --file-alignment, --heap,
+ --image-base, --section-alignment, --stack and --subsystem
+ command line options for objcopy.
+
2009-04-15 Anthony Green <green@moxielogic.com>
* MAINTAINERS: Add myself and Moxie port maintainer.
-*- text -*-
+* Add --file-alignment, --heap, --image-base, --section-alignment,
+ --stack and --subsystem command line options to objcopy, which will
+ set PE optional header.
+
* Option --dwarf/-W of objdump is now as flexible as readelf --debug-dump/-w.
* --as-needed now links in a dynamic library if it satisfies undefined
[@option{--readonly-text}]
[@option{--pure}]
[@option{--impure}]
+ [@option{--file-alignment=}@var{num}]
+ [@option{--heap=}@var{size}]
+ [@option{--image-base=}@var{address}]
+ [@option{--section-alignment=}@var{num}]
+ [@option{--stack=}@var{size}]
+ [@option{--subsystem=}@var{which}:@var{major}.@var{minor}]
[@option{-v}|@option{--verbose}]
[@option{-V}|@option{--version}]
[@option{--help}] [@option{--info}]
needed if debugging abilities are required. The suggested procedure
to create these files is as follows:
+@item --file-alignment @var{num}
+Specify the file alignment. Sections in the file will always begin at
+file offsets which are multiples of this number. This defaults to
+512.
+[This option is specific to PE targets.]
+
+@item --heap @var{reserve}
+@itemx --heap @var{reserve},@var{commit}
+Specify the number of bytes of memory to reserve (and optionally commit)
+to be used as heap for this program.
+[This option is specific to PE targets.]
+
+@item --image-base @var{value}
+Use @var{value} as the base address of your program or dll. This is
+the lowest memory location that will be used when your program or dll
+is loaded. To reduce the need to relocate and improve performance of
+your dlls, each should have a unique base address and not overlap any
+other dlls. The default is 0x400000 for executables, and 0x10000000
+for dlls.
+[This option is specific to PE targets.]
+
+@item --section-alignment @var{num}
+Sets the section alignment. Sections in memory will always begin at
+addresses which are a multiple of this number. Defaults to 0x1000.
+[This option is specific to PE targets.]
+
+@item --stack @var{reserve}
+@itemx --stack @var{reserve},@var{commit}
+Specify the number of bytes of memory to reserve (and optionally commit)
+to be used as stack for this program.
+[This option is specific to PE targets.]
+
+@item --subsystem @var{which}
+@itemx --subsystem @var{which}:@var{major}
+@itemx --subsystem @var{which}:@var{major}.@var{minor}
+Specifies the subsystem under which your program will execute. The
+legal values for @var{which} are @code{native}, @code{windows},
+@code{console}, @code{posix}, @code{efi-app}, @code{efi-bsd},
+@code{efi-rtd}, @code{efi-rom}, and @code{xbox}. You may optionally set
+the subsystem version also. Numeric values are also accepted for
+@var{which}.
+[This option is specific to PE targets.]
+
@enumerate
@item Link the executable as normal. Assuming that is is called
@code{foo} then...
#include "coff/internal.h"
#include "libcoff.h"
+/* FIXME: See bfd/peXXigen.c for why we include an architecture specific
+ header in generic PE code. */
+#include "coff/i386.h"
+#include "coff/pe.h"
+
+static bfd_vma pe_file_alignment = (bfd_vma) -1;
+static bfd_vma pe_heap_commit = (bfd_vma) -1;
+static bfd_vma pe_heap_reserve = (bfd_vma) -1;
+static bfd_vma pe_image_base = (bfd_vma) -1;
+static bfd_vma pe_section_alignment = (bfd_vma) -1;
+static bfd_vma pe_stack_commit = (bfd_vma) -1;
+static bfd_vma pe_stack_reserve = (bfd_vma) -1;
+static short pe_subsystem = -1;
+static short pe_major_subsystem_version = -1;
+static short pe_minor_subsystem_version = -1;
+
struct is_specified_symbol_predicate_data
{
const char *name;
OPTION_PURE,
OPTION_IMPURE,
OPTION_EXTRACT_SYMBOL,
- OPTION_REVERSE_BYTES
+ OPTION_REVERSE_BYTES,
+ OPTION_FILE_ALIGNMENT,
+ OPTION_HEAP,
+ OPTION_IMAGE_BASE,
+ OPTION_SECTION_ALIGNMENT,
+ OPTION_STACK,
+ OPTION_SUBSYSTEM
};
/* Options to handle if running as "strip". */
{"weaken-symbols", required_argument, 0, OPTION_WEAKEN_SYMBOLS},
{"wildcard", no_argument, 0, 'w'},
{"writable-text", no_argument, 0, OPTION_WRITABLE_TEXT},
+ {"file-alignment", required_argument, 0, OPTION_FILE_ALIGNMENT},
+ {"heap", required_argument, 0, OPTION_HEAP},
+ {"image-base", required_argument, 0 , OPTION_IMAGE_BASE},
+ {"section-alignment", required_argument, 0, OPTION_SECTION_ALIGNMENT},
+ {"stack", required_argument, 0, OPTION_STACK},
+ {"subsystem", required_argument, 0, OPTION_SUBSYSTEM},
{0, no_argument, 0, 0}
};
--prefix-alloc-sections <prefix>\n\
Add <prefix> to start of every allocatable\n\
section name\n\
+ --file-alignment <num> Set PE file alignment to <num>\n\
+ --heap <reserve>[,<commit>] Set PE reserve/commit heap to <reserve>/\n\
+ <commit>\n\
+ --image-base <address> Set PE image base to <address>\n\
+ --section-alignment <num> Set PE section alignment to <num>\n\
+ --stack <reserve>[,<commit>] Set PE reserve/commit stack to <reserve>/\n\
+ <commit>\n\
+ --subsystem <name>[:<version>]\n\
+ Set PE subsystem to <name> [& <version>]\n]\
-v --verbose List all object files modified\n\
@<file> Read options from <file>\n\
-V --version Display this program's version number\n\
return FALSE;
}
+ if (bfd_get_flavour (obfd) == bfd_target_coff_flavour
+ && bfd_pei_p (obfd))
+ {
+ /* Set up PE parameters. */
+ pe_data_type *pe = pe_data (obfd);
+
+ if (pe_file_alignment != (bfd_vma) -1)
+ pe->pe_opthdr.FileAlignment = pe_file_alignment;
+ else
+ pe_file_alignment = PE_DEF_FILE_ALIGNMENT;
+
+ if (pe_heap_commit != (bfd_vma) -1)
+ pe->pe_opthdr.SizeOfHeapCommit = pe_heap_commit;
+
+ if (pe_heap_reserve != (bfd_vma) -1)
+ pe->pe_opthdr.SizeOfHeapCommit = pe_heap_reserve;
+
+ if (pe_image_base != (bfd_vma) -1)
+ pe->pe_opthdr.ImageBase = pe_image_base;
+
+ if (pe_section_alignment != (bfd_vma) -1)
+ pe->pe_opthdr.SectionAlignment = pe_section_alignment;
+ else
+ pe_section_alignment = PE_DEF_SECTION_ALIGNMENT;
+
+ if (pe_stack_commit != (bfd_vma) -1)
+ pe->pe_opthdr.SizeOfStackCommit = pe_stack_commit;
+
+ if (pe_stack_reserve != (bfd_vma) -1)
+ pe->pe_opthdr.SizeOfStackCommit = pe_stack_reserve;
+
+ if (pe_subsystem != -1)
+ pe->pe_opthdr.Subsystem = pe_subsystem;
+
+ if (pe_major_subsystem_version != -1)
+ pe->pe_opthdr.MajorSubsystemVersion = pe_major_subsystem_version;
+
+ if (pe_minor_subsystem_version != -1)
+ pe->pe_opthdr.MinorSubsystemVersion = pe_minor_subsystem_version;
+
+ if (pe_file_alignment > pe_section_alignment)
+ {
+ char file_alignment[20], section_alignment[20];
+
+ sprintf_vma (file_alignment, pe_file_alignment);
+ sprintf_vma (section_alignment, pe_section_alignment);
+ non_fatal (_("warning: file alignment (0x%s) > section alignment (0x%s)"),
+
+ file_alignment, section_alignment);
+ }
+ }
+
if (isympp)
free (isympp);
return status;
}
+/* Set up PE subsystem. */
+
+static void
+set_pe_subsystem (const char *s)
+{
+ const char *version, *subsystem;
+ size_t i;
+ static const struct
+ {
+ const char *name;
+ const char set_def;
+ const short value;
+ }
+ v[] =
+ {
+ { "native", 0, IMAGE_SUBSYSTEM_NATIVE },
+ { "windows", 0, IMAGE_SUBSYSTEM_WINDOWS_GUI },
+ { "console", 0, IMAGE_SUBSYSTEM_WINDOWS_CUI },
+ { "posix", 0, IMAGE_SUBSYSTEM_POSIX_CUI },
+ { "wince", 0, IMAGE_SUBSYSTEM_WINDOWS_CE_GUI },
+ { "efi-app", 1, IMAGE_SUBSYSTEM_EFI_APPLICATION },
+ { "efi-bsd", 1, IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER },
+ { "efi-rtd", 1, IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER },
+ { "efi-rom", 1, IMAGE_SUBSYSTEM_EFI_ROM },
+ { "xbox", 0, IMAGE_SUBSYSTEM_XBOX }
+ };
+ short value;
+ char *copy;
+ int set_def = -1;
+
+ /* Check for the presence of a version number. */
+ version = strchr (s, ':');
+ if (version == NULL)
+ subsystem = s;
+ else
+ {
+ int len = version - s;
+ copy = xstrdup (s);
+ subsystem = copy;
+ copy[len] = '\0';
+ version = copy + 1 + len;
+ pe_major_subsystem_version = strtoul (version, ©, 0);
+ if (*copy == '.')
+ pe_minor_subsystem_version = strtoul (copy + 1, ©, 0);
+ if (*copy != '\0')
+ non_fatal (_("%s: bad version in PE subsystem"), s);
+ }
+
+ /* Check for numeric subsystem. */
+ value = (short) strtol (subsystem, ©, 0);
+ if (*copy == '\0')
+ {
+ for (i = 0; i < ARRAY_SIZE (v); i++)
+ if (v[i].value == value)
+ {
+ pe_subsystem = value;
+ set_def = v[i].set_def;
+ break;
+ }
+ }
+ else
+ {
+ /* Search for subsystem by name. */
+ for (i = 0; i < ARRAY_SIZE (v); i++)
+ if (strcmp (subsystem, v[i].name) == 0)
+ {
+ pe_subsystem = v[i].value;
+ set_def = v[i].set_def;
+ break;
+ }
+ }
+
+ switch (set_def)
+ {
+ case -1:
+ fatal (_("unknown PE subsystem: %s"), s);
+ break;
+ case 0:
+ break;
+ default:
+ if (pe_file_alignment == (bfd_vma) -1)
+ pe_file_alignment = PE_DEF_FILE_ALIGNMENT;
+ if (pe_section_alignment == (bfd_vma) -1)
+ pe_section_alignment = PE_DEF_SECTION_ALIGNMENT;
+ break;
+ }
+}
+
+/* Convert EFI target to PEI target. */
+
+static void
+convert_efi_target (char *efi)
+{
+ efi[0] = 'p';
+ efi[1] = 'e';
+ efi[2] = 'i';
+
+ if (strcmp (efi + 4, "ia32") == 0)
+ {
+ /* Change ia32 to i386. */
+ efi[5]= '3';
+ efi[6]= '8';
+ efi[7]= '6';
+ }
+ else if (strcmp (efi + 4, "x86_64") == 0)
+ {
+ /* Change x86_64 to x86-64. */
+ efi[7] = '-';
+ }
+}
+
static int
copy_main (int argc, char *argv[])
{
break;
}
+ case OPTION_FILE_ALIGNMENT:
+ pe_file_alignment = parse_vma (optarg, "--file-alignment");
+ break;
+
+ case OPTION_HEAP:
+ {
+ char *end;
+ pe_heap_reserve = strtoul (optarg, &end, 0);
+ if (end == optarg
+ || (*end != '.' && *end != '\0'))
+ non_fatal (_("%s: invalid reserve value for --heap"),
+ optarg);
+ else if (*end != '\0')
+ {
+ pe_heap_commit = strtoul (end + 1, &end, 0);
+ if (*end != '\0')
+ non_fatal (_("%s: invalid commit value for --heap"),
+ optarg);
+ }
+ }
+ break;
+
+ case OPTION_IMAGE_BASE:
+ pe_image_base = parse_vma (optarg, "--image-base");
+ break;
+
+ case OPTION_SECTION_ALIGNMENT:
+ pe_section_alignment = parse_vma (optarg,
+ "--section-alignment");
+ break;
+
+ case OPTION_SUBSYSTEM:
+ set_pe_subsystem (optarg);
+ break;
+
+ case OPTION_STACK:
+ {
+ char *end;
+ pe_stack_reserve = strtoul (optarg, &end, 0);
+ if (end == optarg
+ || (*end != '.' && *end != '\0'))
+ non_fatal (_("%s: invalid reserve value for --stack"),
+ optarg);
+ else if (*end != '\0')
+ {
+ pe_stack_commit = strtoul (end + 1, &end, 0);
+ if (*end != '\0')
+ non_fatal (_("%s: invalid commit value for --stack"),
+ optarg);
+ }
+ }
+ break;
+
case 0:
/* We've been given a long option. */
break;
if (output_target == NULL)
output_target = input_target;
+ /* Convert input EFI target to PEI target. */
+ if (input_target != NULL
+ && strncmp (input_target, "efi-", 4) == 0)
+ {
+ char *efi;
+
+ efi = xstrdup (output_target + 4);
+ if (strncmp (efi, "bsdrv-", 6) == 0
+ || strncmp (efi, "rtdrv-", 6) == 0)
+ efi += 2;
+ else if (strncmp (efi, "app-", 4) != 0)
+ fatal (_("unknown input EFI target: %s"), input_target);
+
+ input_target = efi;
+ convert_efi_target (efi);
+ }
+
+ /* Convert output EFI target to PEI target. */
+ if (output_target != NULL
+ && strncmp (output_target, "efi-", 4) == 0)
+ {
+ char *efi;
+
+ efi = xstrdup (output_target + 4);
+ if (strncmp (efi, "app-", 4) == 0)
+ {
+ if (pe_subsystem == -1)
+ pe_subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION;
+ }
+ else if (strncmp (efi, "bsdrv-", 6) == 0)
+ {
+ if (pe_subsystem == -1)
+ pe_subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER;
+ efi += 2;
+ }
+ else if (strncmp (efi, "rtdrv-", 6) == 0)
+ {
+ if (pe_subsystem == -1)
+ pe_subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER;
+ efi += 2;
+ }
+ else
+ fatal (_("unknown output EFI target: %s"), output_target);
+
+ if (pe_file_alignment == (bfd_vma) -1)
+ pe_file_alignment = PE_DEF_FILE_ALIGNMENT;
+ if (pe_section_alignment == (bfd_vma) -1)
+ pe_section_alignment = PE_DEF_SECTION_ALIGNMENT;
+
+ output_target = efi;
+ convert_efi_target (efi);
+ }
+
if (binary_architecture != NULL)
{
if (input_target && strcmp (input_target, "binary") == 0)