New fix for #11647. Avoid side effects like #17171

If a main module doesn't contain a header, we omit the check whether the main module is exported.
With this patch GHC, GHCi and runghc use the same code.
21 jobs for master in 236 minutes and 58 seconds (queued for 4 seconds)
Status Job ID Name Coverage
  Lint
passed #170235
lint
lint-linters

00:00:15

passed #170238
lint
lint-submods-branch

00:00:20

passed #170236
lint
lint-testsuite

00:00:18

passed #170237
lint
typecheck-testsuite

00:00:16

 
  Build
passed #170240
x86_64-linux
hadrian-ghc-in-ghci

00:19:01

passed #170242
x86_64-linux
release-x86_64-linux-deb9-dwarf

01:53:52

failed #170241
x86_64-linux
validate-x86_64-linux-deb9-debug

03:41:51

passed #170239
x86_64-linux
validate-x86_64-linux-deb9-hadrian

03:55:57

 
  Full Build
skipped #170244
aarch64-linux allowed to fail
validate-aarch64-linux-deb9
skipped #170245
x86_64-linux
validate-i386-linux-deb9
skipped #170243
x86_64-darwin
validate-x86_64-darwin
skipped #170246
x86_64-linux
validate-x86_64-linux-deb9-integer-simple
skipped #170247
x86_64-linux
validate-x86_64-linux-deb9-unreg
skipped #170248
x86_64-linux
validate-x86_64-linux-fedora27
skipped #170250
x86_64-windows allowed to fail
validate-x86_64-windows
skipped #170249
x86_64-windows allowed to fail
validate-x86_64-windows-hadrian
 
  Cleanup
passed #170251
x86_64-darwin
cleanup-darwin

00:00:05

 
  Packaging
skipped #170252
x86_64-linux allowed to fail
doc-tarball
 
  Testing
skipped #170253
x86_64-linux allowed to fail manual
hackage
skipped #170254
x86_64-linux
perf-nofib
 
  Deploy
skipped #170255
x86_64-linux allowed to fail
pages
 
Name Stage Failure
failed
validate-x86_64-linux-deb9-debug Build
$ cp -Rf $HOME/.cabal cabal-cache
Uploading artifacts...
ghc-*.tar.xz: found 1 matching files
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=170241 responseStatus=201 Created token=5e6DHTCg
Uploading artifacts...
junit.xml: found 1 matching files

Uploading artifacts to coordinator... ok
id=170241 responseStatus=201 Created token=5e6DHTCg
ERROR: Job failed: exit code 1