X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fpe-x86_64.c;h=12d29e4fa76fac882ab4fce6fa4b4c68f78daace;hb=259f1c5dcab5d7d1b75f97570fd3a397a701d55c;hp=9eb325b80717b3ae842ba1a1d6e17180645fe1cb;hpb=99ad839030c1177eb409a99320fa7e60226f0db3;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/pe-x86_64.c b/bfd/pe-x86_64.c index 9eb325b807..12d29e4fa7 100644 --- a/bfd/pe-x86_64.c +++ b/bfd/pe-x86_64.c @@ -1,11 +1,11 @@ /* BFD back-end for Intel/AMD x86_64 PECOFF files. - Copyright 2006 Free Software Foundation, Inc. + Copyright (C) 2006-2020 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 2 of the License, or + 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, @@ -15,19 +15,25 @@ 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. - + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. + Written by Kai Tietz, OneVision Software GmbH&CoKg. */ -#include "bfd.h" #include "sysdep.h" +#include "bfd.h" -#define TARGET_SYM x86_64pe_vec -#define TARGET_NAME "pe-x86-64" +#define TARGET_SYM x86_64_pe_vec +#define TARGET_NAME "pe-x86-64" #define COFF_WITH_PE #define COFF_WITH_pex64 -#define PCRELOFFSET TRUE -#define TARGET_UNDERSCORE '_' +#define COFF_WITH_PE_BIGOBJ +#define PCRELOFFSET TRUE +#if defined (USE_MINGW64_LEADING_UNDERSCORES) +#define TARGET_UNDERSCORE '_' +#else +#define TARGET_UNDERSCORE 0 +#endif #define COFF_LONG_SECTION_NAMES #define COFF_SUPPORT_GNU_LINKONCE #define COFF_LONG_FILENAMES @@ -35,11 +41,11 @@ #define COFF_SECTION_ALIGNMENT_ENTRIES \ { COFF_SECTION_NAME_EXACT_MATCH (".bss"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ -{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".data"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ -{ COFF_SECTION_NAME_EXACT_MATCH (".rdata"), \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".rdata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ -{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".text"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ @@ -47,7 +53,80 @@ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ +{ COFF_SECTION_NAME_PARTIAL_MATCH (".zdebug"), \ + COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } +/* The function pex64_bfd_print_pdata is implemented in pei-x86_64.c + source, but has be extended to also handle pe objects. */ +extern bfd_boolean pex64_bfd_print_pdata (bfd *, void *); + +#define bfd_pe_print_pdata pex64_bfd_print_pdata + #include "coff-x86_64.c" + +/* Entry for big object files. */ + +const bfd_target +x86_64_pe_be_vec = +{ + "pe-bigobj-x86-64", /* Name. */ + bfd_target_coff_flavour, + BFD_ENDIAN_LITTLE, /* Data byte order is little. */ + BFD_ENDIAN_LITTLE, /* Header byte order is little. */ + + (HAS_RELOC | EXEC_P /* Object flags. */ + | HAS_LINENO | HAS_DEBUG + | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED | BFD_COMPRESS | BFD_DECOMPRESS), + + (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */ + | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING + | SEC_CODE | SEC_DATA | SEC_EXCLUDE ), + + TARGET_UNDERSCORE, /* Leading underscore. */ + '/', /* Ar_pad_char. */ + 15, /* Ar_max_namelen. */ + 0, /* match priority. */ + + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */ + bfd_getl64, bfd_getl_signed_64, bfd_putl64, + bfd_getl32, bfd_getl_signed_32, bfd_putl32, + bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Hdrs. */ + + /* Note that we allow an object file to be treated as a core file as well. */ + { /* bfd_check_format. */ + _bfd_dummy_target, + amd64coff_object_p, + bfd_generic_archive_p, + amd64coff_object_p + }, + { /* bfd_set_format. */ + _bfd_bool_bfd_false_error, + coff_mkobject, + _bfd_generic_mkarchive, + _bfd_bool_bfd_false_error + }, + { /* bfd_write_contents. */ + _bfd_bool_bfd_false_error, + coff_write_object_contents, + _bfd_write_archive_contents, + _bfd_bool_bfd_false_error + }, + + BFD_JUMP_TABLE_GENERIC (coff), + BFD_JUMP_TABLE_COPY (coff), + BFD_JUMP_TABLE_CORE (_bfd_nocore), + BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), + BFD_JUMP_TABLE_SYMBOLS (coff), + BFD_JUMP_TABLE_RELOCS (coff), + BFD_JUMP_TABLE_WRITE (coff), + BFD_JUMP_TABLE_LINK (coff), + BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), + + NULL, + + &bigobj_swap_table +};