commit 1087afecd27f1cb535c3c1187b3d468ee454a15d Author: Georg Koppen gk@torproject.org Date: Sun Mar 25 09:55:21 2018 +0000
Revert "Merge remote-tracking branch 'boklm/bug_16472_v8'"
This reverts commit b8bae5882eac6159c8a6ad466b9dc4a7b18ba27b, reversing changes made to 42720c512520ecef5437d23e405d8ce011764661.
It turns out this binutils update is causing non-reproducible outomces. We need to investigate those further in #16472. --- keyring/binutils.gpg | Bin 2242 -> 25772 bytes projects/binutils/64bit-fixups.patch | 31 ++-- projects/binutils/binutils-224-gold.patch | 98 +++++++++++++ projects/binutils/build | 9 ++ projects/binutils/config | 8 +- projects/binutils/enable-reloc-section-ld.patch | 83 +++++------ projects/binutils/fix-warning-bfd.patch | 186 ++++++++++++++++++++++++ projects/binutils/peXXigen.patch | 14 ++ projects/mingw-w64/build | 8 +- projects/nsis/build | 31 +--- projects/openssl/config | 2 +- projects/selfrando/config | 2 +- projects/zlib/build | 4 +- rbm.conf | 2 +- 14 files changed, 378 insertions(+), 100 deletions(-)
diff --git a/keyring/binutils.gpg b/keyring/binutils.gpg index eab4406..f24bb01 100644 Binary files a/keyring/binutils.gpg and b/keyring/binutils.gpg differ diff --git a/projects/binutils/64bit-fixups.patch b/projects/binutils/64bit-fixups.patch index 7dc1294..33c0297 100644 --- a/projects/binutils/64bit-fixups.patch +++ b/projects/binutils/64bit-fixups.patch @@ -1,19 +1,14 @@ -From 05164a1162d5f6f696d7f7c4b1bc61ef06d1c288 Mon Sep 17 00:00:00 2001 +From f3ba95e14437f10de8b8f296930ff2a8495d18c6 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 +index b566903b14..27006bdf79 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em -@@ -742,7 +742,7 @@ gld${EMULATION_NAME}_handle_option (int optc) +@@ -730,7 +730,7 @@ gld${EMULATION_NAME}_handle_option (int optc) pep_dll_exclude_all_symbols = 1; break; case OPTION_ENABLE_RELOC_SECTION: @@ -22,17 +17,17 @@ index fccbd63..f7c0a57 100644 break; case OPTION_EXCLUDE_LIBS: pep_dll_add_excludes (optarg, EXCLUDELIBS); -@@ -1862,7 +1862,7 @@ gld_${EMULATION_NAME}_finish (void) +@@ -1623,7 +1623,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)) + if (link_info.shared +- || (!link_info.relocatable && pe_dll_enable_reloc_section) ++ || (!link_info.relocatable && pep_dll_enable_reloc_section) + || (!link_info.relocatable && pep_def_file->num_exports != 0)) { + pep_dll_fill_sections (link_info.output_bfd, &link_info); diff --git a/ld/pep-dll.c b/ld/pep-dll.c -index b8c017f..5ad5733 100644 +index 0e5e8b1523..b5f99b90e0 100644 --- a/ld/pep-dll.c +++ b/ld/pep-dll.c @@ -31,6 +31,7 @@ @@ -44,7 +39,7 @@ index b8c017f..5ad5733 100644 #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 +index 1e7e3d65d4..c31e69cc8e 100644 --- a/ld/pep-dll.h +++ b/ld/pep-dll.h @@ -31,6 +31,7 @@ extern def_file * pep_def_file; @@ -56,5 +51,5 @@ index 0a27c1f..95d9c15 100644 extern int pep_dll_stdcall_aliases; extern int pep_dll_warn_dup_exports; -- -2.1.4 +2.14.1
diff --git a/projects/binutils/binutils-224-gold.patch b/projects/binutils/binutils-224-gold.patch new file mode 100644 index 0000000..a45e49c --- /dev/null +++ b/projects/binutils/binutils-224-gold.patch @@ -0,0 +1,98 @@ +From f984741df04cd68bb116073fdfa9405808810ab4 Mon Sep 17 00:00:00 2001 +From: Cary Coutant ccoutant@google.com +Date: Wed, 5 Feb 2014 22:59:02 -0800 +Subject: [PATCH] Fix issues with gold undefined symbol diagnostics. + +PR binutils/15435 complains that gold issues a visibility error for an +weak undefined symbol with hidden visibility. The message should be +suppressed if the symbol is a weak undef. + +An earlier patch to add an extra note about key functions when a class's +vtable symbol is undefined missed a case where the reference to the +vtable came from a shared library. This patch moves the check to a +lower-level routine that catches both cases. + +gold/ + +2014-02-05 Cary Coutant ccoutant@google.com + + * errors.cc (Errors::undefined_symbol): Move undef vtable symbol + check to here. + * target-reloc.h (is_strong_undefined): New function. + (relocate_section): Move undef vtable symbol check from here. + Check for is_strong_undefined. + +diff --git a/gold/ChangeLog b/gold/ChangeLog +index dcf7ed41f8..dd7ef72980 100644 +--- a/gold/ChangeLog ++++ b/gold/ChangeLog +@@ -1,3 +1,14 @@ ++2014-02-05 Cary Coutant ccoutant@google.com ++ ++ Fix issues with gold undefined symbol diagnostics. ++ ++ PR binutils/15435 ++ * errors.cc (Errors::undefined_symbol): Move undef vtable symbol ++ check to here. ++ * target-reloc.h (is_strong_undefined): New function. ++ (relocate_section): Move undef vtable symbol check from here. ++ Check for is_strong_undefined. ++ + 2013-11-22 Cary Coutant ccoutant@google.com + + * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree +diff --git a/gold/errors.cc b/gold/errors.cc +index b79764bd1d..98db0fdd86 100644 +--- a/gold/errors.cc ++++ b/gold/errors.cc +@@ -193,6 +193,11 @@ Errors::undefined_symbol(const Symbol* sym, const std::string& location) + fprintf(stderr, + _("%s: %s: undefined reference to '%s', version '%s'\n"), + location.c_str(), zmsg, sym->demangled_name().c_str(), version); ++ ++ if (sym->is_cxx_vtable()) ++ gold_info(_("%s: the vtable symbol may be undefined because " ++ "the class is missing its key function"), ++ program_name); + } + + // Issue a debugging message. +diff --git a/gold/target-reloc.h b/gold/target-reloc.h +index b544c78f37..d609bcbaa8 100644 +--- a/gold/target-reloc.h ++++ b/gold/target-reloc.h +@@ -144,6 +144,12 @@ class Default_comdat_behavior + } + }; + ++inline bool ++is_strong_undefined(const Symbol* sym) ++{ ++ return sym->is_undefined() && sym->binding() != elfcpp::STB_WEAK; ++} ++ + // Give an error for a symbol with non-default visibility which is not + // defined locally. + +@@ -411,16 +417,10 @@ relocate_section( + } + + if (issue_undefined_symbol_error(sym)) +- { +- gold_undefined_symbol_at_location(sym, relinfo, i, offset); +- if (sym->is_cxx_vtable()) +- gold_info(_("%s: the vtable symbol may be undefined because " +- "the class is missing its key function"), +- program_name); +- } ++ gold_undefined_symbol_at_location(sym, relinfo, i, offset); + else if (sym != NULL + && sym->visibility() != elfcpp::STV_DEFAULT +- && (sym->is_undefined() || sym->is_from_dynobj())) ++ && (is_strong_undefined(sym) || sym->is_from_dynobj())) + visibility_error(sym); + + if (sym != NULL && sym->has_warning()) +-- +2.11.0 + diff --git a/projects/binutils/build b/projects/binutils/build index 8a4ae3f..ee6db1a 100644 --- a/projects/binutils/build +++ b/projects/binutils/build @@ -21,12 +21,21 @@ cd [% project %]-[% c("version") %] [% IF c('var/windows') -%] # XXX: This is needed due to bug 10102. sed 's/= extern_rt_rel_d;/= extern_rt_rel_d;\n memset (extern_rt_rel_d, 0, PE_IDATA5_SIZE);/' -i ld/pe-dll.c + # Zeroing timestamps in PE headers reliably, see bug 12753. + patch -p1 < ../peXXigen.patch # Needed for the hardening... patch -p1 < ../enable-reloc-section-ld.patch + # fix "right-hand operand of comma expression has no effect" warning + patch -p1 < ../fix-warning-bfd.patch [% END -%] [% IF c('var/windows-x86_64') -%] patch -p1 < ../64bit-fixups.patch [% END -%] +[% IF c("var/linux") && ! c("var/release") -%] + # We need to work around a gold linker bug in 2.24 to get selfrando working, + # see bug 20683. + patch -p1 < $rootdir/binutils-224-gold.patch +[% END -%] ./configure --prefix=$distdir [% c('var/configure_opt') %] make -j[% c("buildconf/num_procs") %] make install diff --git a/projects/binutils/config b/projects/binutils/config index 7ac3799..5c35588 100644 --- a/projects/binutils/config +++ b/projects/binutils/config @@ -1,5 +1,5 @@ # vim: filetype=yaml sw=2 -version: 2.29.1 +version: 2.24 filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz' var: configure_opt: '--disable-multilib --enable-gold --enable-deterministic-archives --enable-plugins' @@ -19,5 +19,11 @@ input_files: - project: container-image - filename: enable-reloc-section-ld.patch enable: '[% c("var/windows") %]' + - filename: fix-warning-bfd.patch + enable: '[% c("var/windows") %]' - filename: 64bit-fixups.patch enable: '[% c("var/windows-x86_64") %]' + - filename: peXXigen.patch + enable: '[% c("var/windows") %]' + - filename: binutils-224-gold.patch + enable: '[% c("var/linux") %]' diff --git a/projects/binutils/enable-reloc-section-ld.patch b/projects/binutils/enable-reloc-section-ld.patch index a6600c3..f393f51 100644 --- a/projects/binutils/enable-reloc-section-ld.patch +++ b/projects/binutils/enable-reloc-section-ld.patch @@ -1,29 +1,30 @@ -From fba503a78c50d6134943245d55e820f53e8f19cd Mon Sep 17 00:00:00 2001 +From 093b08a9e7af23a258306b710ebc4556d12f94f7 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/emultempl/pe.em | 6 +++++ + ld/emultempl/pep.em | 8 ++++++- ld/pe-dll.c | 63 ++++++++++++++++++++++++++++++----------------------- ld/pe-dll.h | 1 + - 4 files changed, 53 insertions(+), 29 deletions(-) + 4 files changed, 50 insertions(+), 28 deletions(-)
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em -index 339b7c5..3958b81 100644 +index 5d6da9e..14c07f7 100644 --- a/ld/emultempl/pe.em +++ b/ld/emultempl/pe.em -@@ -272,6 +272,7 @@ fragment <<EOF +@@ -268,6 +268,7 @@ fragment <<EOF + #define OPTION_TERMINAL_SERVER_AWARE (OPTION_WDM_DRIVER + 1) + /* Determinism. */ #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) ++#define OPTION_ENABLE_RELOC_SECTION (OPTION_INSERT_TIMESTAMP + 1)
static void gld${EMULATION_NAME}_add_options -@@ -315,6 +316,7 @@ gld${EMULATION_NAME}_add_options +@@ -310,6 +311,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}, @@ -31,7 +32,7 @@ index 339b7c5..3958b81 100644 {"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) +@@ -773,6 +775,9 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_EXCLUDE_ALL_SYMBOLS: pe_dll_exclude_all_symbols = 1; break; @@ -41,30 +42,29 @@ index 339b7c5..3958b81 100644 case OPTION_EXCLUDE_LIBS: pe_dll_add_excludes (optarg, EXCLUDELIBS); break; -@@ -2076,6 +2081,8 @@ gld_${EMULATION_NAME}_finish (void) +@@ -1839,6 +1844,7 @@ gld_${EMULATION_NAME}_finish (void) + if (link_info.shared #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) + || (!link_info.relocatable && pe_def_file->num_exports != 0) ++ || (!link_info.relocatable && pe_dll_enable_reloc_section) #endif ) { diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em -index c253d2f..fccbd63 100644 +index b738800..b566903 100644 --- a/ld/emultempl/pep.em +++ b/ld/emultempl/pep.em -@@ -246,7 +246,8 @@ enum options +@@ -242,7 +242,8 @@ enum options + OPTION_NO_BIND, + OPTION_WDM_DRIVER, OPTION_INSERT_TIMESTAMP, - OPTION_NO_INSERT_TIMESTAMP, - OPTION_TERMINAL_SERVER_AWARE, -- OPTION_BUILD_ID -+ OPTION_BUILD_ID, +- OPTION_TERMINAL_SERVER_AWARE ++ OPTION_TERMINAL_SERVER_AWARE, + OPTION_ENABLE_RELOC_SECTION };
static void -@@ -288,6 +289,7 @@ gld${EMULATION_NAME}_add_options +@@ -284,6 +285,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}, @@ -72,7 +72,7 @@ index c253d2f..fccbd63 100644 {"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) +@@ -727,6 +729,9 @@ gld${EMULATION_NAME}_handle_option (int optc) case OPTION_EXCLUDE_ALL_SYMBOLS: pep_dll_exclude_all_symbols = 1; break; @@ -82,22 +82,19 @@ index c253d2f..fccbd63 100644 case OPTION_EXCLUDE_LIBS: pep_dll_add_excludes (optarg, EXCLUDELIBS); break; -@@ -1857,7 +1862,9 @@ gld_${EMULATION_NAME}_finish (void) +@@ -1618,6 +1623,7 @@ 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)) + if (link_info.shared ++ || (!link_info.relocatable && pe_dll_enable_reloc_section) + || (!link_info.relocatable && 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 +index e9e133b..4230dc3 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c -@@ -151,6 +151,7 @@ def_file * pe_def_file = 0; +@@ -152,6 +152,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; @@ -105,10 +102,10 @@ index c398f23..3797f1a 100644 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) +@@ -3370,8 +3371,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)) + if (pe_def_file->num_exports == 0 && !info->shared) - return; - + { @@ -123,7 +120,7 @@ index c398f23..3797f1a 100644 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) +@@ -3386,13 +3394,9 @@ pe_exe_build_sections (bfd *abfd, struct bfd_link_info *info ATTRIBUTE_UNUSED) pe_output_file_set_long_section_names (filler_bfd); }
@@ -139,13 +136,13 @@ index c398f23..3797f1a 100644 generate_reloc (abfd, info); if (reloc_sz > 0) { -@@ -3469,38 +3473,43 @@ pe_dll_fill_sections (bfd *abfd, struct bfd_link_info *info) +@@ -3409,38 +3413,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)) +- if (info->shared && !info->pie) - pe_data (abfd)->dll = 1; - - edata_s->contents = edata_d; @@ -177,7 +174,7 @@ index c398f23..3797f1a 100644 - /* Resize the sections. */ - lang_reset_memory_regions (); - lang_size_sections (NULL, TRUE); -+ if (bfd_link_pic (info) && !bfd_link_pie (info)) ++ if (info->shared && !info->pie) + pe_data (abfd)->dll = 1;
- /* Redo special stuff. */ @@ -203,10 +200,10 @@ index c398f23..3797f1a 100644
bfd_boolean diff --git a/ld/pe-dll.h b/ld/pe-dll.h -index 48d169b..05ff72b 100644 +index 4697390..2bf71d9 100644 --- a/ld/pe-dll.h +++ b/ld/pe-dll.h -@@ -30,6 +30,7 @@ extern def_file *pe_def_file; +@@ -31,6 +31,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; @@ -215,5 +212,5 @@ index 48d169b..05ff72b 100644 extern int pe_dll_stdcall_aliases; extern int pe_dll_warn_dup_exports; -- -2.1.4 +2.0.1
diff --git a/projects/binutils/fix-warning-bfd.patch b/projects/binutils/fix-warning-bfd.patch new file mode 100644 index 0000000..fa04405 --- /dev/null +++ b/projects/binutils/fix-warning-bfd.patch @@ -0,0 +1,186 @@ +From 27b829ee701e29804216b3803fbaeb629be27491 Mon Sep 17 00:00:00 2001 +From: Nick Clifton nickc@redhat.com +Date: Wed, 29 Jan 2014 13:46:39 +0000 +Subject: [PATCH] Following up on Tom's suggestion I am checking in a patch to + replace the various bfd_xxx_set macros with static inline functions, so that + we can avoid compile time warnings about comma expressions with unused + values. + + * bfd-in.h (bfd_set_section_vma): Delete. + (bfd_set_section_alignment): Delete. + (bfd_set_section_userdata): Delete. + (bfd_set_cacheable): Delete. + * bfd.c (bfd_set_cacheable): New static inline function. + * section.c (bfd_set_section_userdata): Likewise. + (bfd_set_section_vma): Likewise. + (bfd_set_section_alignment): Likewise. + * bfd-in2.h: Regenerate. +--- + bfd/bfd-in.h | 5 ----- + bfd/bfd-in2.h | 41 +++++++++++++++++++++++++++++++++++------ + bfd/bfd.c | 8 ++++++++ + bfd/section.c | 26 ++++++++++++++++++++++++++ + 5 files changed, 81 insertions(+), 11 deletions(-) + +diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h +index 3afd71b..c7c5a7d 100644 +--- a/bfd/bfd-in.h ++++ b/bfd/bfd-in.h +@@ -292,9 +292,6 @@ typedef struct bfd_section *sec_ptr; + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + +-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) +-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) +-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +@@ -517,8 +514,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *); + + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) + +-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) +- + extern bfd_boolean bfd_cache_close + (bfd *abfd); + /* NB: This declaration should match the autogenerated one in libbfd.h. */ +diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h +index 71996db..b5aeb40 100644 +--- a/bfd/bfd-in2.h ++++ b/bfd/bfd-in2.h +@@ -299,9 +299,6 @@ typedef struct bfd_section *sec_ptr; + + #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0) + +-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE) +-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE) +-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE) + /* Find the address one past the end of SEC. */ + #define bfd_get_section_limit(bfd, sec) \ + (((bfd)->direction != write_direction && (sec)->rawsize != 0 \ +@@ -524,8 +521,6 @@ extern void warn_deprecated (const char *, const char *, int, const char *); + + #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char) + +-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE) +- + extern bfd_boolean bfd_cache_close + (bfd *abfd); + /* NB: This declaration should match the autogenerated one in libbfd.h. */ +@@ -1029,7 +1024,7 @@ bfd *bfd_openr (const char *filename, const char *target); + + bfd *bfd_fdopenr (const char *filename, const char *target, int fd); + +-bfd *bfd_openstreamr (const char *, const char *, void *); ++bfd *bfd_openstreamr (const char * filename, const char * target, void * stream); + + bfd *bfd_openr_iovec (const char *filename, const char *target, + void *(*open_func) (struct bfd *nbfd, +@@ -1596,6 +1591,32 @@ struct relax_table { + int size; + }; + ++/* Note: the following are provided as inline functions rather than macros ++ because not all callers use the return value. A macro implementation ++ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some ++ compilers will complain about comma expressions that have no effect. */ ++static inline bfd_boolean ++bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) ++{ ++ ptr->userdata = val; ++ return TRUE; ++} ++ ++static inline bfd_boolean ++bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) ++{ ++ ptr->vma = ptr->lma = val; ++ ptr->user_set_vma = TRUE; ++ return TRUE; ++} ++ ++static inline bfd_boolean ++bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) ++{ ++ ptr->alignment_power = val; ++ return TRUE; ++} ++ + /* These sections are global, and are managed by BFD. The application + and target back end are not permitted to change the values in + these sections. */ +@@ -6415,6 +6436,14 @@ struct bfd + unsigned int selective_search : 1; + }; + ++/* See note beside bfd_set_section_userdata. */ ++static inline bfd_boolean ++bfd_set_cacheable (bfd * abfd, bfd_boolean val) ++{ ++ abfd->cacheable = val; ++ return TRUE; ++} ++ + typedef enum bfd_error + { + bfd_error_no_error = 0, +diff --git a/bfd/bfd.c b/bfd/bfd.c +index 8d0580c..2d174f3 100644 +--- a/bfd/bfd.c ++++ b/bfd/bfd.c +@@ -311,6 +311,14 @@ CODE_FRAGMENT + . unsigned int selective_search : 1; + .}; + . ++.{* See note beside bfd_set_section_userdata. *} ++.static inline bfd_boolean ++.bfd_set_cacheable (bfd * abfd, bfd_boolean val) ++.{ ++. abfd->cacheable = val; ++. return TRUE; ++.} ++. + */ + + #include "sysdep.h" +diff --git a/bfd/section.c b/bfd/section.c +index fb19d8c..a661228 100644 +--- a/bfd/section.c ++++ b/bfd/section.c +@@ -542,6 +542,32 @@ CODE_FRAGMENT + . int size; + .}; + . ++.{* Note: the following are provided as inline functions rather than macros ++. because not all callers use the return value. A macro implementation ++. would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some ++. compilers will complain about comma expressions that have no effect. *} ++.static inline bfd_boolean ++.bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val) ++.{ ++. ptr->userdata = val; ++. return TRUE; ++.} ++. ++.static inline bfd_boolean ++.bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val) ++.{ ++. ptr->vma = ptr->lma = val; ++. ptr->user_set_vma = TRUE; ++. return TRUE; ++.} ++. ++.static inline bfd_boolean ++.bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val) ++.{ ++. ptr->alignment_power = val; ++. return TRUE; ++.} ++. + .{* These sections are global, and are managed by BFD. The application + . and target back end are not permitted to change the values in + . these sections. *} +-- +2.1.4 + diff --git a/projects/binutils/peXXigen.patch b/projects/binutils/peXXigen.patch new file mode 100644 index 0000000..785aa02 --- /dev/null +++ b/projects/binutils/peXXigen.patch @@ -0,0 +1,14 @@ +diff -crB binutils-2.24/bfd/peXXigen.c binutils-2.24/bfd/peXXigen.c +*** binutils-2.24/bfd/peXXigen.c Tue Nov 26 11:37:33 2013 +--- binutils-2.24/bfd/peXXigen.c Mon Aug 4 07:10:15 2014 +*************** +*** 795,800 **** +--- 795,802 ---- + /* Only use a real timestamp if the option was chosen. */ + if ((pe_data (abfd)->insert_timestamp)) + H_PUT_32 (abfd, time(0), filehdr_out->f_timdat); ++ else ++ H_PUT_32 (abfd, 0, filehdr_out->f_timdat); + + PUT_FILEHDR_SYMPTR (abfd, filehdr_in->f_symptr, + filehdr_out->f_symptr); diff --git a/projects/mingw-w64/build b/projects/mingw-w64/build index 8acd41d..8d3e567 100644 --- a/projects/mingw-w64/build +++ b/projects/mingw-w64/build @@ -29,7 +29,7 @@ sed 's/msvcrt/msvcr100/' -i $distdir/msvcr100.spec sed 's/msvcrt/msvcr100/' -i gcc-[% c("var/gcc_version") %]/gcc/config/i386/t-mingw-w32 # LDFLAGS_FOR_TARGET does not work for some reason. Thus, we take # CFLAGS_FOR_TARGET. -export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase -Wl,--no-insert-timestamp" +export CFLAGS_FOR_TARGET="-specs=$distdir/msvcr100.spec -Wl,--nxcompat -Wl,--dynamicbase" gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-languages=c,c++ make -j[% c("buildconf/num_procs") %] all-gcc make install-gcc @@ -59,17 +59,17 @@ mkdir -p $distdir/helpers
cat > $distdir/helpers/[% c("arch") %]-w64-mingw32-g++ << 'EOF' #!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-g++ -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@" +/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-g++ -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@" EOF
cat > $distdir/helpers/[% c("arch") %]-w64-mingw32-gcc << 'EOF' #!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-gcc -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@" +/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-gcc -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@" EOF
cat > $distdir/helpers/[% c("arch") %]-w64-mingw32-ld << 'EOF' #!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-ld --dynamicbase --nxcompat --enable-reloc-section --no-insert-timestamp -lssp -L$gcclibs "$@" +/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-ld --dynamicbase --nxcompat --enable-reloc-section -lssp -L$gcclibs "$@" EOF
chmod +x $distdir/helpers/* diff --git a/projects/nsis/build b/projects/nsis/build index 7a66884..af19dd7 100755 --- a/projects/nsis/build +++ b/projects/nsis/build @@ -1,35 +1,8 @@ #!/bin/bash [% c("var/set_default_env") -%] [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %] -# Some of the hardening flags are causing the build to fail, so we -# overwrite the helpers with only the flags required to make the build -# reproducible. -helpersdir=/var/tmp/dist/mingw-w64/helpers -cat > $helpersdir/[% c("arch") %]-w64-mingw32-g++ << 'EOF' -#!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-g++ -Wl,--no-insert-timestamp "$@" -EOF - -cat > $helpersdir/[% c("arch") %]-w64-mingw32-gcc << 'EOF' -#!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-gcc -Wl,--no-insert-timestamp "$@" -EOF - -cat > $helpersdir/[% c("arch") %]-w64-mingw32-ld << 'EOF' -#!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-ld --no-insert-timestamp "$@" -EOF -# the nsis build system expects all toolchain binaries to be in the same -# directory, so we create wrappers for the other commands in the same -# directory. -for util in ar ranlib windres -do - cat > $helpersdir/[% c("arch") %]-w64-mingw32-$util <<EOF -#!/bin/sh -/var/tmp/dist/mingw-w64/bin/[% c("arch") %]-w64-mingw32-$util "$@" -EOF - chmod +x $helpersdir/[% c("arch") %]-w64-mingw32-$util -done +# remove hardening wrappers +rm -Rf /var/tmp/dist/mingw-w64/helpers mkdir -p /var/tmp/dist mkdir -p /var/tmp/build tar -C /var/tmp/build -xf nsis-[% c('version') %].tar.bz2 diff --git a/projects/openssl/config b/projects/openssl/config index fc8e1ff..378ee53 100644 --- a/projects/openssl/config +++ b/projects/openssl/config @@ -15,7 +15,7 @@ targets: configure_opts: -shared linux-generic32 windows: var: - configure_opts: '-shared --cross-compile-prefix=[% c("arch") %]-w64-mingw32- mingw[% IF c("var/windows-x86_64") %]64[% END %] "-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs"' + configure_opts: '-shared --cross-compile-prefix=[% c("arch") %]-w64-mingw32- mingw[% IF c("var/windows-x86_64") %]64[% END %] "-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs"' osx-x86_64: var: configure_opts: --cross-compile-prefix=x86_64-apple-darwin10- darwin64-x86_64-cc enable-ec_nistp_64_gcc_128 diff --git a/projects/selfrando/config b/projects/selfrando/config index 07195f7..f8afa5d 100644 --- a/projects/selfrando/config +++ b/projects/selfrando/config @@ -1,6 +1,6 @@ # vim: filetype=yaml sw=2 filename: '[% project %]-[% c("version") %]-[% c("var/osname") %]-[% c("var/build_id") %].tar.gz' -version: 0.4.1 +version: 0.3.3 git_hash: 'tb-v[% c("version") %]' git_url: https://github.com/immunant/selfrando.git gpg_keyring: selfrando.gpg diff --git a/projects/zlib/build b/projects/zlib/build index ef26882..4cb384b 100644 --- a/projects/zlib/build +++ b/projects/zlib/build @@ -7,8 +7,8 @@ tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz cd /var/tmp/build/[% project %]-[% c('version') %] export CFLAGS="[% c("var/CFLAGS") %]" export LDFLAGS="[% c("var/LDFLAGS") %]" -make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- -j4 SHARED_MODE=1 LOC="-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs" -make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- -j4 SHARED_MODE=1 LOC="-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs" install +make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- -j4 SHARED_MODE=1 LOC="-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs" +make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- -j4 SHARED_MODE=1 LOC="-fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs" install
cd /var/tmp/dist [% c('tar', { diff --git a/rbm.conf b/rbm.conf index b2ba2ab..13005b7 100644 --- a/rbm.conf +++ b/rbm.conf @@ -218,7 +218,7 @@ targets: suite: jessie configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"' CFLAGS: '[% c("var/flag_mwindows") %] -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security' - LDFLAGS: '[% c("var/flag_mwindows") %] -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs' + LDFLAGS: '[% c("var/flag_mwindows") %] -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs' flag_mwindows: '-mwindows' compiler: mingw-w64 deps: