Skip to content

Commit

Permalink
Testsuite: Skip failing tests on PowerPC 64-bit
Browse files Browse the repository at this point in the history
The Power ISA says the result of a division by zero is undefined.  So
ignore stdout on PowerPC 64-bit systems.

Disable ext-interp tests on 64-bit PowerPC.  We don't have support for
PowerPC 64-bit ELF in the RTS linker, which is needed for the external
interpreter.

Test Plan: ./validate

Reviewers: austin, simonmar, hvr, erikd, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D2782
  • Loading branch information
trommler authored and bgamari committed Dec 27, 2016
1 parent 88f5add commit 4dec7d1
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 13 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Expand Up @@ -262,6 +262,18 @@ AC_ARG_ENABLE(unregisterised,
)
AC_SUBST(Unregisterised)

dnl ** Does target have runtime linker support?
dnl --------------------------------------------------------------
case "$target" in
powerpc64-*|powerpc64le-*|powerpc-ibm-aix*)
HaskellHaveRTSLinker=NO
;;
*)
HaskellHaveRTSLinker=YES
;;
esac
AC_SUBST(HaskellHaveRTSLinker)

# Requires FPTOOLS_SET_PLATFORM_VARS to be run first.
FP_FIND_ROOT

Expand Down
2 changes: 1 addition & 1 deletion mk/config.mk.in
Expand Up @@ -192,7 +192,7 @@ else
ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le aarch64)))
endif

# The THREADED_RTS requites `BaseReg` to be in a register and the
# The THREADED_RTS requires `BaseReg` to be in a register and the
# `GhcUnregisterised` mode doesn't allow that.
GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))

Expand Down
20 changes: 13 additions & 7 deletions rts/Linker.c
Expand Up @@ -78,7 +78,13 @@
#if defined(dragonfly_HOST_OS)
#include <sys/tls.h>
#endif

