summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-05-09 13:15:13 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-05-13 02:07:08 -0400
commite34bf65613f0062ea902fb3d59623701b7cd01d5 (patch)
treeb6e47eb3d3e6307eb03232e5c852f66718d6810f
parent86d8ac22608eb8f04ceaff65e76dbeec23b76753 (diff)
downloadhaskell-e34bf65613f0062ea902fb3d59623701b7cd01d5.tar.gz
users-guide: Add discussion of shared object naming
Fixes #18074.
-rw-r--r--docs/users_guide/packages.rst8
-rw-r--r--docs/users_guide/phases.rst3
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/users_guide/packages.rst b/docs/users_guide/packages.rst
index fae18241ea..75774c8055 100644
--- a/docs/users_guide/packages.rst
+++ b/docs/users_guide/packages.rst
@@ -1061,6 +1061,14 @@ extra indirection).
its output in place of ⟨GHCVersion⟩. See also :ref:`options-codegen`
on how object files must be prepared for shared object linking.
+- When building a shared library, care must be taken to ensure that the
+ resulting object is named appropriately. In particular, GHC expects the
+ name of a shared object to have the form ``libHS<unit id>-ghc<ghc
+ version>.<ext>`` where *unit id* is the unit ID given during compilation via
+ the :ghc-flag:`-this-unit-id ⟨unit-id⟩` flag, *ghc version* is the version of
+ GHC that produced/consumes the object and *ext* is the host system's usual
+ file extension for shared objects.
+
To compile a module which is to be part of a new package, use the
``-package-name`` (to identify the name of the package) and
``-library-name`` (to identify the version and the version hashes of its
diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst
index d0afe80a23..b2664cf180 100644
--- a/docs/users_guide/phases.rst
+++ b/docs/users_guide/phases.rst
@@ -807,7 +807,8 @@ for example).
When creating shared objects for Haskell packages, the shared object
must be named properly, so that GHC recognizes the shared object
- when linked against this package. See shared object name mangling.
+ when linking against this package.
+ See :ref:`shared object name mangling <building-packages>` for details.
.. ghc-flag:: -dynload
:shortdesc: Selects one of a number of modes for finding shared libraries at runtime.