rts.cabal.in: force inclusion of findPtr/_findPtr symbol only with debug flag
[ghc.git] / rts / rts.cabal.in
1 cabal-version: 2.1
2 name: rts
3 version: 1.0
4 license: BSD-3-Clause
5 maintainer: glasgow-haskell-users@haskell.org
6 build-type: Simple
7 flag libm
8   default: @CabalHaveLibm@
9 flag librt
10   default: @CabalHaveLibrt@
11 flag libdl
12   default: @CabalHaveLibdl@
13 flag ffi
14   default: @CabalHaveLibffi@
15 flag need-pthread
16   default: @CabalNeedLibpthread@
17 flag libbfd
18   default: @CabalHaveLibbfd@
19 flag mingwex
20   default: @CabalMingwex@
21 flag libdw
22   default: @CabalHaveLibdw@
23 flag libnuma
24   default: @CabalHaveLibNuma@
25 flag 64bit
26   default: @Cabal64bit@
27 flag leading-underscore
28   default: @CabalLeadingUnderscore@
29 flag smp
30   default: True
31 -- Some cabal flags used to control the flavours we want to produce
32 -- for libHSrts in hadrian. By default, we just produce vanilla and
33 -- threaded. The flags "compose": if you enable debug and profiling,
34 -- you will produce vanilla, _thr, _debug, _p but also _thr_p,
35 -- _thr_debug_p and so on.
36 flag profiling
37   default: False
38 flag debug
39   default: False
40 flag logging
41   default: False
42
43 library
44     -- rts is a wired in package and
45     -- expects the unit-id to be
46     -- set without version
47     ghc-options: -this-unit-id rts
48     if os(windows)
49       extra-bundled-libraries: Cffi-6
50     else
51       extra-bundled-libraries: Cffi
52
53     -- The make build system does something special in config.mk.in
54     -- for generating profiled, debugged, etc builds of those
55     -- libraries, but we need to be transparent for hadrian which
56     -- gets information about the rts "package" through Cabal and
57     -- this cabal file. We therefore declare several
58     -- flavours to be available when passing the suitable (combination of)
59     -- flag(s) when configuring the RTS from hadrian, using Cabal.
60     extra-library-flavours: _thr
61
62     if flag(profiling)
63       extra-library-flavours: _p _thr_p
64       if flag(debug)
65         extra-library-flavours: _debug_p _thr_debug_p
66     if flag(debug)
67       extra-library-flavours: _debug _thr_debug
68     if flag(logging)
69       extra-library-flavours: _l _thr_l
70
71     exposed: True
72     exposed-modules:
73     if flag(libm)
74        -- for ldexp()
75        extra-libraries: m
76     if flag(librt)
77        extra-libraries: rt
78     if flag(libdl)
79        extra-libraries: dl
80     if flag(ffi)
81        extra-libraries: ffi
82     if os(windows)
83        extra-libraries:
84           -- for the linker
85           wsock32 gdi32 winmm
86           -- for crash dump
87           dbghelp
88           -- for process information
89           psapi
90     if flag(need-pthread)
91        -- for pthread_getthreadid_np, pthread_create, ...
92        extra-libraries: pthread
93     if flag(libbfd)
94        -- for debugging
95        extra-libraries: bfd iberty
96     if flag(mingwex)
97        extra-libraries: mingwex
98     if flag(libdw)
99        -- for backtraces
100        extra-libraries: elf dw
101     if flag(libnuma)
102        extra-libraries: numa
103     if !flag(smp)
104        cpp-options: -DNOSMP
105
106     include-dirs: build ../includes includes
107                   includes/dist-derivedconstants/header @FFIIncludeDir@
108     includes: Stg.h
109     install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h
110                       ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h
111                       -- ^ from ../includes
112                       DerivedConstants.h ffi.h ffitarget.h
113                       -- ^ generated
114                       rts/Adjustor.h
115                       rts/BlockSignals.h
116                       rts/Bytecodes.h
117                       rts/Config.h
118                       rts/Constants.h
119                       rts/EventLogFormat.h
120                       rts/EventLogWriter.h
121                       rts/FileLock.h
122                       rts/Flags.h
123                       rts/GetTime.h
124                       rts/Globals.h
125                       rts/Hpc.h
126                       rts/IOManager.h
127                       rts/Libdw.h
128                       rts/LibdwPool.h
129                       rts/Linker.h
130                       rts/Main.h
131                       rts/Messages.h
132                       rts/OSThreads.h
133                       rts/Parallel.h
134                       rts/PrimFloat.h
135                       rts/Profiling.h
136                       rts/Signals.h
137                       rts/SpinLock.h
138                       rts/StableName.h
139                       rts/StablePtr.h
140                       rts/StaticPtrTable.h
141                       rts/TTY.h
142                       rts/Threads.h
143                       rts/Ticky.h
144                       rts/Time.h
145                       rts/Timer.h
146                       rts/Types.h
147                       rts/Utils.h
148                       rts/prof/CCS.h
149                       rts/prof/LDV.h
150                       rts/storage/Block.h
151                       rts/storage/ClosureMacros.h
152                       rts/storage/ClosureTypes.h
153                       rts/storage/Closures.h
154                       rts/storage/FunTypes.h
155                       rts/storage/Heap.h
156                       rts/storage/GC.h
157                       rts/storage/InfoTables.h
158                       rts/storage/MBlock.h
159                       rts/storage/TSO.h
160                       stg/DLL.h
161                       stg/HaskellMachRegs.h
162                       stg/MachRegs.h
163                       stg/MiscClosures.h
164                       stg/Prim.h
165                       stg/Regs.h
166                       stg/RtsMachRegs.h
167                       stg/SMP.h
168                       stg/Ticky.h
169                       stg/Types.h
170     if flag(64bit)
171       if flag(leading-underscore)
172         ld-options:
173           "-Wl,-u,_hs_atomic_add64"
174           "-Wl,-u,_hs_atomic_sub64"
175           "-Wl,-u,_hs_atomic_and64"
176           "-Wl,-u,_hs_atomic_nand64"
177           "-Wl,-u,_hs_atomic_or64"
178           "-Wl,-u,_hs_atomic_xor64"
179           "-Wl,-u,_hs_cmpxchg64"
180           "-Wl,-u,_hs_atomicread64"
181           "-Wl,-u,_hs_atomicwrite64"
182       else
183         ld-options:
184           "-Wl,-u,hs_atomic_add64"
185           "-Wl,-u,hs_atomic_sub64"
186           "-Wl,-u,hs_atomic_and64"
187           "-Wl,-u,hs_atomic_nand64"
188           "-Wl,-u,hs_atomic_or64"
189           "-Wl,-u,hs_atomic_xor64"
190           "-Wl,-u,hs_cmpxchg64"
191           "-Wl,-u,hs_atomicread64"
192           "-Wl,-u,hs_atomicwrite64"
193     if flag(leading-underscore)
194       ld-options:
195          "-Wl,-u,_base_GHCziTopHandler_runIO_closure"
196          "-Wl,-u,_base_GHCziTopHandler_runNonIO_closure"
197          "-Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure"
198          "-Wl,-u,_ghczmprim_GHCziTypes_True_closure"
199          "-Wl,-u,_ghczmprim_GHCziTypes_False_closure"
200          "-Wl,-u,_base_GHCziPack_unpackCString_closure"
201          "-Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure"
202          "-Wl,-u,_base_GHCziIOziException_stackOverflow_closure"
203          "-Wl,-u,_base_GHCziIOziException_heapOverflow_closure"
204          "-Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure"
205          "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
206          "-Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
207          "-Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure"
208          "-Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure"
209          "-Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure"
210          "-Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure"
211          "-Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure"
212          "-Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure"
213          "-Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure"
214          "-Wl,-u,_base_GHCziConcziSync_runSparks_closure"
215          "-Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
216          "-Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
217          "-Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure"
218          "-Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure"
219          "-Wl,-u,_base_GHCziTopHandler_runMainIO_closure"
220          "-Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info"
221          "-Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info"
222          "-Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info"
223          "-Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info"
224          "-Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info"
225          "-Wl,-u,_base_GHCziPtr_Ptr_con_info"
226          "-Wl,-u,_base_GHCziPtr_FunPtr_con_info"
227          "-Wl,-u,_base_GHCziInt_I8zh_con_info"
228          "-Wl,-u,_base_GHCziInt_I16zh_con_info"
229          "-Wl,-u,_base_GHCziInt_I32zh_con_info"
230          "-Wl,-u,_base_GHCziInt_I64zh_con_info"
231          "-Wl,-u,_base_GHCziWord_W8zh_con_info"
232          "-Wl,-u,_base_GHCziWord_W16zh_con_info"
233          "-Wl,-u,_base_GHCziWord_W32zh_con_info"
234          "-Wl,-u,_base_GHCziWord_W64zh_con_info"
235          "-Wl,-u,_base_GHCziStable_StablePtr_con_info"
236          "-Wl,-u,_hs_atomic_add8"
237          "-Wl,-u,_hs_atomic_add16"
238          "-Wl,-u,_hs_atomic_add32"
239          "-Wl,-u,_hs_atomic_sub8"
240          "-Wl,-u,_hs_atomic_sub16"
241          "-Wl,-u,_hs_atomic_sub32"
242          "-Wl,-u,_hs_atomic_and8"
243          "-Wl,-u,_hs_atomic_and16"
244          "-Wl,-u,_hs_atomic_and32"
245          "-Wl,-u,_hs_atomic_nand8"
246          "-Wl,-u,_hs_atomic_nand16"
247          "-Wl,-u,_hs_atomic_nand32"
248          "-Wl,-u,_hs_atomic_or8"
249          "-Wl,-u,_hs_atomic_or16"
250          "-Wl,-u,_hs_atomic_or32"
251          "-Wl,-u,_hs_atomic_xor8"
252          "-Wl,-u,_hs_atomic_xor16"
253          "-Wl,-u,_hs_atomic_xor32"
254          "-Wl,-u,_hs_cmpxchg8"
255          "-Wl,-u,_hs_cmpxchg16"
256          "-Wl,-u,_hs_cmpxchg32"
257          "-Wl,-u,_hs_atomicread8"
258          "-Wl,-u,_hs_atomicread16"
259          "-Wl,-u,_hs_atomicread32"
260          "-Wl,-u,_hs_atomicwrite8"
261          "-Wl,-u,_hs_atomicwrite16"
262          "-Wl,-u,_hs_atomicwrite32"
263          "-Wl,-u,_findPtr"
264
265       if flag(debug)
266         -- This symbol is useful in gdb, but not referred to anywhere,
267         -- so we need to force it to be included in the binary.
268         ld-options: "-Wl,-u,_findPtr"
269
270     else
271       ld-options:
272          "-Wl,-u,base_GHCziTopHandler_runIO_closure"
273          "-Wl,-u,base_GHCziTopHandler_runNonIO_closure"
274          "-Wl,-u,ghczmprim_GHCziTuple_Z0T_closure"
275          "-Wl,-u,ghczmprim_GHCziTypes_True_closure"
276          "-Wl,-u,ghczmprim_GHCziTypes_False_closure"
277          "-Wl,-u,base_GHCziPack_unpackCString_closure"
278          "-Wl,-u,base_GHCziWeak_runFinalizzerBatch_closure"
279          "-Wl,-u,base_GHCziIOziException_stackOverflow_closure"
280          "-Wl,-u,base_GHCziIOziException_heapOverflow_closure"
281          "-Wl,-u,base_GHCziIOziException_allocationLimitExceeded_closure"
282          "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnMVar_closure"
283          "-Wl,-u,base_GHCziIOziException_blockedIndefinitelyOnSTM_closure"
284          "-Wl,-u,base_GHCziIOziException_cannotCompactFunction_closure"
285          "-Wl,-u,base_GHCziIOziException_cannotCompactPinned_closure"
286          "-Wl,-u,base_GHCziIOziException_cannotCompactMutable_closure"
287          "-Wl,-u,base_ControlziExceptionziBase_absentSumFieldError_closure"
288          "-Wl,-u,base_ControlziExceptionziBase_nonTermination_closure"
289          "-Wl,-u,base_ControlziExceptionziBase_nestedAtomically_closure"
290          "-Wl,-u,base_GHCziEventziThread_blockedOnBadFD_closure"
291          "-Wl,-u,base_GHCziConcziSync_runSparks_closure"
292          "-Wl,-u,base_GHCziConcziIO_ensureIOManagerIsRunning_closure"
293          "-Wl,-u,base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure"
294          "-Wl,-u,base_GHCziConcziSignal_runHandlersPtr_closure"
295          "-Wl,-u,base_GHCziTopHandler_flushStdHandles_closure"
296          "-Wl,-u,base_GHCziTopHandler_runMainIO_closure"
297          "-Wl,-u,ghczmprim_GHCziTypes_Czh_con_info"
298          "-Wl,-u,ghczmprim_GHCziTypes_Izh_con_info"
299          "-Wl,-u,ghczmprim_GHCziTypes_Fzh_con_info"
300          "-Wl,-u,ghczmprim_GHCziTypes_Dzh_con_info"
301          "-Wl,-u,ghczmprim_GHCziTypes_Wzh_con_info"
302          "-Wl,-u,base_GHCziPtr_Ptr_con_info"
303          "-Wl,-u,base_GHCziPtr_FunPtr_con_info"
304          "-Wl,-u,base_GHCziInt_I8zh_con_info"
305          "-Wl,-u,base_GHCziInt_I16zh_con_info"
306          "-Wl,-u,base_GHCziInt_I32zh_con_info"
307          "-Wl,-u,base_GHCziInt_I64zh_con_info"
308          "-Wl,-u,base_GHCziWord_W8zh_con_info"
309          "-Wl,-u,base_GHCziWord_W16zh_con_info"
310          "-Wl,-u,base_GHCziWord_W32zh_con_info"
311          "-Wl,-u,base_GHCziWord_W64zh_con_info"
312          "-Wl,-u,base_GHCziStable_StablePtr_con_info"
313          "-Wl,-u,hs_atomic_add8"
314          "-Wl,-u,hs_atomic_add16"
315          "-Wl,-u,hs_atomic_add32"
316          "-Wl,-u,hs_atomic_sub8"
317          "-Wl,-u,hs_atomic_sub16"
318          "-Wl,-u,hs_atomic_sub32"
319          "-Wl,-u,hs_atomic_and8"
320          "-Wl,-u,hs_atomic_and16"
321          "-Wl,-u,hs_atomic_and32"
322          "-Wl,-u,hs_atomic_nand8"
323          "-Wl,-u,hs_atomic_nand16"
324          "-Wl,-u,hs_atomic_nand32"
325          "-Wl,-u,hs_atomic_or8"
326          "-Wl,-u,hs_atomic_or16"
327          "-Wl,-u,hs_atomic_or32"
328          "-Wl,-u,hs_atomic_xor8"
329          "-Wl,-u,hs_atomic_xor16"
330          "-Wl,-u,hs_atomic_xor32"
331          "-Wl,-u,hs_cmpxchg8"
332          "-Wl,-u,hs_cmpxchg16"
333          "-Wl,-u,hs_cmpxchg32"
334          "-Wl,-u,hs_atomicread8"
335          "-Wl,-u,hs_atomicread16"
336          "-Wl,-u,hs_atomicread32"
337          "-Wl,-u,hs_atomicwrite8"
338          "-Wl,-u,hs_atomicwrite16"
339          "-Wl,-u,hs_atomicwrite32"
340
341       if flag(debug)
342         -- This symbol is useful in gdb, but not referred to anywhere,
343         -- so we need to force it to be included in the binary.
344         ld-options: "-Wl,-u,_findPtr"
345
346     if os(osx)
347       ld-options: "-Wl,-search_paths_first"
348       if !arch(x86_64)
349          ld-options: -read_only_relocs warning
350
351     cmm-sources: Apply.cmm
352                  Compact.cmm
353                  Exception.cmm
354                  HeapStackCheck.cmm
355                  PrimOps.cmm
356                  StgMiscClosures.cmm
357                  StgStartup.cmm
358                  StgStdThunks.cmm
359                  Updates.cmm
360                  -- AutoApply is generated
361                  AutoApply.cmm
362
363     if arch(i386) || arch(powerpc) || arch(powerpc64)
364        asm-sources: AdjustorAsm.S
365     if arch(powerpc) || arch(powerpc64) || arch(powerpc64le)
366        asm-sources: StgCRunAsm.S
367
368     c-sources: Adjustor.c
369                Arena.c
370                Capability.c
371                CheckUnload.c
372                ClosureFlags.c
373                Disassembler.c
374                FileLock.c
375                Globals.c
376                Hash.c
377                Heap.c
378                Hpc.c
379                HsFFI.c
380                Inlines.c
381                Interpreter.c
382                LdvProfile.c
383                Libdw.c
384                LibdwPool.c
385                Linker.c
386                Messages.c
387                OldARMAtomic.c
388                PathUtils.c
389                Pool.c
390                Printer.c
391                ProfHeap.c
392                ProfilerReport.c
393                ProfilerReportJson.c
394                Profiling.c
395                Proftimer.c
396                RaiseAsync.c
397                RetainerProfile.c
398                RetainerSet.c
399                RtsAPI.c
400                RtsDllMain.c
401                RtsFlags.c
402                RtsMain.c
403                RtsMessages.c
404                RtsStartup.c
405                RtsSymbolInfo.c
406                RtsSymbols.c
407                RtsUtils.c
408                STM.c
409                Schedule.c
410                Sparks.c
411                StableName.c
412                StablePtr.c
413                StaticPtrTable.c
414                Stats.c
415                StgCRun.c
416                StgPrimFloat.c
417                Task.c
418                ThreadLabels.c
419                ThreadPaused.c
420                Threads.c
421                Ticky.c
422                Timer.c
423                TopHandler.c
424                Trace.c
425                WSDeque.c
426                Weak.c
427                eventlog/EventLog.c
428                eventlog/EventLogWriter.c
429                hooks/FlagDefaults.c
430                hooks/LongGCSync.c
431                hooks/MallocFail.c
432                hooks/OnExit.c
433                hooks/OutOfHeap.c
434                hooks/StackOverflow.c
435                linker/CacheFlush.c
436                linker/Elf.c
437                linker/LoadArchive.c
438                linker/M32Alloc.c
439                linker/MachO.c
440                linker/PEi386.c
441                linker/SymbolExtras.c
442                linker/elf_got.c
443                linker/elf_plt.c
444                linker/elf_plt_aarch64.c
445                linker/elf_plt_arm.c
446                linker/elf_reloc.c
447                linker/elf_reloc_aarch64.c
448                linker/elf_util.c
449                sm/BlockAlloc.c
450                sm/CNF.c
451                sm/Compact.c
452                sm/Evac.c
453                sm/Evac_thr.c
454                sm/GC.c
455                sm/GCAux.c
456                sm/GCUtils.c
457                sm/MBlock.c
458                sm/MarkWeak.c
459                sm/Sanity.c
460                sm/Scav.c
461                sm/Scav_thr.c
462                sm/Storage.c
463                sm/Sweep.c
464                xxhash.c
465                fs.c
466                -- I wish we had wildcards..., this would be:
467                -- *.c hooks/**/*.c sm/**/*.c eventlog/**/*.c linker/**/*.c
468     if os(windows)
469        c-sources: win32/AsyncIO.c
470                   win32/AwaitEvent.c
471                   win32/ConsoleHandler.c
472                   win32/GetEnv.c
473                   win32/GetTime.c
474                   win32/IOManager.c
475                   win32/OSMem.c
476                   win32/OSThreads.c
477                   win32/ThrIOManager.c
478                   win32/Ticker.c
479                   win32/WorkQueue.c
480                   win32/veh_excn.c
481                   -- win32/**/*.c
482     else
483        c-sources: posix/GetEnv.c
484                   posix/GetTime.c
485                   posix/Itimer.c
486                   posix/OSMem.c
487                   posix/OSThreads.c
488                   posix/Select.c
489                   posix/Signals.c
490                   posix/TTY.c
491                   -- posix/*.c -- we do not want itimer