mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
ld/PE: respect --enable-reloc-section even when .reloc isn't created by default
Even when !DLL_SUPPORT, an executable may still want to have base relocations created. Avoid doing so by default, though, to not alter prior behavior. With this, an xfail can (and actually should) go away (or else we end up with an XPASS).
This commit is contained in:
@@ -228,6 +228,8 @@ fragment <<EOF
|
|||||||
link_info.pei386_auto_import = ${default_auto_import};
|
link_info.pei386_auto_import = ${default_auto_import};
|
||||||
/* Use by default version. */
|
/* Use by default version. */
|
||||||
link_info.pei386_runtime_pseudo_reloc = DEFAULT_PSEUDO_RELOC_VERSION;
|
link_info.pei386_runtime_pseudo_reloc = DEFAULT_PSEUDO_RELOC_VERSION;
|
||||||
|
#else
|
||||||
|
pe_dll_enable_reloc_section = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1594,6 +1596,9 @@ gld${EMULATION_NAME}_after_open (void)
|
|||||||
else
|
else
|
||||||
pe_exe_build_sections (link_info.output_bfd, &link_info);
|
pe_exe_build_sections (link_info.output_bfd, &link_info);
|
||||||
#endif
|
#endif
|
||||||
|
#else /* !DLL_SUPPORT */
|
||||||
|
if (!bfd_link_relocatable (&link_info))
|
||||||
|
pe_exe_build_sections (link_info.output_bfd, &link_info);
|
||||||
#endif /* DLL_SUPPORT */
|
#endif /* DLL_SUPPORT */
|
||||||
|
|
||||||
#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
|
#if defined(TARGET_IS_armpe) || defined(TARGET_IS_arm_wince_pe)
|
||||||
@@ -2104,6 +2109,9 @@ gld${EMULATION_NAME}_finish (void)
|
|||||||
|
|
||||||
if (pe_out_def_filename)
|
if (pe_out_def_filename)
|
||||||
pe_dll_generate_def_file (pe_out_def_filename);
|
pe_dll_generate_def_file (pe_out_def_filename);
|
||||||
|
#else /* !DLL_SUPPORT */
|
||||||
|
if (!bfd_link_relocatable (&link_info))
|
||||||
|
pe_exe_fill_sections (link_info.output_bfd, &link_info);
|
||||||
#endif /* DLL_SUPPORT */
|
#endif /* DLL_SUPPORT */
|
||||||
|
|
||||||
/* I don't know where .idata gets set as code, but it shouldn't be. */
|
/* I don't know where .idata gets set as code, but it shouldn't be. */
|
||||||
|
|||||||
@@ -246,6 +246,8 @@ gld${EMULATION_NAME}_before_parse (void)
|
|||||||
config.has_shared = 1;
|
config.has_shared = 1;
|
||||||
link_info.pei386_auto_import = 1;
|
link_info.pei386_auto_import = 1;
|
||||||
link_info.pei386_runtime_pseudo_reloc = 2; /* Use by default version 2. */
|
link_info.pei386_runtime_pseudo_reloc = 2; /* Use by default version 2. */
|
||||||
|
#else
|
||||||
|
pep_dll_enable_reloc_section = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1602,6 +1604,9 @@ gld${EMULATION_NAME}_after_open (void)
|
|||||||
else
|
else
|
||||||
pep_exe_build_sections (link_info.output_bfd, &link_info);
|
pep_exe_build_sections (link_info.output_bfd, &link_info);
|
||||||
#endif
|
#endif
|
||||||
|
#else /* !DLL_SUPPORT */
|
||||||
|
if (!bfd_link_relocatable (&link_info))
|
||||||
|
pep_exe_build_sections (link_info.output_bfd, &link_info);
|
||||||
#endif /* DLL_SUPPORT */
|
#endif /* DLL_SUPPORT */
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1944,6 +1949,9 @@ gld${EMULATION_NAME}_finish (void)
|
|||||||
|
|
||||||
if (pep_out_def_filename)
|
if (pep_out_def_filename)
|
||||||
pep_dll_generate_def_file (pep_out_def_filename);
|
pep_dll_generate_def_file (pep_out_def_filename);
|
||||||
|
#else /* !DLL_SUPPORT */
|
||||||
|
if (!bfd_link_relocatable (&link_info))
|
||||||
|
pep_exe_fill_sections (link_info.output_bfd, &link_info);
|
||||||
#endif /* DLL_SUPPORT */
|
#endif /* DLL_SUPPORT */
|
||||||
|
|
||||||
/* I don't know where .idata gets set as code, but it shouldn't be. */
|
/* I don't know where .idata gets set as code, but it shouldn't be. */
|
||||||
|
|||||||
@@ -3738,8 +3738,11 @@ pe_exe_build_sections (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
|
|||||||
{
|
{
|
||||||
pe_dll_id_target (bfd_get_target (abfd));
|
pe_dll_id_target (bfd_get_target (abfd));
|
||||||
pe_output_file_set_long_section_names (abfd);
|
pe_output_file_set_long_section_names (abfd);
|
||||||
build_filler_bfd (0);
|
if (pe_dll_enable_reloc_section)
|
||||||
pe_output_file_set_long_section_names (filler_bfd);
|
{
|
||||||
|
build_filler_bfd (false);
|
||||||
|
pe_output_file_set_long_section_names (filler_bfd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#name: PE base relocations
|
#name: PE base relocations
|
||||||
#ld: --enable-reloc-section
|
#ld: --enable-reloc-section
|
||||||
#objdump: -p
|
#objdump: -p
|
||||||
#xfail: mcore-*-*
|
|
||||||
|
|
||||||
.*: file format .*
|
.*: file format .*
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user