diff options
author | Bartosz Nitka <niteria@gmail.com> | 2017-01-21 09:59:55 -0800 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2017-01-21 10:00:12 -0800 |
commit | f9ccad236fa6042a3abbb655129f47fe9dadceaf (patch) | |
tree | ded82c41ef05fe429cbabee10ae730795e5774bc /testsuite | |
parent | 15b9a85ef03e2729d487a6f8460be8880c797609 (diff) | |
download | haskell-f9ccad236fa6042a3abbb655129f47fe9dadceaf.tar.gz |
Always use -Xlinker for -rpath
Currently we use `-Wl` which takes a list of
comma-separated options. Unfortunately that
breaks when you use it with `-rpath` and
a path that has commas in them.
Buck, the build system, produces paths with
commas in them.
`-Xlinker` doesn't have this disadvantage
and as far as I can tell is supported by
both `gcc` and `clang`. Anecdotally `nvcc`
supports `-Xlinker`, but not `-Wl`.
Test Plan: ./validate, harbourmaster
Reviewers: nomeata, simonmar, austin, bgamari, hvr
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2971
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/driver/extra_files.py | 1 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/Dummy.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/Main.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/Makefile | 40 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/all.T | 4 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/path_with_commas.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/th/TH_linker/test.pkg | 7 |
7 files changed, 64 insertions, 0 deletions
diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py index 217e5d437a..3f2cf5cc4b 100644 --- a/testsuite/driver/extra_files.py +++ b/testsuite/driver/extra_files.py @@ -428,6 +428,7 @@ extra_src_files = { 'parser.prog001': ['Read006.hs', 'Read007.hs'], 'pat-syn-bundle': ['Bundle1.hs', 'BundleInternal1.hs'], 'pat-syn-trans-bundle': ['Bundle.hs', 'BundleInternal.hs', 'TransBundle.hs'], + 'path_with_commas': ['test.pkg', 'Main.hs', 'Dummy.hs'], 'pkg02': ['A.hs', 'Foreign.hs'], 'plugins01': ['simple-plugin/'], 'plugins02': ['simple-plugin/'], diff --git a/testsuite/tests/th/TH_linker/Dummy.hs b/testsuite/tests/th/TH_linker/Dummy.hs new file mode 100644 index 0000000000..9be471c397 --- /dev/null +++ b/testsuite/tests/th/TH_linker/Dummy.hs @@ -0,0 +1 @@ +module Dummy where diff --git a/testsuite/tests/th/TH_linker/Main.hs b/testsuite/tests/th/TH_linker/Main.hs new file mode 100644 index 0000000000..0530199575 --- /dev/null +++ b/testsuite/tests/th/TH_linker/Main.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import Language.Haskell.TH + +main :: IO () +main = putStrLn $(return $ LitE $ StringL "hello") diff --git a/testsuite/tests/th/TH_linker/Makefile b/testsuite/tests/th/TH_linker/Makefile new file mode 100644 index 0000000000..84f7760765 --- /dev/null +++ b/testsuite/tests/th/TH_linker/Makefile @@ -0,0 +1,40 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +DIR='test,path' +PKGCONF=$(DIR)/local.package.conf +LOCAL_GHC_PKG = '$(GHC_PKG)' --no-user-package-db -f $(PKGCONF) + +ifeq "$(WINDOWS)" "YES" +DLL = lib$1.dll +else ifeq "$(DARWIN)" "YES" +DLL = lib$1.dylib +else +DLL = lib$1.so +endif + +ifeq "$(WINDOWS)" "YES" +EXE = $1.exe +else ifeq "$(DARWIN)" "YES" +EXE = $1 +else +EXE = $1 +endif + +# Check if paths with commas work +# Previously, the linker would use -Wl,-rpath -Wl,test,path to pass the +# path and that would treat test and path as 2 different arguments +path_with_commas : + @rm -rf $(DIR) + mkdir -p $(DIR) + $(LOCAL_GHC_PKG) init $(PKGCONF) + # Create shared library 'foo' from Dummy.hs + '$(TEST_HC)' $(TEST_HC_OPTS) -shared -dynamic Dummy.hs -odir $(DIR) -hidir $(DIR) -o $(DIR)/$(call DLL,foo) > /dev/null + # Make a package that forces trying to load it + $(LOCAL_GHC_PKG) register --force test.pkg + + @rm -rf Main.{hi,o} Main + # Because we compile with -package testpkg, TH has to load 'foo' + '$(TEST_HC)' $(TEST_HC_OPTS) $(ghcThWayFlags) -package-db $(PKGCONF) -package testpkg Main.hs + ./$(call EXE,Main) diff --git a/testsuite/tests/th/TH_linker/all.T b/testsuite/tests/th/TH_linker/all.T new file mode 100644 index 0000000000..8feac991ba --- /dev/null +++ b/testsuite/tests/th/TH_linker/all.T @@ -0,0 +1,4 @@ +test('path_with_commas', + ignore_stderr, + run_command, + ['$MAKE -s --no-print-directory path_with_commas']) diff --git a/testsuite/tests/th/TH_linker/path_with_commas.stdout b/testsuite/tests/th/TH_linker/path_with_commas.stdout new file mode 100644 index 0000000000..0621c2410a --- /dev/null +++ b/testsuite/tests/th/TH_linker/path_with_commas.stdout @@ -0,0 +1,4 @@ +Reading package info from "test.pkg" ... done. +[1 of 1] Compiling Main ( Main.hs, Main.o ) +Linking Main ... +hello diff --git a/testsuite/tests/th/TH_linker/test.pkg b/testsuite/tests/th/TH_linker/test.pkg new file mode 100644 index 0000000000..2fc82cba43 --- /dev/null +++ b/testsuite/tests/th/TH_linker/test.pkg @@ -0,0 +1,7 @@ +name: testpkg +version: 1.2.3.4 +id: testpkg-1.2.3.4-XXX +key: testpkg-1.2.3.4-XXX +exposed: True +library-dirs: "${pkgroot}" +extra-libraries: foo |