METAL-LIBTOOL(1) | Metal | METAL-LIBTOOL(1) |
metal-libtool - create metal libraries
metal-libtool -static -o output [options] filename ...
metal-libtool -dynamic -o output [options] filename ...
metal-libtool -lowering -o output [options] filename ...
The metal-libtool command takes the specified input object files and creates a library for use with the link editor, metal-lld. The library name is specified by output (the argument of the -o flag). The input object files may be in any correct format that contains object files (universal files, archives, object files). metal-libtool will not put any non-object input file into the output library.
metal-libtool can create statically linked libraries, with -static, dynamically linked shared libraries, with -dynamic, or lowering libraries, with -lowering.
Statically linked libraries are ar format files. To build a statically linked library, metal-libtool runs the link editor, metal-lld, with -create-static-library once for each architecture present in the input objects and then metal-lipo to create a universal file if needed.
The archive member name for a table of contents is either "__.SYMDEF" or "__.SYMDEF SORTED" for archives with 32-bit file offsets. The latter being used when when table of contents is sorted. The table of contents archive member name for archives with 64-bit file offsets is either "__.SYMDEF_64" or "__.SYMDEF_64 SORTED".
Dynamically linked libraries, unlike statically linked libraries, are MetalLib format files and not ar format files. Dynamically linked libraries have two restrictions: No symbol may be defined in more than one object file and no common symbol can be used. To build a dynamically linked library, metal-libtool runs the link editor, metal-lld, with -create-shared-library once for each architecture present in the input objects and then metal-lipo to create a universal file if needed.
Lowering libraries are statically linked libraries where each member contains only one symbol with external linkage. To build a lowering library, metal-libtool runs the link editor, metal-lld, with -create-lowering-library once for each architecture present in the input objects and then metal-lipo to create a universal file if needed.
Specifying a newer <os version> or <sdk version> enables the link editor to assume features of that OS or SDK in the output file. The format of <os version> and <sdk version> is a version number such as 10.13 or 10.14.
To create a static library:
$ metal-libtool -create-static-library foo.air bar.air -o libfoobar.a
To create a dynamic library:
$ metal-libtool -create-dynamic-library foo.air bar.air -install_name libfoobar.metallib -o libfoobar.metallib
To link only one architecture:
$ metal-libtool -create-static-library -arch_only air64_v18 foo-air64_v16.air foo-air64_v18.air foo-air64_v111.air -o libfoo.a
The libfoo.a output is a air64_v18 thin archive. It contains two members; foo-air64_v18.air is copied verbatim, while foo-air64_v16.air is upgraded to air64_v18 before putting it into the archive. foo-air64_v111 is ignored, as there is no upgrade path from there to air64_v18.
To report bugs, please visit <https://developer.apple.com/bug-reporting/>.
metal-arch(1) metal-lld(1)
Metal Shading Language Specification: <https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf>
2014-2023, The Metal Team
July 5, 2023 | 15 |