David Eichmann pushed to branch wip/dcoutts/foreign-label-source-refactoring at Glasgow Haskell Compiler / GHC Commits: 5bb6024b by David Eichmann at 2026-10-05T15:28:30+01:00 fixup! Extend 'foreign import prim' syntax to allow specifying the source package - - - - - ea588929 by David Eichmann at 2026-10-06T11:55:14+01:00 fixup! Rename CCallStaticTargetUnit to CLabelTargetLibrary - - - - - 2 changed files: - compiler/GHC/Parser/PostProcess.hs - compiler/GHC/Types/ForeignCall.hs Changes: ===================================== compiler/GHC/Parser/PostProcess.hs ===================================== @@ -3321,18 +3321,18 @@ parsePrimImportStr str = -- "" ((Nothing, Nothing) <$ skipSpaces) +++ -- "cmmid" - ((\() cmmid () -> (Nothing, Just cmmid)) - <$> sp + ((\cmmid -> (Nothing, Just cmmid)) + <$ sp <*> parse_cmmid - <*> sp + <* sp ) +++ -- "packageName cmmid" - ((\() pkgname () cmmid () -> (Just pkgname, Just cmmid)) - <$> sp + ((\pkgname cmmid -> (Just pkgname, Just cmmid)) + <$ sp <*> parse_pkgname - <*> sp + <* sp <*> parse_cmmid - <*> sp + <* sp ) parse_cmmid = (:) <$> satisfy cmmid_first_char ===================================== compiler/GHC/Types/ForeignCall.hs ===================================== @@ -394,6 +394,10 @@ instance Outputable CLabelTargetLibrary where data StaticTargetGhc = StaticTargetGhc { staticTargetLabel :: SourceText , staticTargetUnit :: CLabelTargetLibrary + -- ^ What package the static target is in. + -- Foreign prim imports (CMM) should always use CLabelTargetInUnit. + -- Other user defined foreign imports always use CLabelTargetUnknown unless a + -- wrapper functin is generated e.g. in the case of capi and dynamic. } deriving (Data, Eq) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f7ccabc15aac7d817d6789fe00c13d6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f7ccabc15aac7d817d6789fe00c13d6... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help