diff --git a/compiler/GHC/Tc/Gen/Foreign.hs b/compiler/GHC/Tc/Gen/Foreign.hs
index 4483c7d65d81bc2debad63de9496924d00c71a6f..6e6d23a4fb920e05cd8a937b8796c6f54957f5d7 100644
--- a/compiler/GHC/Tc/Gen/Foreign.hs
+++ b/compiler/GHC/Tc/Gen/Foreign.hs
@@ -78,7 +78,7 @@ import GHC.Data.Bag
 import GHC.Driver.Hooks
 import qualified GHC.LanguageExtensions as LangExt
 
-import Control.Monad ( zipWithM )
+import Control.Monad ( when, zipWithM )
 import Control.Monad.Trans.Writer.CPS
   ( WriterT, runWriterT, tell )
 import Control.Monad.Trans.Class
@@ -443,7 +443,7 @@ tcFExport d = pprPanic "tcFExport" (ppr d)
 tcCheckFEType :: Type -> ForeignExport GhcRn -> TcM (ForeignExport GhcTc)
 tcCheckFEType sig_ty edecl@(CExport src (L l (CExportStatic esrc str cconv))) = do
     checkCg (Left edecl) backendValidityOfCExport
-    checkTc (isCLabelString str) (TcRnInvalidCIdentifier str)
+    when (cconv /= JavaScriptCallConv) $ checkTc (isCLabelString str) (TcRnInvalidCIdentifier str)
     cconv' <- checkCConv (Left edecl) cconv
     checkForeignArgs isFFIExternalTy arg_tys
     checkForeignRes nonIOok noCheckSafe isFFIExportResultTy res_ty