This is an automated email from the git hooks/post-receive script.
pierov pushed a commit to branch main in repository builders/tor-browser-build.
commit 0fa09e9c671690c9c8454aaceb401744e47456e9 Author: Pier Angelo Vendrame pierov@torproject.org AuthorDate: Wed Aug 10 18:40:14 2022 +0200
Bug 29318: Use Clang for everything on Windows --- projects/firefox/build | 3 --- projects/firefox/config | 1 - projects/fxc2/config | 3 --- projects/go/build | 2 +- projects/libevent/build | 3 +++ projects/libevent/config | 3 +++ projects/mingw-w64-clang/build | 38 ++++++++++++++++++++++++++++++++ projects/mingw-w64-clang/config | 1 + projects/mingw-w64-clang/libssp-Makefile | 25 +++++++++++++++++++++ projects/nsis/config | 6 +++++ projects/zlib/build | 4 ++-- rbm.conf | 8 +++---- 12 files changed, 82 insertions(+), 15 deletions(-)
diff --git a/projects/firefox/build b/projects/firefox/build index a6d42b3..5eea651 100644 --- a/projects/firefox/build +++ b/projects/firefox/build @@ -9,9 +9,6 @@ mkdir -p [% dest_dir _ '/' _ c('filename') %] # Setting up fxc2 tar -C /var/tmp/dist -xf [% c('input_files_by_name/fxc2') %] export PATH="/var/tmp/dist/fxc2/bin:$PATH" - # Setting up stack protector support - tar -C /var/tmp/dist -xf [% c('input_files_by_name/mingw-w64') %] - cp /var/tmp/dist/mingw-w64/gcclibs/{libssp.a,libssp_nonshared.a} /var/tmp/dist/mingw-w64-clang/[% c("arch") %]-w64-mingw32/lib/ [% END -%]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %] diff --git a/projects/firefox/config b/projects/firefox/config index f62523a..a1135c9 100644 --- a/projects/firefox/config +++ b/projects/firefox/config @@ -122,7 +122,6 @@ targets: - python3 - python3-distutils - wine - compiler: mingw-w64-clang
windows-i686: var: diff --git a/projects/fxc2/config b/projects/fxc2/config index 735497b..d73911f 100644 --- a/projects/fxc2/config +++ b/projects/fxc2/config @@ -6,9 +6,6 @@ filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz' container: use_container: 1
-var: - compiler: mingw-w64-clang - input_files: - project: container-image - name: '[% c("var/compiler") %]' diff --git a/projects/go/build b/projects/go/build index 9da7cf2..5371f50 100644 --- a/projects/go/build +++ b/projects/go/build @@ -58,7 +58,7 @@ cd /var/tmp/dist/go/src # https://github.com/golang/go/issues/15457 CC_FOR_TARGET="$(pwd)/cc-for-target" echo "#!/bin/sh" > "$CC_FOR_TARGET" - echo "exec [% c("arch") %]-w64-mingw32-gcc [% c("var/CFLAGS") %] [% c("var/LDFLAGS") %] "$@"" >> "$CC_FOR_TARGET" + echo "exec [% c("arch") %]-w64-mingw32-cc [% c("var/CFLAGS") %] [% c("var/LDFLAGS") %] "$@"" >> "$CC_FOR_TARGET" chmod +x "$CC_FOR_TARGET" CGO_ENABLED=1 CC_FOR_TARGET="$CC_FOR_TARGET" CC= CFLAGS= LDFLAGS= ./make.bash [% ELSIF c("var/android") -%] diff --git a/projects/libevent/build b/projects/libevent/build index 4708f9d..ea8cd38 100644 --- a/projects/libevent/build +++ b/projects/libevent/build @@ -5,6 +5,9 @@ distdir=/var/tmp/dist/[% project %] mkdir -p /var/tmp/build tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz cd /var/tmp/build/[% project %]-[% c('version') %] +[% IF c("var/windows") -%] + export CC=[% c("arch") %]-w64-mingw32-cc +[% END -%] ./autogen.sh ./configure [% c("var/configure_opt") %] --disable-libevent-regress --disable-samples --disable-openssl --prefix=$distdir [% IF c("var/osx") -%] diff --git a/projects/libevent/config b/projects/libevent/config index 9afb920..1dcdc79 100644 --- a/projects/libevent/config +++ b/projects/libevent/config @@ -16,6 +16,9 @@ targets: var: arch_deps: - faketime + windows: + var: + configure_opt_project: --disable-shared android: var: configure_opt_project: --disable-shared diff --git a/projects/mingw-w64-clang/build b/projects/mingw-w64-clang/build index 4d6e783..92a47cf 100644 --- a/projects/mingw-w64-clang/build +++ b/projects/mingw-w64-clang/build @@ -31,8 +31,12 @@ DIR="$(cd "$(dirname "$0")" && pwd)" EOF chmod +x [% c("arch") %]-w64-mingw32-clang++
+ln -s [% c("arch") %]-w64-mingw32-clang [% c("arch") %]-w64-mingw32-cc +ln -s [% c("arch") %]-w64-mingw32-clang++ [% c("arch") %]-w64-mingw32-cxx +ln -s llvm-ar [% c("arch") %]-w64-mingw32-ar ln -s llvm-nm [% c("arch") %]-w64-mingw32-nm ln -s llvm-strip [% c("arch") %]-w64-mingw32-strip +ln -s llvm-ranlib [% c("arch") %]-w64-mingw32-ranlib ln -s llvm-readobj [% c("arch") %]-w64-mingw32-readobj ln -s llvm-objcopy [% c("arch") %]-w64-mingw32-objcopy ln -s llvm-windres [% c("arch") %]-w64-mingw32-windres @@ -177,6 +181,40 @@ EOF
merge_libs $distdir/[% c("arch") %]-w64-mingw32/lib/libc++.a $distdir/[% c("arch") %]-w64-mingw32/lib/libunwind.a
+# libssp +# See build-libssp.sh in llvm-mingw +cd $rootdir +tar -xf [% c('input_files_by_name/gcc') %] +cd gcc-*/libssp +cp $rootdir/libssp-Makefile Makefile + +# gcc/libssp's configure script runs checks for flags that clang doesn't +# implement. We actually just need to set a few HAVE defines and compile +# the .c sources. +cp config.h.in config.h +for i in HAVE_FCNTL_H HAVE_INTTYPES_H HAVE_LIMITS_H HAVE_MALLOC_H \ + HAVE_MEMMOVE HAVE_MEMORY_H HAVE_MEMPCPY HAVE_STDINT_H HAVE_STDIO_H \ + HAVE_STDLIB_H HAVE_STRINGS_H HAVE_STRING_H HAVE_STRNCAT HAVE_STRNCPY \ + HAVE_SYS_STAT_H HAVE_SYS_TYPES_H HAVE_UNISTD_H HAVE_USABLE_VSNPRINTF \ + HAVE_HIDDEN_VISIBILITY; do + cat config.h | sed 's/^#undef '$i'$/#define '$i' 1/' > tmp + mv tmp config.h +done +cat ssp/ssp.h.in | sed 's/@ssp_have_usable_vsnprintf@/define/' > ssp/ssp.h + +arch='[% c("arch") %]' +mkdir -p build-$arch +cd build-$arch +make -f ../Makefile -j[% c("num_procs") %] CROSS=$arch-w64-mingw32- +mkdir -p "$distdir/$arch-w64-mingw32/bin" +cp libssp.a "$distdir/$arch-w64-mingw32/lib" +cp libssp_nonshared.a "$distdir/$arch-w64-mingw32/lib" +# We are interested only in static libraries, but if needed the dynamic ones +# can be used, too, just by uncommenting the following two lines. +# cp libssp.dll.a "$distdir/$arch-w64-mingw32/lib" +# cp libssp-0.dll "$distdir/$arch-w64-mingw32/bin" +cd .. + # Packaging up everything cd $distdir cd .. diff --git a/projects/mingw-w64-clang/config b/projects/mingw-w64-clang/config index be8dcf3..9c052eb 100644 --- a/projects/mingw-w64-clang/config +++ b/projects/mingw-w64-clang/config @@ -27,3 +27,4 @@ input_files: - filename: mingw-unknown.patch - filename: mingw-uiautomationcoreapi.patch - filename: mingw-windows_foundation.patch + - filename: libssp-Makefile diff --git a/projects/mingw-w64-clang/libssp-Makefile b/projects/mingw-w64-clang/libssp-Makefile new file mode 100644 index 0000000..867ce0d --- /dev/null +++ b/projects/mingw-w64-clang/libssp-Makefile @@ -0,0 +1,25 @@ +# Taken from llvm-mingw +SRC_PATH=$(word 1, $(dir $(MAKEFILE_LIST))) +vpath %.c $(SRC_PATH) + +CC = $(CROSS)clang +AR = llvm-ar + +CFLAGS = -O2 -Wall -Wundef -I$(SRC_PATH) -D_FORTIFY_SOURCE=0 -D__SSP_FORTIFY_LEVEL=0 + +SOURCES = $(filter-out ssp-local.c, $(patsubst $(SRC_PATH)%,%,$(wildcard $(SRC_PATH)*.c))) +OBJS = $(SOURCES:%.c=%.o) + +all: libssp.a libssp_nonshared.a libssp-0.dll + +libssp.a: $(OBJS) + $(AR) rcs $@ $+ + +libssp-0.dll: $(OBJS) + $(CC) -shared -o $@ $+ -Wl,--out-implib,libssp.dll.a + +libssp_nonshared.a: ssp-local.o + $(AR) rcs $@ $+ + +clean: + rm -f *.a *.o *.dll diff --git a/projects/nsis/config b/projects/nsis/config index a7d9d13..d6640c0 100644 --- a/projects/nsis/config +++ b/projects/nsis/config @@ -11,6 +11,12 @@ var: - zlib1g-dev - libcppunit-dev - xsltproc + # NSIS has an assembly part that cannot be compiled with Clang. + # Mozilla uses -fno-integrated-as (see + # taskcluster/scripts/misc/build-mingw32-nsis.sh) but for some reason this + # does not seem to work for us, so just keep GCC for the moment, since we are + # already using it for Rust anyway. + compiler: mingw-w64
input_files: - project: container-image diff --git a/projects/zlib/build b/projects/zlib/build index 55381dd..2a122a5 100644 --- a/projects/zlib/build +++ b/projects/zlib/build @@ -10,8 +10,8 @@ cd /var/tmp/build/[% project %]-[% c('version') %] patch -p1 < $rootdir/0001-Fix-configure-issue-that-discarded-provided-CC-defin.patch
[% IF c("var/windows") -%] - make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- -j[% c("num_procs") %] SHARED_MODE=1 LOC="[% c("var/CFLAGS") %] [% 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- -j[% c("num_procs") %] SHARED_MODE=1 LOC="[% c("var/CFLAGS") %] [% c("var/LDFLAGS") %]" install + make BINARY_PATH=$distdir/lib INCLUDE_PATH=$distdir/include LIBRARY_PATH=$distdir/lib -f win32/Makefile.gcc PREFIX=[% c("arch") %]-w64-mingw32- CC=[% c("arch") %]-w64-mingw32-cc -j[% c("num_procs") %] SHARED_MODE=1 LOC="[% c("var/CFLAGS") %] [% 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- CC=[% c("arch") %]-w64-mingw32-cc -j[% c("num_procs") %] SHARED_MODE=1 LOC="[% c("var/CFLAGS") %] [% c("var/LDFLAGS") %]" install [% END -%]
[% IF c("var/android") -%] diff --git a/rbm.conf b/rbm.conf index dc155fa..f4224f6 100644 --- a/rbm.conf +++ b/rbm.conf @@ -483,8 +483,6 @@ targets: windows-x86_64: 1 windows-i686: 0 osname: windows-x86_64 - # HEASLR is 64 bit only (see bug 12968) - flag_HEASLR: '-Wl,--high-entropy-va' windows-i686: arch: i686 var: @@ -501,9 +499,9 @@ targets: arch: amd64 configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]" [% c("var/configure_opt_project") %]' CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]' - LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_HEASLR") %] [% c("var/flag_noSEH") %] [% c("var/flag_mwindows") %]' - flag_mwindows: '-mwindows' - compiler: mingw-w64 + LDFLAGS: '-Wl,--no-insert-timestamp [% c("var/flag_noSEH") %] [% c("var/flag_mwindows") %]' + flag_mwindows: '-Wl,--subsystem,windows' + compiler: mingw-w64-clang deps: - build-essential - python3