/*
Note [runtime-linker-support]
-----------------------------
When adding support for a new platform to the runtime linker please
update `$TOP/configure.ac` under heading `Does target have runtime
linker support?`.
*/
/* `symhash` is a Hash table mapping symbol names to RtsSymbolInfo.
This hashtable will contain information on all symbols
that we know of, however the .o they are in may not be loaded.
Expand All @@ -99,7 +105,7 @@
This is to enable lazy loading of symbols. Eager loading is problematic
as it means that all symbols must be available, even those which we will
never use. This is especially painful of Windows, where the number of
never use. This is especially painful on Windows, where the number of
libraries required to link things like mingwex grows to be quite high.
We proceed through these stages as follows,
Expand All @@ -108,12 +114,12 @@
perform a quick scan/indexing of the ObjectCode. All the work
required to actually load the ObjectCode is done.
All symbols from the ObjectCode is also inserted into
All symbols from the ObjectCode are also inserted into
`symhash`, where possible duplicates are handled via the semantics
described in `ghciInsertSymbolTable`.
This phase will produce ObjectCode with status `OBJECT_LOADED` or `OBJECT_NEEDED`
depending on whether they are an archive members or not.
depending on whether they are an archive member or not.
* During initialization we load ObjectCode, perform relocations, execute
static constructors etc. This phase may trigger other ObjectCodes to
Expand All @@ -131,10 +137,10 @@
This phase will produce ObjectCode with status `OBJECT_RESOLVED` if
the previous status was `OBJECT_NEEDED`.
* Lookup symbols is used to lookup any symbols required, both during initial
* lookupSymbols is used to lookup any symbols required, both during initial
link and during statement and expression compilations in the REPL.
Declaration of e.g. an foreign import, will eventually call lookupSymbol
which will either fail (symbol unknown) or succeed (and possibly triggered a
Declaration of e.g. a foreign import, will eventually call lookupSymbol
which will either fail (symbol unknown) or succeed (and possibly trigger a
load).
This phase may transition an ObjectCode from `OBJECT_LOADED` to `OBJECT_RESOLVED`
Expand Down
4 changes: 4 additions & 0 deletions rts/linker/Elf.c
Expand Up @@ -399,6 +399,10 @@ ocVerifyImage_ELF ( ObjectCode* oc )
case EM_IA_64: IF_DEBUG(linker,debugBelch( "ia64" )); break;
#endif
case EM_PPC: IF_DEBUG(linker,debugBelch( "powerpc32" )); break;
case EM_PPC64: IF_DEBUG(linker,debugBelch( "powerpc64" ));
errorBelch("%s: RTS linker not implemented on PowerPC 64-bit",
oc->fileName);
return 0;
#ifdef EM_X86_64
case EM_X86_64: IF_DEBUG(linker,debugBelch( "x86_64" )); break;
#elif defined(EM_AMD64)
Expand Down
1 change: 1 addition & 0 deletions settings.in
Expand Up @@ -26,6 +26,7 @@
("target has GNU nonexec stack", "@HaskellHaveGnuNonexecStack@"),
("target has .ident directive", "@HaskellHaveIdentDirective@"),
("target has subsections via symbols", "@HaskellHaveSubsectionsViaSymbols@"),
("target has RTS linker", "@HaskellHaveRTSLinker@"),
("Unregisterised", "@Unregisterised@"),
("LLVM llc command", "@SettingsLlcCommand@"),
("LLVM opt command", "@SettingsOptCommand@")
Expand Down
3 changes: 3 additions & 0 deletions testsuite/config/ghc
Expand Up @@ -165,6 +165,9 @@ def get_compiler_info():
s = re.sub('[\r\n]', '', s)
rtsInfoDict = dict(eval(s))

# external interpreter needs RTS linker support
config.have_ext_interp = compilerInfoDict["target has RTS linker"] == "YES"

# See Note [Replacing backward slashes in config.libdir].
config.libdir = compilerInfoDict['LibDir'].replace('\\', '/')

Expand Down
3 changes: 2 additions & 1 deletion testsuite/tests/ghci/scripts/all.T
Expand Up @@ -97,7 +97,8 @@ test('ghci056',
test('ghci057', normal, ghci_script, ['ghci057.script'])
test('ghci060', normal, ghci_script, ['ghci060.script'])
test('ghci061', normal, ghci_script, ['ghci061.script'])
test('ghci062', extra_ways(['ghci-ext']), ghci_script, ['ghci062.script'])
test('ghci062', when(config.have_ext_interp, extra_ways(['ghci-ext'])),
ghci_script, ['ghci062.script'])

test('T2452', normal, ghci_script, ['T2452.script'])
test('T2766', normal, ghci_script, ['T2766.script'])
Expand Down
4 changes: 2 additions & 2 deletions testsuite/tests/rts/all.T
Expand Up @@ -46,8 +46,8 @@ test('divbyzero',
# do not generate an exception (interrupt) for integer
# division by zero but the result is undefined.
# C programs compiled with gcc exit normally, so do we.
when(platform('powerpc64-unknown-linux'), exit_code(0)),
when(platform('powerpc64le-unknown-linux'), exit_code(0)),
when(platform('powerpc64-unknown-linux'), [ignore_stdout, exit_code(0)]),
when(platform('powerpc64le-unknown-linux'), [ignore_stdout, exit_code(0)]),
when(opsys('mingw32'), exit_code(1)),
# The output under OS X is too unstable to readily compare
when(platform('i386-apple-darwin'), [ignore_stderr, exit_code(136)]),
Expand Down
5 changes: 3 additions & 2 deletions testsuite/tests/th/all.T
Expand Up @@ -9,8 +9,9 @@ def f(name, opts):
setTestOpts(f)
setTestOpts(req_interp)
# TH should work with -fexternal-interpreter too
setTestOpts(extra_ways(['ext-interp']))
setTestOpts(only_ways(['normal','ghci','ext-interp']))
if config.have_ext_interp :
setTestOpts(extra_ways(['ext-interp']))
setTestOpts(only_ways(['normal','ghci','ext-interp']))

test('TH_mkName', normal, compile, ['-v0'])
test('TH_1tuple', normal, compile_fail, ['-v0'])
Expand Down

0 comments on commit 4dec7d1

Please sign in to comment.