GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Bug 40131: Remove unused binutils patches

parent f3369b53
From 05164a1162d5f6f696d7f7c4b1bc61ef06d1c288 Mon Sep 17 00:00:00 2001
From: Georg Koppen <gk@torproject.org>
Date: Tue, 12 Sep 2017 07:21:16 +0000
Subject: [PATCH] 64bit fixups
---
ld/emultempl/pep.em | 4 ++--
ld/pep-dll.c | 1 +
ld/pep-dll.h | 1 +
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index fccbd63..f7c0a57 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -742,7 +742,7 @@ gld${EMULATION_NAME}_handle_option (int optc)
pep_dll_exclude_all_symbols = 1;
break;
case OPTION_ENABLE_RELOC_SECTION:
- pe_dll_enable_reloc_section = 1;
+ pep_dll_enable_reloc_section = 1;
break;
case OPTION_EXCLUDE_LIBS:
pep_dll_add_excludes (optarg, EXCLUDELIBS);
@@ -1862,7 +1862,7 @@ gld_${EMULATION_NAME}_finish (void)
#ifdef DLL_SUPPORT
if (bfd_link_pic (&link_info)
|| (!bfd_link_relocatable (&link_info)
- && pe_dll_enable_reloc_section)
+ && pep_dll_enable_reloc_section)
|| (!bfd_link_relocatable (&link_info)
&& pep_def_file->num_exports != 0))
{
diff --git a/ld/pep-dll.c b/ld/pep-dll.c
index b8c017f..5ad5733 100644
--- a/ld/pep-dll.c
+++ b/ld/pep-dll.c
@@ -31,6 +31,7 @@
#define pe_dll_export_everything pep_dll_export_everything
#define pe_dll_exclude_all_symbols pep_dll_exclude_all_symbols
#define pe_dll_do_default_excludes pep_dll_do_default_excludes
+#define pe_dll_enable_reloc_section pep_dll_enable_reloc_section
#define pe_dll_kill_ats pep_dll_kill_ats
#define pe_dll_stdcall_aliases pep_dll_stdcall_aliases
#define pe_dll_warn_dup_exports pep_dll_warn_dup_exports
diff --git a/ld/pep-dll.h b/ld/pep-dll.h
index 0a27c1f..95d9c15 100644
--- a/ld/pep-dll.h
+++ b/ld/pep-dll.h
@@ -31,6 +31,7 @@ extern def_file * pep_def_file;
extern int pep_dll_export_everything;
extern int pep_dll_exclude_all_symbols;
extern int pep_dll_do_default_excludes;
+extern int pep_dll_enable_reloc_section;
extern int pep_dll_kill_ats;
extern int pep_dll_stdcall_aliases;
extern int pep_dll_warn_dup_exports;
--
2.1.4
From fba503a78c50d6134943245d55e820f53e8f19cd Mon Sep 17 00:00:00 2001
From: Erinn Clark <erinn@torproject.org>
Date: Fri, 8 Aug 2014 14:23:44 -0400
Subject: [PATCH] add relocation section so Windows bundles can have ASLR
Patch by skruffy.
---
ld/emultempl/pe.em | 7 ++++++
ld/emultempl/pep.em | 11 ++++++++--
ld/pe-dll.c | 63 ++++++++++++++++++++++++++++++-----------------------
ld/pe-dll.h | 1 +
4 files changed, 53 insertions(+), 29 deletions(-)
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index 339b7c5..3958b81 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -272,6 +272,7 @@ fragment <<EOF
#define OPTION_INSERT_TIMESTAMP (OPTION_TERMINAL_SERVER_AWARE + 1)
#define OPTION_NO_INSERT_TIMESTAMP (OPTION_INSERT_TIMESTAMP + 1)
#define OPTION_BUILD_ID (OPTION_NO_INSERT_TIMESTAMP + 1)
+#define OPTION_ENABLE_RELOC_SECTION (OPTION_BUILD_ID + 1)
static void
gld${EMULATION_NAME}_add_options
@@ -315,6 +316,7 @@ gld${EMULATION_NAME}_add_options
{"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
{"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
{"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_SYMBOLS},
+ {"enable-reloc-section", no_argument, NULL, OPTION_ENABLE_RELOC_SECTION},
{"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
{"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB},
{"kill-at", no_argument, NULL, OPTION_KILL_ATS},
@@ -782,6 +784,9 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_EXCLUDE_ALL_SYMBOLS:
pe_dll_exclude_all_symbols = 1;
break;
+ case OPTION_ENABLE_RELOC_SECTION:
+ pe_dll_enable_reloc_section = 1;
+ break;
case OPTION_EXCLUDE_LIBS:
pe_dll_add_excludes (optarg, EXCLUDELIBS);
break;
@@ -2076,6 +2081,8 @@ gld_${EMULATION_NAME}_finish (void)
#if !defined(TARGET_IS_shpe)
|| (!bfd_link_relocatable (&link_info)
&& pe_def_file->num_exports != 0)
+ || (!bfd_link_relocatable (&link_info)
+ && pe_dll_enable_reloc_section)
#endif
)
{
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index c253d2f..fccbd63 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -246,7 +246,8 @@ enum options
OPTION_INSERT_TIMESTAMP,
OPTION_NO_INSERT_TIMESTAMP,
OPTION_TERMINAL_SERVER_AWARE,
- OPTION_BUILD_ID
+ OPTION_BUILD_ID,
+ OPTION_ENABLE_RELOC_SECTION
};
static void
@@ -288,6 +289,7 @@ gld${EMULATION_NAME}_add_options
{"export-all-symbols", no_argument, NULL, OPTION_EXPORT_ALL},
{"exclude-symbols", required_argument, NULL, OPTION_EXCLUDE_SYMBOLS},
{"exclude-all-symbols", no_argument, NULL, OPTION_EXCLUDE_ALL_SYMBOLS},
+ {"enable-reloc-section", no_argument, NULL, OPTION_ENABLE_RELOC_SECTION},
{"exclude-libs", required_argument, NULL, OPTION_EXCLUDE_LIBS},
{"exclude-modules-for-implib", required_argument, NULL, OPTION_EXCLUDE_MODULES_FOR_IMPLIB},
{"kill-at", no_argument, NULL, OPTION_KILL_ATS},
@@ -739,6 +741,9 @@ gld${EMULATION_NAME}_handle_option (int optc)
case OPTION_EXCLUDE_ALL_SYMBOLS:
pep_dll_exclude_all_symbols = 1;
break;
+ case OPTION_ENABLE_RELOC_SECTION:
+ pe_dll_enable_reloc_section = 1;
+ break;
case OPTION_EXCLUDE_LIBS:
pep_dll_add_excludes (optarg, EXCLUDELIBS);
break;
@@ -1857,7 +1862,9 @@ gld_${EMULATION_NAME}_finish (void)
#ifdef DLL_SUPPORT
if (bfd_link_pic (&link_info)
|| (!bfd_link_relocatable (&link_info)
- && pep_def_file->num_exports != 0))
+ && pe_dll_enable_reloc_section)
+ || (!bfd_link_relocatable (&link_info)
+ && pep_def_file->num_exports != 0))
{
pep_dll_fill_sections (link_info.output_bfd, &link_info);
if (command_line.out_implib_filename)
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index c398f23..3797f1a 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -151,6 +151,7 @@ def_file * pe_def_file = 0;
int pe_dll_export_everything = 0;
int pe_dll_exclude_all_symbols = 0;
int pe_dll_do_default_excludes = 1;
+int pe_dll_enable_reloc_section = 0;
int pe_dll_kill_ats = 0;
int pe_dll_stdcall_aliases = 0;
int pe_dll_warn_dup_exports = 0;
@@ -3430,8 +3431,15 @@ pe_dll_build_sections (bfd *abfd, struct bfd_link_info *info)
process_def_file_and_drectve (abfd, info);
if (pe_def_file->num_exports == 0 && !bfd_link_pic (info))
- return;
-
+ {
+ if (pe_dll_enable_reloc_section)
+ {
+ build_filler_bfd (0);
+ pe_output_file_set_long_section_names (filler_bfd);
+ }
+ return;
+ }
+
generate_edata (abfd, info);
build_filler_bfd (1);
pe_output_file_set_long_section_names (filler_bfd);
@@ -3446,13 +3454,9 @@ pe_exe_build_sections (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED)
pe_output_file_set_long_section_names (filler_bfd);
}
-void
-pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
+static void
+pe_dll_create_reloc (bfd *abfd, struct bfd_link_info *info)
{
- pe_dll_id_target (bfd_get_target (abfd));
- pe_output_file_set_long_section_names (abfd);
- image_base = pe_data (abfd)->pe_opthdr.ImageBase;
-
generate_reloc (abfd, info);
if (reloc_sz > 0)
{
@@ -3469,38 +3473,43 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
lang_do_assignments (lang_final_phase_enum);
}
- fill_edata (abfd, info);
-
- if (bfd_link_dll (info))
- pe_data (abfd)->dll = 1;
-
- edata_s->contents = edata_d;
reloc_s->contents = reloc_d;
}
void
-pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
+pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info)
{
+ if (!reloc_s && !edata_s)
+ return;
pe_dll_id_target (bfd_get_target (abfd));
pe_output_file_set_long_section_names (abfd);
image_base = pe_data (abfd)->pe_opthdr.ImageBase;
- generate_reloc (abfd, info);
- if (reloc_sz > 0)
+ if (reloc_s)
+ pe_dll_create_reloc (abfd, info);
+
+ if (edata_s)
{
- bfd_set_section_size (filler_bfd, reloc_s, reloc_sz);
+ fill_edata (abfd, info);
+ edata_s->contents = edata_d;
+ }
- /* Resize the sections. */
- lang_reset_memory_regions ();
- lang_size_sections (NULL, TRUE);
+ if (bfd_link_pic (info) && !bfd_link_pie (info))
+ pe_data (abfd)->dll = 1;
- /* Redo special stuff. */
- ldemul_after_allocation ();
- /* Do the assignments again. */
- lang_do_assignments (lang_final_phase_enum);
- }
- reloc_s->contents = reloc_d;
+}
+
+void
+pe_exe_fill_sections (bfd *abfd, struct bfd_link_info *info)
+{
+ if (!reloc_s)
+ return;
+ pe_dll_id_target (bfd_get_target (abfd));
+ pe_output_file_set_long_section_names (abfd);
+ image_base = pe_data (abfd)->pe_opthdr.ImageBase;
+
+ pe_dll_create_reloc (abfd, info);
}
bfd_boolean
diff --git a/ld/pe-dll.h b/ld/pe-dll.h
index 48d169b..05ff72b 100644
--- a/ld/pe-dll.h
+++ b/ld/pe-dll.h
@@ -30,6 +30,7 @@ extern def_file *pe_def_file;
extern int pe_dll_export_everything;
extern int pe_dll_exclude_all_symbols;
extern int pe_dll_do_default_excludes;
+extern int pe_dll_enable_reloc_section;
extern int pe_dll_kill_ats;
extern int pe_dll_stdcall_aliases;
extern int pe_dll_warn_dup_exports;
--
2.1.4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment