[GHC] #13378: ghc-stage2 broken for quick-llvm

inplace/bin/ghc-stage2 echo 'datadir="/ghc/inplace/lib"' >> inplace/bin/ghc-stage2 echo 'bindir="/ghc/inplace/bin"' >> inplace/bin/ghc-stage2 echo 'topdir="/ghc/inplace/lib"' >> inplace/bin /ghc-stage2 echo 'pgmgcc="gcc"' >> inplace/bin/ghc-stage2 echo 'export DYLD_LIBRARY_PATH="/ghc/libraries/haskeline/dist- install/build:/ghc/compiler/stage2/build:/ghc/libraries/terminfo/dist- install/build:/ghc/libraries/hoopl/dist-install/build:/ghc/libraries/ghci /dist-install/build:/ghc/libraries/ghc-boot/dist- install/build:/ghc/libraries/transformers/dist- install/build:/ghc/libraries/hpc/dist-install/build:/ghc/libraries /template-haskell/dist-install/build:/ghc/libraries/pretty/dist- install/build:/ghc/libraries/ghc-boot-th/dist- install/build:/ghc/libraries/process/dist- install/build:/ghc/libraries/directory/dist- install/build:/ghc/libraries/unix/dist- install/build:/ghc/libraries/filepath/dist- install/build:/ghc/libraries/time/dist-install/build:/ghc/libraries/binary /dist-install/build:/ghc/libraries/containers/dist- install/build:/ghc/libraries/bytestring/dist- install/build:/ghc/libraries/deepseq/dist- install/build:/ghc/libraries/array/dist-install/build:/ghc/libraries/base /dist-install/build:/ghc/libraries/integer-gmp/dist- install/build:/ghc/libraries/ghc-prim/dist- install/build:/ghc/rts/dist/build${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"' inplace/bin/ghc-stage2 cat ghc/ghc.wrapper >> inplace/bin /ghc-stage2 chmod +x inplace/bin /ghc-stage2 "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -fllvm -Wall -hide-all-packages -i -iutils/ghctags/. -iutils/ghctags/dist-install/build -Iutils/ghctags/dist- install/build -iutils/ghctags/dist-install/build/ghctags/autogen -Iutils/ghctags/dist-install/build/ghctags/autogen -optP-include -optPutils/ghctags/dist-install/build/ghctags/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id containers-0.5.10.2 -package-id Cabal-2.0.0.0 -package-id ghc-8.1 -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad-instances -odir utils/ghctags/dist- install/build -hidir utils/ghctags/dist-install/build -stubdir utils/ghctags/dist-install/build -c utils/ghctags/./Main.hs -o utils/ghctags/dist-install/build/Main.dyn_o "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -fllvm -Wall -hide-all-packages -i -iutils/check- api-annotations/. -iutils/check-api-annotations/dist-install/build -Iutils /check-api-annotations/dist-install/build -iutils/check-api-annotations /dist-install/build/check-api-annotations/autogen -Iutils/check-api- annotations/dist-install/build/check-api-annotations/autogen -optP- include -optPutils/check-api-annotations/dist-install/build/check-api- annotations/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id containers-0.5.10.2 -package-id Cabal-2.0.0.0 -package-id
#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Keywords: | Operating System: MacOS X Architecture: x86_64 | Type of failure: Building GHC (amd64) | failed Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Building recent HEAD (e.g. 669333d8) with llvm via quick-llvm fails. The stage2 compiler is broken. Building the compiler with quick-llvm {{{ "inplace/bin/ghc-stage1" -o ghc/stage2/build/tmp/ghc-stage2 -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -fllvm -Wall -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen -optP- DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id array-0.5.1.2 -package-id bytestring-0.10.8.2 -package-id directory-1.3.0.2 -package-id process-1.4.3.0 -package-id filepath-1.4.1.1 -package-id ghc-boot-8.1 -package-id ghc-8.1 -package-id unix-2.7.2.1 -package-id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.1 -package-id haskeline-0.7.3.0 -package-id time-1.8 -package-id transformers-0.5.2.0 -Wall -fno-warn-name-shadowing -XHaskell2010 -O0 -no-hs-main -threaded -no-user-package-db -rtsopts -Wnoncanonical- monad-instances -odir ghc/stage2/build -hidir ghc/stage2/build -stubdir ghc/stage2/build -optl-optl-Wl,-arch -optl-optl-Wl,x86_64 -fPIC -dynamic -O0 -H64m -fllvm -Wall -hide-all-packages -i -ighc/. -ighc/stage2/build -Ighc/stage2/build -ighc/stage2/build/ghc/autogen -Ighc/stage2/build/ghc/autogen -optP-DGHCI -optP-include -optPghc/stage2/build/ghc/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id array-0.5.1.2 -package-id bytestring-0.10.8.2 -package-id directory-1.3.0.2 -package-id process-1.4.3.0 -package-id filepath-1.4.1.1 -package-id ghc-boot-8.1 -package-id ghc-8.1 -package-id unix-2.7.2.1 -package-id containers-0.5.10.2 -package-id deepseq-1.4.3.0 -package-id ghci-8.1 -package-id haskeline-0.7.3.0 -package-id time-1.8 -package-id transformers-0.5.2.0 -Wall -fno-warn-name-shadowing -XHaskell2010 -O0 -no-hs-main -threaded -no-user-package-db -rtsopts -Wnoncanonical- monad-instances -fno-use-rpaths -optl-Wl,-rpath -optl- Wl,'@loader_path/../haskeline-0.7.3.0' -optl-Wl,-rpath -optl- Wl,'@loader_path/../ghc-8.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../terminfo-0.4.0.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../hoopl-3.10.2.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../ghci-8.1' -optl-Wl,-rpath -optl-Wl,'@loader_path /../ghc-boot-8.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../transformers-0.5.2.0' -optl-Wl,-rpath -optl- Wl,'@loader_path/../hpc-0.6.0.3' -optl-Wl,-rpath -optl-Wl,'@loader_path /../template-haskell-2.12.0.0' -optl-Wl,-rpath -optl- Wl,'@loader_path/../pretty-1.1.3.3' -optl-Wl,-rpath -optl-Wl,'@loader_path /../ghc-boot-th-8.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../process-1.4.3.0' -optl-Wl,-rpath-optl- Wl,'@loader_path/../directory-1.3.0.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../unix-2.7.2.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../filepath-1.4.1.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../time-1.8' -optl-Wl,-rpath -optl- Wl,'@loader_path/../binary-0.8.4.1' -optl-Wl,-rpath -optl- Wl,'@loader_path/../containers-0.5.10.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../bytestring-0.10.8.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../deepseq-1.4.3.0' -optl-Wl,-rpath -optl- Wl,'@loader_path/../array-0.5.1.2' -optl-Wl,-rpath -optl- Wl,'@loader_path/../base-4.10.0.0' -optl-Wl,-rpath -optl-Wl,'@loader_path /../integer-gmp-1.0.0.1' -optl-Wl,-rpath -optl-Wl,'@loader_path/../ghc- prim-0.5.0.0' -optl-Wl,-rpath -optl-Wl,'@loader_path/../rts' ghc/stage2/build/Main.dyn_o ghc/stage2/build/GHCi/UI.dyn_o ghc/stage2/build/GHCi/UI/Info.dyn_o ghc/stage2/build/GHCi/UI/Monad.dyn_o ghc/stage2/build/GHCi/UI/Tags.dyn_o ghc/stage2/build/hschooks.dyn_o Warning: -rtsopts and -with-rtsopts have no effect with -no-hs-main. Call hs_init_ghc() from your main() function to set these options. /usr/bin/install -c -m 755 ghc/stage2/build/tmp/ghc-stage2 inplace/lib/bin /ghc-stage2 "rm" -f inplace/bin /ghc-stage2 echo '#!/bin/sh' >> inplace/bin/ghc-stage2 echo 'executablename="/ghc/inplace/lib/bin/ghc-stage2"' directory-1.3.0.2 -package-id ghc-8.1 -Wall -XHaskell2010 -no-user- package-db -rtsopts -Wnoncanonical-monad-instances -odir utils /check-api-annotations/dist-install/build -hidir utils/check-api- annotations/dist-install/build -stubdir utils/check-api-annotations/dist- install/build -c utils/check-api-annotations/./Main.hs -o utils/check- api-annotations/dist-install/build/Main.dyn_o "inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf dyn_o -hcsuf dyn_hc -fPIC -dynamic -O0 -H64m -fllvm -Wall -hide-all-packages -i -iutils/check- ppr/. -iutils/check-ppr/dist-install/build -Iutils/check-ppr/dist- install/build -iutils/check-ppr/dist-install/build/check-ppr/autogen -Iutils/check-ppr/dist-install/build/check-ppr/autogen -optP-include -optPutils/check-ppr/dist-install/build/check-ppr/autogen/cabal_macros.h -package-id base-4.10.0.0 -package-id bytestring-0.10.8.2 -package-id containers-0.5.10.2 -package-id Cabal-2.0.0.0 -package-id directory-1.3.0.2 -package-id filepath-1.4.1.1 -package-id ghc-8.1 -Wall -XHaskell2010 -no-user-package-db -rtsopts -Wnoncanonical-monad- instances -odir utils/check-ppr/dist-install/build -hidir utils/check-ppr /dist-install/build -stubdir utils/check-ppr/dist-install/build -c utils/check-ppr/./Main.hs -o utils/check-ppr/dist-install/build/Main.dyn_o ghc-stage2: internal error: ghc-stage2: internal error: ghc-stage2: internal error: evacuate(static): strange closure type 0evacuate(static): strange closure type 0evacuate(static): strange closure type 0 (GHC version 8.1.20170304 for x86_64_apple_darwin) (GHC version 8.1.20170304 for x86_64_apple_darwin) (GHC version 8.1.20170304 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug make[1]: *** [utils/check-ppr/dist-install/build/Main.dyn_o] Abort trap: 6 make[1]: *** Waiting for unfinished jobs.... make[1]: *** [utils/check-api-annotations/dist-install/build/Main.dyn_o] Abort trap: 6 make[1]: *** [utils/ghctags/dist-install/build/Main.dyn_o] Abort trap: 6 make: *** [all] Error 2 }}} Building and linking against the debug rts, gives the following result in lldb. {{{ (lldb) settings set -- target.run-args "+RTS" "-DS" "-Dl" "-Ds" "-RTS" (lldb) run Process 3546 launched: '/ghc/inplace/lib/bin/ghc-stage2' (x86_64) 7fffae4753c0: created capset 0 of type 2 7fffae4753c0: created capset 1 of type 3 7fffae4753c0: cap 0: initialised 7fffae4753c0: assigned cap 0 to capset 0 7fffae4753c0: assigned cap 0 to capset 1 7fffae4753c0: allocated 1 more capabilities 7fffae4753c0: new task (taskCount: 1) 7fffae4753c0: returning; I want capability 0 7fffae4753c0: resuming capability 0 7fffae4753c0: cap 0: created thread 1 7fffae4753c0: new bound thread (1) 7fffae4753c0: cap 0: schedule() ghc-stage2: internal error: ASSERTION FAILED: file rts/sm/Sanity.c, line 88 (GHC version 8.1.20170304 for x86_64_apple_darwin) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug Process 3546 stopped * thread #1: tid = 0x6df55a1, 0x00007fffa5756dd6 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main- thread', stop reason = signal SIGABRT frame #0: 0x00007fffa5756dd6 libsystem_kernel.dylib`__pthread_kill + 10 libsystem_kernel.dylib`__pthread_kill: -> 0x7fffa5756dd6 <+10>: jae 0x7fffa5756de0 ; <+20> 0x7fffa5756dd8 <+12>: movq %rax, %rdi 0x7fffa5756ddb <+15>: jmp 0x7fffa574fcdf ; cerror_nocancel 0x7fffa5756de0 <+20>: retq (lldb) bt all warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available. * thread #1: tid = 0x6df55a1, 0x00007fffa5756dd6 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main- thread', stop reason = signal SIGABRT * frame #0: 0x00007fffa5756dd6 libsystem_kernel.dylib`__pthread_kill + 10 frame #1: 0x00007fffa5842787 libsystem_pthread.dylib`pthread_kill + 90 frame #2: 0x00007fffa56bc420 libsystem_c.dylib`abort + 129 frame #3: 0x0000000102d09e61 ghc- stage2`rtsFatalInternalErrorFn(s="ASSERTION FAILED: file %s, line %u\n", ap=0x00007fff5fbfefe0) + 273 at RtsMessages.c:182 frame #4: 0x0000000102d0a16a ghc-stage2`barf(s="ASSERTION FAILED: file %s, line %u\n") + 346 at RtsMessages.c:46 frame #5: 0x0000000102d0a1a7 ghc- stage2`_assertFail(filename="rts/sm/Sanity.c", linenum=88) + 39 at RtsMessages.c:61 frame #6: 0x0000000102d3358e ghc- stage2`checkClosureShallow(p=0x0000000103412930) + 62 at Sanity.c:88 frame #7: 0x0000000102d31422 ghc- stage2`checkSmallBitmap(payload=0x0000000105c05368, bitmap=0, size=1) + 66 at Sanity.c:53 frame #8: 0x0000000102d31181 ghc- stage2`checkStackFrame(c=0x0000000105c05360) + 161 at Sanity.c:114 frame #9: 0x0000000102d3157b ghc- stage2`checkStackChunk(sp=0x0000000105c05360, stack_end=0x0000000105c05388) + 43 at Sanity.c:171 frame #10: 0x0000000102d321d4 ghc- stage2`checkSTACK(stack=0x0000000105c05000) + 116 at Sanity.c:515 frame #11: 0x0000000102d32154 ghc- stage2`checkTSO(tso=0x0000000105c05388) + 372 at Sanity.c:553 frame #12: 0x0000000102d10edd ghc- stage2`schedule(initialCapability=0x000000010353b640, task=0x0000000105900c30) + 461 at Schedule.c:323 frame #13: 0x0000000102d10b7b ghc- stage2`scheduleWaitThread(tso=0x0000000105c05388, ret=0x0000000000000000, pcap=0x00007fff5fbff328) + 203 at Schedule.c:2552 frame #14: 0x0000000102d06655 ghc- stage2`rts_evalIO(cap=0x00007fff5fbff328, p=0x0000000103412930, ret=0x0000000000000000) + 69 at RtsAPI.c:460 frame #15: 0x0000000102d46860 ghc- stage2`ioManagerStartCap(cap=0x00007fff5fbff328) + 32 at Signals.c:211 frame #16: 0x0000000102d4689e ghc-stage2`ioManagerStart + 46 at Signals.c:221 frame #17: 0x0000000102d0a9cb ghc- stage2`hs_init_ghc(argc=0x00007fff5fbff558, argv=0x00007fff5fbff550, rts_config=RtsConfig @ 0x00007fff5fbff4c0) + 843 at RtsStartup.c:290 frame #18: 0x0000000102d09c8a ghc-stage2`hs_main(argc=1, argv=0x00007fff5fbff690, main_closure=0x00000001030fd720, rts_config=RtsConfig @ 0x00007fff5fbff570) + 58 at RtsMain.c:51 frame #19: 0x00000001000c2b9c ghc-stage2`main + 188 frame #20: 0x00007fffa5628255 libdyld.dylib`start + 1 thread #2: tid = 0x6df560a, 0x00007fffa5756fda libsystem_kernel.dylib`__semwait_signal + 10 frame #0: 0x00007fffa5756fda libsystem_kernel.dylib`__semwait_signal + 10 frame #1: 0x00007fffa56ddb72 libsystem_c.dylib`nanosleep + 199 frame #2: 0x00007fffa56dda66 libsystem_c.dylib`usleep + 54 frame #3: 0x0000000102d45a02 ghc- stage2`itimer_thread_func(_handle_tick=0x0000000102d1dc00) + 82 at Pthread.c:132 frame #4: 0x00007fffa583faab libsystem_pthread.dylib`_pthread_body + 180 frame #5: 0x00007fffa583f9f7 libsystem_pthread.dylib`_pthread_start + 286 frame #6: 0x00007fffa583f1fd libsystem_pthread.dylib`thread_start + 13 (lldb) dis -s 0x0000000103412930 ghc-stage2`base_GHCziConcziIO_ensureIOManagerIsRunning_closure: 0x103412930 <+0>: andb %cl, %al 0x103412932 <+2>: wait 0x103412933 <+3>: addb (%rcx), %al 0x103412935 <+5>: addb %al, (%rax) 0x103412937 <+7>: addb %al, (%rax) 0x103412939 <+9>: addb %al, (%rax) 0x10341293b <+11>: addb %al, (%rax) 0x10341293d <+13>: addb %al, (%rax) 0x10341293f <+15>: addb %dl, -0x38(%rax) ghc-stage2`base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure: 0x103412942 <+2>: wait 0x103412943 <+3>: addb (%rcx), %al 0x103412945 <+5>: addb %al, (%rax) 0x103412947 <+7>: addb %al, (%rax) 0x103412949 <+9>: addb %al, (%rax) 0x10341294b <+11>: addb %al, (%rax) 0x10341294d <+13>: addb %al, (%rax) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Okay so `checkClosureShallow` is getting passed the address of `base_GHCziConcziIO_ensureIOManagerIsRunning_closure`, which is all well and good. Running the disassembly of the closure back through an assembler gives {{{ Contents of section .text: 0000 20c89b02 01000000 00000000 00000000 ............... }}} which also looks fine (a pointer to some code, followed by a zero or unused word). Based on the definition of `LOOKS_LIKE_CLOSURE_PTR`, it appears that the info table that is supposed to be located before whatever symbol is at `0x01029bc820` is missing; probably a dead code stripping issue again? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by angerman): The offending commit is this one: https://phabricator.haskell.org/rGHC0a6c257de5c217436ec61fdf4b06bca059181f83 found via git bisect after ~5hrs. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): So our options seem to be, in increasing order of desirability: 0. Just don't use `-dead_strip` at link time by default on Darwin. But it doesn't really fix the problem, since a downstream link process could still use `-dead_strip`. Furthermore it would break dead code stripping for the NCG, which currently does work. (We'd then have to use `-split- objs` everywhere to get the same effect.) 1. Disable subsections-via-symbols for modules compiled with the LLVM backend. angerman found that llc unconditionally enables subsections-via- symbols on Darwin with a "funny hack" (https://github.com/llvm- mirror/llvm/blob/f61ad6ec119554f251f44f54c9cf42d8b713866e/lib/Target/X86/X86AsmPrinter.cpp#L607-L612). But we could remove the directive in the LLVM mangler. This would be a sound thing to do, but we'd have no way to do dead code stripping when using LLVM; and on iOS LLVM is the only available option. 2. Insert symbols that point to the start of info tables and give them some kind of externally-visible linkage or mark them as `.no_dead_strip`. I don't think the LLVM input language gives us any way to do this, but we could probably do it in the mangler. This would give us some degree of dead code stripping, but it would keep ''all'' info tables live, even those that were attached to functions that got stripped. As far as I can see that's not a problem except in that the eventual object file will not be as small as it could be. I think this was the strategy used by https://phabricator.haskell.org/D206, but with the adoption of prefix data it's not so easy to implement any more. 3. Insert symbols that point to the start of info tables, and also insert a reference at the end of each function to the start of its info table. Again we could probably do this in the mangler, though it would be more complicated. Ideally we would have some kind of "suffix data" mechanism for this... This would give the best dead code stripping (at the cost of slightly larger code in the non-stripped case) and it's the strategy used by the NCG. (See where `X86.Ppr.pprNatCmmDecl` uses `platformHasSubsectionsViaSymbols`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): angerman has a patch implementing 1 at Phab:D3287. We should actually be able to implement 2 by generating symbols that point to the start of info tables with some inline assembly (http://llvm.org/docs/LangRef.html#module-level-inline-assembly) {{{ module asm ".set foo_info_start, foo - 12" module asm ".global foo_info_start" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Or better, use `.no_dead_strip` rather than `.global`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3290 Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => patch * differential: => Phab:D3290 Comment: We can actually use `.alt_entry` to prevent the linker from splitting up info tables from the following function bodies. Really this should be done in LLVM but for now we can do it ourselves. This is actually slightly better than what we do in the NCG and we could switch the NCG over to using `.alt_entry` too, provided that `.alt_entry` is supported on a sufficiently wide range of Mac OS versions. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: patch Priority: highest | Milestone: 8.2.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D3290 Wiki Page: | -------------------------------------+------------------------------------- Comment (by dobenour): Yikes. I broke `-split_objs` on macOS in 266a9dc4cd34008f1162eb276032c85ef8371842. Should I revert? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by rwbarton): * priority: highest => normal * status: patch => new * differential: Phab:D3290 => * milestone: 8.2.1 => 8.4.1 Comment: Commit 1686f30951292e94bf3076ce8b3eafb0bcbba91d made the mangler remove `.subsections_via_symbols` from LLVM output, implementing option 1 above. So the current status is that the LLVM backend works fine; there just isn't any way to get dead code stripped from modules built by the LLVM backend. `-split-objs` never worked with LLVM anyways, so this is not a regression. So no need to revert the other splitter-related changes. For the most part the LLVM backend is only used for end-user code, rather than for libraries. So there isn't likely to be much dead code to strip anyways. But for targets like iOS on arm/aarch64, LLVM is the only backend option; so I'm leaving this ticket open. Unfortunately the approach using `.alt_entry` did not quite work out, for reasons that are not entirely clear. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: ghc-stage2 broken for quick-llvm
-------------------------------------+-------------------------------------
Reporter: angerman | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version:
Resolution: | Keywords:
Operating System: MacOS X | Architecture: x86_64
Type of failure: Building GHC | (amd64)
failed | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#13378: ghc-stage2 broken for quick-llvm -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by angerman): As Reid said, in https://phabricator.haskell.org/D3287 we mangled away the `.subsections_via_symbols`. (8.2) https://phabricator.haskell.org/D3290 should drop the requirement for the mangling step, by marking everything .no_dead_strip. (8.4). Finally once https://reviews.llvm.org/D30770, lands in llvm (5), we might be able to drop all this hackery completely. Unless we run into issues with out symbol aliasing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: LLVM backend doesn't support MacOS dead code stripping -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): Retitling issue in view of comment:8. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: LLVM backend doesn't support MacOS dead code stripping -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.6.1 => Comment: angerman, what ever happened to this? It looks like the LLVM patch never made it upstream. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13378: LLVM backend doesn't support MacOS dead code stripping -------------------------------------+------------------------------------- Reporter: angerman | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: Resolution: invalid | Keywords: Operating System: MacOS X | Architecture: x86_64 Type of failure: Building GHC | (amd64) failed | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by angerman): * status: new => closed * resolution: => invalid Comment: This actually made it upstream... https://github.com/llvm- mirror/llvm/commit/c7a57cdda643e397720daa35ea3b1c4b7ce42371 However, the use of aliases in the llvm backend prevents llvm to properly insert the altEntry at the right place For macOS, the NCG does allow dead-stripping. For LLVM the llvm-ng backend allows deadstripping of mach-o files (macOS, iOS, ...) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13378#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC