Commit b82d82d9 authored by boklm's avatar boklm Committed by Georg Koppen
Browse files

Bug 23228: add support for building mingw-w64 for Windows 64

Add torbrowser-windows-x86_64 support to rbm.conf.

Update mingw-w64 to use the x86_64-w64-mingw32 target (instead of
i686-w64-mingw32) for torbrowser-windows-x86_64 builds.
parent 897d6d1a
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
diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em
index b566903b14..27006bdf79 100644
--- a/ld/emultempl/pep.em
+++ b/ld/emultempl/pep.em
@@ -730,7 +730,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);
@@ -1623,7 +1623,7 @@ gld_${EMULATION_NAME}_finish (void)
#ifdef DLL_SUPPORT
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 0e5e8b1523..b5f99b90e0 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 1e7e3d65d4..c31e69cc8e 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.14.1
......@@ -21,10 +21,13 @@ 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
# Needed for the hardening...
patch -p1 < ../enable-reloc-section-ld.patch
# Zeroing timestamps in PE headers reliably, see bug 12753.
patch -p1 < ../peXXigen.patch
# Needed for the hardening...
patch -p1 < ../enable-reloc-section-ld.patch
[% END -%]
[% IF c('var/windows-x86_64') -%]
patch -p1 < ../64bit-fixups.patch
[% END -%]
[% IF c("var/linux") -%]
# We need to work around a gold linker bug in 2.24 to get selfrando working,
......
......@@ -7,9 +7,9 @@ var:
use_container: 1
targets:
windows-i686:
windows:
var:
configure_opt: '--target=i686-w64-mingw32 --disable-multilib --enable-deterministic-archives'
configure_opt: '--target=[% c("arch") %]-w64-mingw32 --disable-multilib --enable-deterministic-archives'
input_files:
- URL: https://ftp.gnu.org/gnu/binutils/binutils-[% c("version") %].tar.bz2
......@@ -19,6 +19,8 @@ input_files:
- project: container-image
- filename: enable-reloc-section-ld.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
......
......@@ -14,7 +14,7 @@ tar xf $rootdir/[% project %]-[% c("version") %].tar.gz
mkdir -p builddir/mingw-w64/mingw-w64-headers32
cd builddir/mingw-w64/mingw-w64-headers32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-headers/configure \
--prefix=$distdir/i686-w64-mingw32 --host=i686-w64-mingw32 \
--prefix=$distdir/[% c("arch") %]-w64-mingw32 --host=[% c("arch") %]-w64-mingw32 \
--enable-sdk=all --enable-secure-api --enable-idl
make install
......@@ -23,28 +23,28 @@ mkdir gcc
cd gcc
tar xjf $rootdir/gcc-[% c("var/gcc_version") %].tar.bz2
# We don't want to link against msvcrt.dll due to bug 9084.
i686-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
[% c("arch") %]-w64-mingw32-g++ -dumpspecs > $distdir/msvcr100.spec
sed 's/msvcrt/msvcr100/' -i $distdir/msvcr100.spec
# Linking libgcc against msvcrt is hard-coded...
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"
gcc-[% c("var/gcc_version") %]/configure --prefix=$distdir --target=i686-w64-mingw32 --disable-multilib --enable-languages=c,c++
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
mkdir -p /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
cd /var/tmp/build/builddir/mingw-w64/mingw-w64-crt32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-crt/configure \
--host=i686-w64-mingw32 --prefix=$distdir/i686-w64-mingw32
--host=[% c("arch") %]-w64-mingw32 --prefix=$distdir/[% c("arch") %]-w64-mingw32
make -j[% c("buildconf/num_procs") %]
make install
mkdir -p /var/tmp/build/builddir/mingw-w64/widl32
cd /var/tmp/build/builddir/mingw-w64/widl32
/var/tmp/build/[% project %]-[% c("version") %]/mingw-w64-tools/widl/configure \
--prefix=$distdir --target=i686-w64-mingw32
--prefix=$distdir --target=[% c("arch") %]-w64-mingw32
make -j[% c("buildconf/num_procs") %]
make install
......@@ -52,12 +52,26 @@ cd /var/tmp/build/gcc
make -j[% c("buildconf/num_procs") %]
make install
mkdir -p $distdir/gcclibs
cp i686-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
cp i686-w64-mingw32/libgcc/shlib/libgcc_s_sjlj-1.dll $distdir/gcclibs
cp [% c("arch") %]-w64-mingw32/libssp/.libs/libssp-0.dll $distdir/gcclibs
cp [% c("arch") %]-w64-mingw32/libgcc/shlib/[% c("var/libgcc_dll") %] $distdir/gcclibs
mkdir -p $distdir/helpers
mv $rootdir/i686-w64-mingw32-g++ $rootdir/i686-w64-mingw32-gcc \
$rootdir/i686-w64-mingw32-ld $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 -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 -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 -lssp -L$gcclibs "$@"
EOF
chmod +x $distdir/helpers/*
cd /var/tmp/dist
......
......@@ -11,19 +11,26 @@ var:
- automake
- build-essential
- libmpc-dev
- g++-mingw-w64-i686
setup: |
[% c("var/setarch") -%]
mkdir -p /var/tmp/dist
tar -C /var/tmp/dist -xf [% c("compiler_tarfile") %]
export PATH="/var/tmp/dist/mingw-w64/helpers:/var/tmp/dist/mingw-w64/bin:$PATH"
export gcclibs=/var/tmp/dist/mingw-w64/gcclibs
targets:
windows-i686:
var:
libgcc_dll: libgcc_s_sjlj-1.dll
arch_deps:
- g++-mingw-w64-i686
windows-x86_64:
var:
libgcc_dll: libgcc_s_seh-1.dll
arch_deps:
- g++-mingw-w64-x86-64
input_files:
- project: container-image
- URL: 'https://ftp.gnu.org/gnu/gcc/gcc-[% c("var/gcc_version") %]/gcc-[% c("var/gcc_version") %].tar.bz2'
sha256sum: 608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a
- name: binutils
project: binutils
- filename: i686-w64-mingw32-g++
- filename: i686-w64-mingw32-gcc
- filename: i686-w64-mingw32-ld
#!/bin/sh
# Hardened mingw gcc wrapper
/var/tmp/dist/mingw-w64/bin/i686-w64-mingw32-g++ -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@"
#!/bin/sh
# Hardened mingw gcc wrapper
/var/tmp/dist/mingw-w64/bin/i686-w64-mingw32-gcc -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -fstack-protector --param ssp-buffer-size=4 -fno-strict-overflow "$@"
#!/bin/sh
# Hardened mingw gcc wrapper
/var/tmp/dist/mingw-w64/bin/i686-w64-mingw32-ld --dynamicbase --nxcompat --enable-reloc-section -lssp -L$gcclibs "$@"
......@@ -171,15 +171,36 @@ targets:
torbrowser-windows-i686:
- windows-i686
- windows
torbrowser-windows-x86_64:
- windows-x86_64
- windows
windows-x86_64:
arch: x86_64
var:
windows-x86_64: 1
osname: windows-x86_64
container:
arch: amd64
windows-i686:
arch: i686
var:
windows: 1
windows-i686: 1
osname: windows-i686
container:
suite: precise
arch: i386
configure_opt: '--host=i686-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
setarch: |
if test -z "$RBM_SETARCH"
then
export RBM_SETARCH=1
exec setarch i686 ./build
fi
windows:
var:
windows: 1
container:
suite: precise
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 -lssp -L$gcclibs'
flag_mwindows: '-mwindows'
......@@ -193,12 +214,6 @@ targets:
- zip
- unzip
faketime_path: /usr/lib/faketime/libfaketime.so.1
setarch: |
if test -z "$RBM_SETARCH"
then
export RBM_SETARCH=1
exec setarch i686 ./build
fi
fteproxy: 1
install_wine_ppa: |
# Install a Wine new enough to have a fix for
......
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