mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-09-10 12:22:20 +08:00
Don't add IMAGE_FILE_RELOCS_STRIPPED for PIE.
2010-03-18 H.J. Lu <hongjiu.lu@intel.com> PR binutils/11396 * libcoff-in.h (pe_tdata): Add dont_strip_reloc. * libcoff.h: Regenerated. * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Clear F_RELFLG if dont_strip_reloc is set. (_bfd_XX_bfd_copy_private_bfd_data_common): Set dont_strip_reloc on output if there is no .reloc and IMAGE_FILE_RELOCS_STRIPPED isn't set in input.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2010-03-18 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR binutils/11396
|
||||||
|
* libcoff-in.h (pe_tdata): Add dont_strip_reloc.
|
||||||
|
* libcoff.h: Regenerated.
|
||||||
|
|
||||||
|
* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Clear F_RELFLG
|
||||||
|
if dont_strip_reloc is set.
|
||||||
|
(_bfd_XX_bfd_copy_private_bfd_data_common): Set
|
||||||
|
dont_strip_reloc on output if there is no .reloc and
|
||||||
|
IMAGE_FILE_RELOCS_STRIPPED isn't set in input.
|
||||||
|
|
||||||
2010-03-18 Wei Guozhi <carrot@google.com>
|
2010-03-18 Wei Guozhi <carrot@google.com>
|
||||||
|
|
||||||
PR gas/11323
|
PR gas/11323
|
||||||
|
@ -118,6 +118,7 @@ typedef struct pe_tdata
|
|||||||
struct internal_extra_pe_aouthdr pe_opthdr;
|
struct internal_extra_pe_aouthdr pe_opthdr;
|
||||||
int dll;
|
int dll;
|
||||||
int has_reloc_section;
|
int has_reloc_section;
|
||||||
|
int dont_strip_reloc;
|
||||||
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
|
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
|
||||||
flagword real_flags;
|
flagword real_flags;
|
||||||
} pe_data_type;
|
} pe_data_type;
|
||||||
|
@ -122,6 +122,7 @@ typedef struct pe_tdata
|
|||||||
struct internal_extra_pe_aouthdr pe_opthdr;
|
struct internal_extra_pe_aouthdr pe_opthdr;
|
||||||
int dll;
|
int dll;
|
||||||
int has_reloc_section;
|
int has_reloc_section;
|
||||||
|
int dont_strip_reloc;
|
||||||
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
|
bfd_boolean (*in_reloc_p) (bfd *, reloc_howto_type *);
|
||||||
flagword real_flags;
|
flagword real_flags;
|
||||||
} pe_data_type;
|
} pe_data_type;
|
||||||
|
@ -740,7 +740,8 @@ _bfd_XXi_only_swap_filehdr_out (bfd * abfd, void * in, void * out)
|
|||||||
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
|
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
|
||||||
struct external_PEI_filehdr *filehdr_out = (struct external_PEI_filehdr *) out;
|
struct external_PEI_filehdr *filehdr_out = (struct external_PEI_filehdr *) out;
|
||||||
|
|
||||||
if (pe_data (abfd)->has_reloc_section)
|
if (pe_data (abfd)->has_reloc_section
|
||||||
|
|| pe_data (abfd)->dont_strip_reloc)
|
||||||
filehdr_in->f_flags &= ~F_RELFLG;
|
filehdr_in->f_flags &= ~F_RELFLG;
|
||||||
|
|
||||||
if (pe_data (abfd)->dll)
|
if (pe_data (abfd)->dll)
|
||||||
@ -2206,6 +2207,14 @@ _bfd_XX_bfd_copy_private_bfd_data_common (bfd * ibfd, bfd * obfd)
|
|||||||
pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].VirtualAddress = 0;
|
pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].VirtualAddress = 0;
|
||||||
pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].Size = 0;
|
pe_data (obfd)->pe_opthdr.DataDirectory[PE_BASE_RELOCATION_TABLE].Size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For PIE, if there is .reloc, we won't add IMAGE_FILE_RELOCS_STRIPPED.
|
||||||
|
But there is no .reloc, we make sure that IMAGE_FILE_RELOCS_STRIPPED
|
||||||
|
won't be added. */
|
||||||
|
if (! pe_data (ibfd)->has_reloc_section
|
||||||
|
&& ! (pe_data (ibfd)->real_flags & IMAGE_FILE_RELOCS_STRIPPED))
|
||||||
|
pe_data (obfd)->dont_strip_reloc = 1;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user