Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,251
    • Issues 5,251
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 561
    • Merge requests 561
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17286
Closed
Open
Issue created Oct 01, 2019 by Stefan Schulze Frielinghaus@stefansfDeveloper

Hadrian: Build fails if StgRun/Return are implemented in asm file

Summary

Hadrian fails to build if StgRun and StgReturn are implemented in assembler file rts/StgCRunAsm.S rather than in C file rts/StgCRun.c:

$ ./hadrian/build.sh
[...]
Run Ar Pack Stage1: _build/stage1/rts/build/c/Adjustor.thr_l_o (and 116 more) => _build/stage1/rts/build/libHSrts-1.0_thr_l.a
/usr/bin/ar: creating _build/stage1/rts/build/libHSrts-1.0_thr_l.a

rts/Schedule.c:452:0: error:
     error: undefined reference to 'StgRun'
    |
452 |         r = StgRun((StgFunPtr) stg_returnToStackTop, &cap->r);
    | ^
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
Error when running Shake build system:
  at action, called at src/Rules.hs:71:19 in main:Rules
  at need, called at src/Rules.hs:93:5 in main:Rules
* Depends on: _build/stage1/bin/hp2ps
* Depends on: _build/stage1/rts/build/libHSrts-1.0_thr_debug-ghc8.9.0.20191001.so
* Raised the exception:
user error (Development.Shake.cmd, system command failed
Command line: _build/stage0/bin/ghc [...]
Exit code: 1
Stderr:
Warning: -rtsopts and -with-rtsopts have no effect with -shared.
    Call hs_init_ghc() from your main() function to set these options.

rts/Schedule.c:452:0: error:
     error: undefined reference to 'StgRun'
    |
452 |         r = StgRun((StgFunPtr) stg_returnToStackTop, &cap->r);
    | ^
collect2: error: ld returned 1 exit status
`cc' failed in phase `Linker'. (Exit code: 1)
)

Steps to reproduce

Just move both functions from the C file to the S file of your favourite architecture. Then in file rts/rts.cabal.in add your favourite architecture to the if condition for asm-sources: StgCRunAsm.S and run hadrian.

Are there other places in which the assembler file must be registered for an particular architecture? Did I miss something?

Environment

  • GHC version used: master 822481d5
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking