From 76bc30ca118fda404f19c17d97bafdba9779c4c2 Mon Sep 17 00:00:00 2001 From: Sitsofe Wheeler Date: Fri, 21 Aug 2020 20:35:03 +0100 Subject: [PATCH] configure/Makefile: add option to generate pdb symbols Recent versions of Windows clang and LLVM's lld have the ability to build Windows PDB symbols for debugging so add an explicit option to test for support and use it so. Signed-off-by: Sitsofe Wheeler --- Makefile | 6 ++++++ configure | 28 ++++++++++++++++++++++++++++ os/windows/dobuild.cmd | 10 ++++++++-- os/windows/install.wxs | 8 ++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b00daca2..cc5727c3 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,12 @@ ifdef CONFIG_BUILD_NATIVE CFLAGS := -march=native $(CFLAGS) endif +ifdef CONFIG_PDB + LINK_PDBFILE ?= -Wl,-pdb,$(dir $@)/$(basename $(@F)).pdb + CFLAGS := -gcodeview $(CFLAGS) + LDFLAGS += -fuse-ld=lld $(LINK_PDBFILE) +endif + ifdef CONFIG_GFIO PROGS += gfio endif diff --git a/configure b/configure index 43433657..355b6958 100755 --- a/configure +++ b/configure @@ -193,6 +193,8 @@ for opt do ;; --target-win-ver=*) target_win_ver="$optarg" ;; + --enable-pdb) pdb="yes" + ;; --build-static) build_static="yes" ;; --enable-gfio) gfio_check="yes" @@ -256,6 +258,7 @@ if test "$show_help" = "yes" ; then echo "--extra-cflags= Specify extra CFLAGS to pass to compiler" echo "--build-32bit-win Enable 32-bit build on Windows" echo "--target-win-ver= Minimum version of Windows to target (XP or 7)" + echo "--enable-pdb Enable Windows PDB symbols generation (needs clang/lld)" echo "--build-static Build a static fio" echo "--esx Configure build options for esx" echo "--enable-gfio Enable building of gtk gfio" @@ -2702,6 +2705,27 @@ if compile_prog "" "" "statx_syscall"; then fi print_config "statx(2)/syscall" "$statx_syscall" +########################################## +# check for Windows PDB generation support +if test "pdb" != "no" ; then + cat > $TMPC < $TMPC << EOF int main(int argc, char **argv) diff --git a/os/windows/dobuild.cmd b/os/windows/dobuild.cmd index d06a2afa..08df3e87 100644 --- a/os/windows/dobuild.cmd +++ b/os/windows/dobuild.cmd @@ -34,7 +34,13 @@ if defined SIGN_FIO ( signtool sign /as /n "%SIGNING_CN%" /tr http://timestamp.digicert.com /td sha256 /fd sha256 ..\..\t\*.exe ) -"%WIX%bin\candle" -nologo -arch %FIO_ARCH% -dFioVersionNumbers="%FIO_VERSION_NUMBERS%" install.wxs +if exist ..\..\fio.pdb ( + set FIO_PDB=true +) else ( + set FIO_PDB=false +) + +"%WIX%bin\candle" -nologo -arch %FIO_ARCH% -dFioVersionNumbers="%FIO_VERSION_NUMBERS%" -dFioPDB="%FIO_PDB%" install.wxs @if ERRORLEVEL 1 goto end "%WIX%bin\candle" -nologo -arch %FIO_ARCH% examples.wxs @if ERRORLEVEL 1 goto end @@ -43,4 +49,4 @@ if defined SIGN_FIO ( if defined SIGN_FIO ( signtool sign /n "%SIGNING_CN%" /tr http://timestamp.digicert.com /td sha256 /fd sha256 %FIO_VERSION%-%FIO_ARCH%.msi -) \ No newline at end of file +) diff --git a/os/windows/install.wxs b/os/windows/install.wxs index dcb8c92c..f73ec5e2 100755 --- a/os/windows/install.wxs +++ b/os/windows/install.wxs @@ -27,6 +27,11 @@ + + + + + @@ -76,6 +81,9 @@ + + + -- 2.25.1