1MOLD(1)                   BSD General Commands Manual                  MOLD(1)
2

NAME

4     mold — a modern linker
5

SYNOPSIS

7     mold [-options] objfile ...
8

DESCRIPTION

10     mold is a faster drop-in replacement for the default GNU ld(1).
11
12   How to use mold
13     See https://github.com/rui314/mold#how-to-use
14
15   Compatibility
16     mold is designed to be a drop-in replacement for the GNU linkers for
17     linking user-land programs.  If your user-land program cannot be built
18     due to missing command-line options, please file a bug at
19     https://github.com/rui314/mold/issues
20
21     mold supports a very limited set of linker script features, which is just
22     sufficient to read /usr/lib/x86_64-linux-gnu/libc.so on Linux systems (on
23     Linux, that file is despite its name not a shared library but an ASCII
24     linker script that loads a real libc.so file.)  Beyond that, we have no
25     plan to support any linker script features.  The linker script is an ad-
26     hoc, over-designed, complex language which we believe needs to be dis‐
27     rupted by a simpler mechanism.  We have a plan to add a replacement for
28     the linker script to mold instead.
29
30   Archive symbol resolution
31     Traditionally, Unix linkers are sensitive to the order in which input
32     files appear on command line.  They process input files from the first
33     (left-most) file to the last (right-most) file one-by-one.  While reading
34     input files, they maintain sets of defined and undefined symbols.  When
35     visiting an archive file (.a files), they pull out object files to re‐
36     solve as many undefined symbols as possible and go on to the next input
37     file.  Object files that weren't pulled out will never have a chance for
38     a second look.
39
40     Due to this semantics, you usually have to add archive files at the end
41     of a command line, so that when a linker reaches archive files, it knows
42     what symbols are remain undefined.  If you put archive files at the be‐
43     ginning of a command line, a linker doesn't have any undefined symbol,
44     and thus no object files will be pulled out from archives.
45
46     You can change the processing order by --start-group and --end-group op‐
47     tions, though they make a linker slower.
48
49     mold as well as LLVM lld(1) linker take a different approach.  They memo‐
50     rize what symbols can be resolved from archive files instead of forget‐
51     ting it after processing each archive.  Therefore, mold and lld(1) can
52     "go back" in a command line to pull out object files from archives, if
53     they are needed to resolve remaining undefined symbols.  They are not
54     sensitive to the input file order.
55
56     --start-group and --end-group are still accepted by mold and lld(1) for
57     compatibility with traditional linkers, but they are silently ignored.
58
59   Dynamic symbol resolution
60     Some Unix linker features are unable to be understood without understand‐
61     ing the semantics of dynamic symbol resolution.  Therefore, even though
62     that's not specific to mold, we'll explain it here.
63
64     We use "ELF module" or just "module" as a collective term to refer an ex‐
65     ecutable or a shared library file in the ELF format.
66
67     An ELF module may have lists of imported symbols and exported symbols, as
68     well as a list of shared library names from which imported symbols should
69     be imported.  The point is that imported symbols are not bound to any
70     specific shared library until runtime.
71
72     Here is how the Unix dynamic linker resolves dynamic symbols.  Upon the
73     start of an ELF program, the dynamic linker construct a list of ELF mod‐
74     ules which as a whole consist of a complete program.  The executable file
75     is always at the beginning of the list followed by its depending shared
76     libraries.  An imported symbol is searched from the beginning of the list
77     to the end.  If two or more modules define the same symbol, the one that
78     appears first in the list takes precedence over the others.
79
80     This Unix semantics are contrary to systems such as Windows that have the
81     two-level namespace for dynamic symbols.  On Windows, for example, dy‐
82     namic symbols are represented as a tuple of (symbol-name,
83     shared-library-name), so that each dynamic symbol is guaranteed to be re‐
84     solved from some specific library.
85
86     Typically, an ELF module that exports a symbol also imports the same sym‐
87     bol.  Such a symbol is usually resolved to itself, but that's not the
88     case if a module that appears before in the symbol search list provides
89     another definition of the same symbol.
90
91     Let me take malloc(3) as an example.  Assume that you define your version
92     of malloc(3) in your main executable file.  Then, all malloc calls from
93     any module are resolved to your function instead of that in libc, because
94     the executable is always at the beginning of the dynamic symbol search
95     list. Note that even malloc(3) calls within libc are resolved to your
96     definition since libc exports and imports malloc.  Therefore, by defining
97     malloc yourself, you can overwrite a library function, and the malloc(3)
98     in libc becomes dead code.
99
100     These Unix semantics are tricky and sometimes considered harmful.  For
101     example, assume that you accidentally define atoi(3) as a global function
102     in your executable that behaves completely differently from the one in
103     the C standard.  Then, all atoi function calls from any modules (even
104     function calls within libc) are redirected to your function instead of
105     the one in libc which obviously causes a problem.  That is a somewhat
106     surprising consequence for an accidental name conflict.  On the other
107     hand, this semantic is sometimes considered useful because it allows
108     users to overwrite library functions without recompiling modules contain‐
109     ing them.  Whether good or bad, you should keep this semantic in mind to
110     understand the Unix linkers behaviors.
111
112   Build reproducibility
113     mold's output is deterministic.  That is, if you pass the same object
114     files and the same command-line options to the same version of mold, it
115     is guaranteed to always produce the same output.  The linker's internal
116     randomness, such as the timing of thread scheduling or iteration orders
117     of hash tables, doesn't affect the output.
118
119     mold does not have any host-specific default settings.  This is contrary
120     to the GNU linkers to which some configurable values, such as system-de‐
121     pendent library search paths, are hard-coded.  mold depends only on its
122     command-line arguments.
123

OPTIONS

125     --help  Report usage information to stdout and exit.
126
127     -v, --version
128             Report version information to stdout.
129
130     -V      Report version and target information to stdout.
131
132     -C dir, --directory dir
133             Change to dir before doing anything.
134
135     -E, --export-dynamic
136     --no-export-dynamic
137             When creating an executable, using the -E option causes all
138             global symbols to be put into the dynamic symbol table, so that
139             the symbols are visible from other ELF modules at runtime.
140
141             By default, or if --no-export-dynamic is given, only symbols that
142             are referenced by DSOs at link-time are exported from an exe‐
143             cutable.
144
145     -F libname, --filter=libname
146             Set the DT_FILTER dynamic section field to libname.
147
148     -Ifile, --dynamic-linker=file
149     --no-dynamic-linker
150             Set the dynamic linker path to file.  If no -I option is given,
151             or if --no-dynamic-linker is given, no dynamic linker path is set
152             to an output file.  This is contrary to the GNU linkers which
153             sets a default dynamic linker path in that case.  However, this
154             difference doesn't usually make any difference because the com‐
155             piler driver always passes -I to a linker.
156
157     -Ldir, --library-path=dir
158             Add dir to the list of library search paths from which mold
159             searches libraries for the -l option.
160
161             Unlike the GNU linkers, mold does not have the default search
162             paths.  This difference doesn't usually make any difference be‐
163             cause the compiler driver always passes all necessary search
164             paths to a linker.
165
166     -M, --print-map
167             Write a map file to stdout.
168
169     -N, --omagic
170     --no-omagic
171             Force mold to emit an output file with an old-fashioned memory
172             layout.  First, it makes the first data segment to not be aligned
173             to a page boundary.  Second, text segments are marked as writable
174             if the option is given.
175
176     -S, --strip-debug
177             Omit .debug_* sections from the output file.
178
179     -T file, --script=file
180             Read linker script from file.
181
182     -X, --discard-locals
183             Discard temporary local symbols to reduce the sizes of the symbol
184             table and the string table.  Temporary local symbols are local
185             symbols starting with .L.  Compilers usually generate such sym‐
186             bols for unnamed program elements such as string literals or
187             floating-point literals.
188
189     -e symbol, --entry=symbol
190             Use symbol as the entry point symbol instead of the default entry
191             point symbol _start.
192
193     -f shlib, --auxiliary=shlib
194             Set the DT_AUXILIARY dynamic section field to shlib.
195
196     -h libname, --soname=libname
197             Set the DT_SONAME dynamic section field to libname.  This option
198             is used when creating a shared object file.  Typically, when you
199             create SyXXX lib foo.so, you want to pass --soname=foo to a
200             linker.
201
202     -llibname
203             Search for Sylib libname.so or Sylib libname.a from library
204             search paths.
205
206     -m [elf_x86_64 | elf_i386 | aarch64linux]
207             Choose a target.
208
209     -o file, --output=file
210             Use file as the output file name instead of the default name
211             a.out.
212
213     -r, --relocatable
214             Instead of generating an executable or a shared object file, com‐
215             bine input object files to generate another object file that can
216             be used as an input to a linker.
217
218     -s, --strip-all
219             Omit .symtab section from the output file.
220
221     -u symbol, --undefined=symbol
222             If symbol remains as an undefined symbol after reading all object
223             files, and if there is an static archive that contains an object
224             file defining symbol, pull out the object file and link it so
225             that the output file contains a definition of symbol.
226
227     --Bdynamic
228             Link against shared libraries.
229
230     --Bstatic
231             Do not link against shared libraries.
232
233     --Bsymbolic
234             When creating a shared library, make global symbols export-only
235             (i.e. do not import the same symbol).  As a result, references
236             within a shared library is always resolved locally, negating sym‐
237             bol override at runtime.  See Dynamic symbol resolution for more
238             information about symbol imports and exports.
239
240     --Bsymbolic-functions
241             Have the same effect as --Bsymbolic but works only for function
242             symbols.  Data symbols remains being both imported and exported.
243
244     --Bno-symbolic
245             Cancel --Bsymbolic and --Bsymbolic-functions.
246
247     --Map=file
248             Write map file to file.
249
250     --Tbss=address
251             Alias for --section-start=.bss=address.
252
253     --Tdata=address
254             Alias for --section-start=.data=address.
255
256     --Ttext=address
257             Alias for --section-start=.text=address.
258
259     --allow-multiple-definition
260             Normally, the linker reports an error if there are more than one
261             definition of a symbol.  This option changes the default behavior
262             so that it doesn't report an error for duplicate definitions and
263             instead use the first definition.
264
265     --as-needed
266     --no-as-needed
267             By default, shared libraries given to a linker are uncondition‐
268             ally added to the list of required libraries in an output file.
269             However, shared libraries after --as-needed are added to the list
270             only when at least one symbol is actually used by an object file.
271             In other words, shared libraries after --as-needed are not added
272             to the list of needed libraries if they are not needed by a pro‐
273             gram.
274
275             The --no-as-needed option restores the default behavior for sub‐
276             sequent files.
277
278     --build-id
279     --build-id=[none | md5 | sha1 | sha256 | uuid | 0xhexstring]
280     --no-build-id
281             Create a .note.gnu.build-id section containing a byte string to
282             uniquely identify an output file.  --build-id and
283             --build-id=sha256 compute a 256-bit cryptographic hash of an out‐
284             put file and set it to build-id.  md5 and sha1 compute the same
285             hash but truncate it to 128 and 160 bits, respectively, before
286             setting it to build-id.  uuid sets a random 128-bit UUID.
287             0xhexstring sets hexstring.
288
289     --chroot=dir
290             Set dir to root directory.
291
292     --color-diagnostics=[auto | always | never]
293     --color-diagnostics
294     --no-color-diagnostics
295
296             Show diagnostics messages in color using ANSI escape sequences.
297             auto means that mold prints out messages in color only if the
298             standard output is connected to a TTY. Default is auto.
299
300     --defsym=symbol=value
301
302     --compress-debug-sections=[none | zlib | zlib-gabi | zlib-gnu]
303             Compress DWARF debug info (.debug_* sections) using the zlib com‐
304             pression algorithm.
305
306     --defsym=symbol=value
307             Define symbol as an alias for value.
308
309             value is either an integer (in decimal or hexadecimal with ‘0x’
310             prefix) or a symbol name.  If an integer is given as a value,
311             symbol is defined as an absolute symbol with the given value.
312
313     --default-symver
314             Use soname as a symbol version and append that version to all
315             symbols.
316
317     --demangle
318     --no-demangle
319             Demangle C++ symbols in log messages.
320
321     --dependency-file=file
322             Write a dependency file to file.  The contents of the written
323             file is readable by make, which defines only one rule with the
324             linker's output file as a target and all input fiels as its pre‐
325             requisite. Users are expected to include the generated dependency
326             file into a Makefile to automate the dependency management. This
327             option is analogous to the compiler's -MM -MF options.
328
329     --dynamic-list=file
330             Read a list of dynamic symbols from file.
331
332     --eh-frame-hdr
333     --no-eh-frame-hdr
334             Create .eh_frame_hdr section.
335
336     --emit-relocs
337             A linker usually "consumes" relocation sections. That is, a
338             linker applies relocations to other sections, and relocation sec‐
339             tions themselves are discarded.
340
341             The --emit-relocs instructs the linker to leave relocation sec‐
342             tions in the output file. Some post-link binary analysis or opti‐
343             mization tools such as LLVM Bolt need them.
344
345             mold always creates RELA-type relocation sections even if the na‐
346             tive ELF format is REL-type so that it is easy to read addends.
347
348     --enable-new-dtags
349     --disable-new-dtags
350             By default, mold emits DT_RUNPATH for --rpath.  If you pass
351             --disable-new-dtags, mold emits DT_RPATH for --rpath instead.
352
353     --exclude-libs=libraries...
354             Mark all symbols in the given libraries hidden.
355
356     --fatal-warnings
357     --no-fatal-warnings
358             Treat warnings as errors.
359
360     --fini=symbol
361             Call symbol at unload-time.
362
363     --fork
364     --no-fork
365             Spawn a child process and let it do the actual linking.  When
366             linking a large program, the OS kernel can take a few hundred
367             milliseconds to terminate a mold process.  --fork hides that la‐
368             tency.
369
370     --gc-sections
371     --no-gc-sections
372             Remove unreferenced sections.
373
374     --gdb-index
375             Create a .gdb_index section to speed up GNU debugger. To use
376             this, you need to compile source files with the --ggnu-pubnames
377             compiler flag.
378
379     --hash-style=[sysv | gnu | both]
380             Set hash style.
381
382     --icf=[none | safe | all]
383     --no-icf
384             It is not uncommon for a program to contain many identical func‐
385             tions that differ only in name. For example, a C++ template
386             std::vector is very likely to be instantiated to the identical
387             code for std::vector<int> and std::vector<unsigned> because the
388             container cares only about the size of the parameter type. Iden‐
389             tical Code Folding (ICF) is a size optimization to identify and
390             merge such identical functions.
391
392             If --icf=all is given, mold tries to merge all identical func‐
393             tions. This reduces the size of the output most, but it is not
394             “safe” optimization. It is guaranteed in C and C++ that two
395             pointeres pointing two different functions will never be equal,
396             but --icf=all breaks that assumption as two functions have the
397             same address after merging. So a care must be taken when you use
398             that flag that your program does not depend on the function
399             pointer uniqueness.
400
401             --icf=safe is a flag to merge functions only when it is safe to
402             do so. That is, if a program does not take an address of a func‐
403             tion, it is safe to merge that function with other function, as
404             you cannot compare a function pointer with something else without
405             taking an address of a function.  needs to be used with a com‐
406             piler that supports .llvm_addrsig section which contains the in‐
407             formation as to what symbols are address-taken. LLVM/Clang sup‐
408             ports that section by default. Since GCC does not suppor it yet,
409             you cannot use --icf=safe with GCC (it doesn't do any harm but
410             can't optimize at all.)
411
412             --icf=none and --no-icf disables ICF.
413
414     --ignore-data-address-equality
415             Make ICF to merge not only functions but also data. This option
416             should be used in combination with --icf=all.
417
418     --image-base=addr
419             Set the base address to addr.
420
421     --init=symbol
422             Call symbol at load-time.
423
424     --no-undefined
425             Report undefined symbols (even with --shared).
426
427     --noinhibit-exec
428             Create an output file even if errors occur.
429
430     --pack-dyn-relocs=[none | relr]
431             If relr is specified, all R_*_RELATIVE relocations are put into
432             .relr.dyn section instead of .rel.dyn or .rela.dyn section. Since
433             .relr.dyn section uses a space-efficient encoding scheme, speci‐
434             fying this flag can reduce the size of the output. This is typi‐
435             cally most effective for position-independent executable.
436
437             Note that a runtime loader has to support .relr.dyn to run exe‐
438             cutables or shared libraries linked with --pack-dyn-relocs=relr,
439             and only ChromeOS, Android and Fuchsia support it as of now in
440             2022.
441
442     -package-metadata=string
443             Embed string to a .note.package section. This option in intended
444             to be used by a package management command such as rpm to embed
445             metadata regarding a package to each executable file.
446
447     --perf  Print performance statistics.
448
449     --pie, --pic-executable
450     --no-pie, --no-pic-executable
451             Create a position-independent executable.
452
453     --preload
454             Preload object files.
455
456     --print-gc-sections
457     --no-print-gc-sections
458             Print removed unreferenced sections.
459
460     --print-icf-sections
461     --no-print-icf-sections
462             Print folded identical sections.
463
464     --push-state
465     --pop-state
466             --push-state saves the current values of --as-needed,
467             --whole-archive, --static, and --start-lib.  The saved values can
468             be restored by --pop-state.
469
470             --push-state and --pop-state pairs can nest.
471
472             These options are useful when you want to construct linker com‐
473             mand line options programmatically. For example, if you want to
474             link libfoo.so by as-needed basis but don't want to change the
475             global state of --as-needed, you can append "--push-state --as-
476             needed -lfoo --pop-state" to the linker command line options.
477
478     --quick-exit
479     --no-quick-exit
480             Use quick_exit to exit.
481
482     --relax
483     --no-relax
484             Rewrite machine instructions with more efficient ones for some
485             relocations.  The feature is enabled by default.
486
487     --require-defined=symbol
488             Like --undefined, except the new symbol must be defined by the
489             end of the link.
490
491     --repro
492             Embed input files into .repro section.
493
494     --retain-symbols-file=file
495             Keep only symbols listed in file.
496
497             file is a text file containing a symbol name on each line.  mold
498             discards all local symbols as well as global sybmol that are not
499             in file.  Note that this option removes symbols only from .symtab
500             section and does not affect .dynsym section, which is used for
501             dynamic linking.
502
503     --reverse-sections
504             Reverses the order of input sections before assigning them the
505             offsets in the output file.
506
507     --rpath=dir
508             Add dir to runtime search path.
509
510     --run command arg file ...
511             Run command with mold as /usr/bin/ld.
512
513     --section-start=section=address
514             Set address to section.  address is a hexadecimal number that may
515             start with an optional ‘0x’.
516
517     --shared, --Bshareable
518             Create a share library.
519
520     --shuffle-sections
521     --shuffle-sections=number
522             Randomizes the output by shuffleing the order of input sections
523             before assigning them the offsets in the output file. If number
524             is given, it's used as a seed for the random number generator, so
525             that the linker produces the same output as for the same seed. If
526             no seed is given, it uses a random number as a seed.
527
528     --spare-dynamic-tags=number
529             Reserve given number of tags in .dynamic section.
530
531     --start-lib
532     --end-lib
533             Handle object files between --start-lib and --end-lib as if they
534             were in an archive file. That means object files between them are
535             linked only when they are needed to resolve undefined symbols.
536             The options are useful if you want to link object files only when
537             they are needed but want to avoid the overhead of running ar(3).
538
539     --static
540             Do not link against shared libraries.
541
542     --stats
543             Print input statistics.
544
545     --sysroot=dir
546             Set target system root directory to dir.
547
548     --thread-count=count
549             Use count number of threads.
550
551     --threads
552     --no-threads
553             Use multiple threads.  By default, mold uses as many threads as
554             the number of cores or 32, whichever is the smallest.  The reason
555             why it is capped to 32 is because mold doesn't scale well beyond
556             that point.  To use only one thread, pass --no-threads or
557             --thread-count=1.
558
559     --trace
560             Print name of each input file.
561
562     --unique=pattern
563             Don't merge input sections that match pattern.
564
565     --unresolved-symbols=[report-all | ignore-all | ignore-in-object-files |
566             ignore-in-shared-libs]
567             How to handle undefined symbols.
568
569     --version-script=file
570             Read version script from file.
571
572     --warn-common
573     --no-warn-common
574             Warn about common symbols.
575
576     --warn-once
577             Only warn once for each undefined symbol instead of warn for each
578             relocation referring an undefined symbol.
579
580     --warn-unresolved-symbols
581     --error-unresolved-symbols
582             Normally, the linker reports an error for unresolved symbols.
583             --warn-unresolved-symbols option turns it into a warning.
584             --error-unresolved-symbols option restores the default behavior.
585
586     --whole-archive
587     --no-whole-archive
588             When archive files (.a files) are given to a linker, only object
589             files that are needed to resolve undefined symbols are extracted
590             from them and linked to an output file.  --whole-archive changes
591             that behavior for subsequent archives so that a linker extracts
592             all object files and link them to an output.  For example, if you
593             are creating a shared object file and you want to include all ar‐
594             chive members to the output, you should pass --whole-archive.
595             --no-whole-archive restores the default behavior for subsequent
596             archives.
597
598     --wrap=symbol
599             Make symbol to be resolved to __wrap_symbol.  The original symbol
600             can be resolved as __real_symbol.  This option is typically used
601             for wrapping an existing function.
602
603     -z cet-report=[none | warning | error]
604             Intel Control-flow Enforcement Technology (CET) is a new x86 fea‐
605             ture available since Tiger Lake which is released in 2020.  It
606             defines new instructions to harden security to protect programs
607             from control hijacking attacks. You can tell compiler to use the
608             feature by specifying the -fcf-protection flag.
609
610             -z cet-report flag is used to make sure that all object files
611             were compiled with a correct -fcf-protection flag. If warning or
612             error are given, mold prints out a warning or an error message if
613             an object file was not compiled with the compiler flag.
614
615             mold looks for GNU_PROPERTY_X86_FEATURE_1_IBT bit and
616             GNU_PROPERTY_X86_FEATURE_1_SHSTK bit in .note.gnu.property sec‐
617             tion to determine whether or not an object file was compiled with
618             -fcf-protection.
619
620     -z now
621     -z lazy
622             By default, functions referring other ELF modules are resolved by
623             the dynamic linker when they are called for the first time.  -z
624             now marks an executable or a shared library file so that all dy‐
625             namic symbols are loaded when a file is loaded to memory.  -z
626             lazy restores the default behavior.
627
628     -z origin
629             Mark object requiring immediate $ORIGIN processing at runtime.
630
631     -z ibt  Turn on GNU_PROPERTY_X86_FEATURE_1_IBT bit in .note.gnu.property
632             section to indicate that the output uses IBT-enabled PLT. This
633             option implies -z ibtplt.
634
635     -z ibtplt
636             Generate Intel Branch Tracking (IBT)-enabled PLT.
637
638             IBT is part of Intel Control-flow Enforcement Technology (CET).
639             IBT is a new x86 feature available since Tiger Lake which is re‐
640             leased in 2020.  If IBT is enabled, all indirect branch instruc‐
641             tions have to branch to a so-called "landing pad" instruction.
642             Landing pad itself is a no-op, but it works as a marker that
643             branching to that instruction is expected.  If there's no landing
644             pad after branch, the CPU raises an exception.  This mechanism
645             makes ROP attacks difficult.
646
647             Since PLT can be used as an indirect branch target, we need a
648             different instruction sequence for IBT-enabled PLT. If -z ibtplt
649             is specified, mold generates PLT entries that start with a land‐
650             ing pad. The size of IBT-enabled PLT is 24 bytes as opposed to 16
651             bytes regular PLT.
652
653     -z execstack
654     -z noexecstack
655             By default, the pages for the stack area (i.e. the pages where
656             local variables reside) are not executable for security reasons.
657             -z execstack makes it executable.  -z noexecstack restores the
658             default behavior.
659
660     -z keep-text-section-prefix
661     -z nokeep-text-section-prefix
662             Keep .text.hot, .text.unknown, .text.unlikely, .text.startup and
663             .text.exit as separate sections in the final binary.
664
665     -z relro
666     -z norelro
667             Some sections such as .dynamic have to be writable only during an
668             executable or a shared library file is being loaded to memory.
669             Once the dynamic linker finishes its job, such sections won't be
670             mutated by anyone.  As a security mitigation, it is preferred to
671             make such segments read-only during program execution.
672
673             -z relro puts such sections into a special section called relro.
674             The dynamic linker make a relro segment read-only after it fin‐
675             ishes its job.
676
677             By default, mold generates a relro segment.  -z norelro disables
678             the feature.
679
680     -z separate-loadable-segments
681     -z separate-code
682     -z noseparate-code
683             If one memory page contains multiple segments, the page protec‐
684             tion bits are set in such a way that needed attributes (writable
685             or executable) are satisifed for all segments.  This usually hap‐
686             pens at a boundary of two segments with two different attributes.
687
688             separate-loadable-segments adds paddings between segments with
689             different attributes so that they do not share the same page.
690             This is the default.
691
692             separate-code adds paddings only between executable and non-exe‐
693             cutable segments.
694
695             noseparate-code does not add any paddings between segments.
696
697     -z defs
698     -z nodefs
699             Report undefined symbols (even with --shared).
700
701     -z shstk
702             Enforce shadow stack by turning GNU_PROPERTY_X86_FEATURE_1_SHSTK
703             bit in .note.gnu.property output section. Shadow stack is part of
704             Intel Control-flow Enforcement Technology (CET), which is avail‐
705             able since Tiger Lake (2020).
706
707     -z text
708     -z notext, -z textoff
709             mold by default reports an error if dynamic relocations are cre‐
710             ated in read-only sections.  If -z notext or -z textoff are
711             given, mold creates such dynamic relocations without reporting an
712             error.  -z text restores the default behavior.
713
714     -z max-page-size
715             Some CPU ISAs support multiple different memory page sizes.  This
716             option specifies the maximum page size that an output binary can
717             run on.  If you specify a large value, the output can run on both
718             large and small page systems, but it wastes a bit of memory at
719             page boundaries on systems with small pages.
720
721             The default value is 4 KiB for i386, x86-64 and RISC-V, and 64
722             KiB for ARM64.
723
724     -z nodefaultlib
725             Make the dynamic loader to ignore default search paths.
726
727     -z nodelete
728             Mark DSO non-deletable at runtime.
729
730     -z nodlopen
731             Mark DSO not available to dlopen(3).
732
733     -z nodump
734             Mark DSO not available to dldump(3).
735
736     -z nocopyreloc
737             Do not create copy relocations.
738
739     -z initfirst
740             Mark DSO to be initialized first at runtime.
741
742     -z interpose
743             Mark object to interpose all DSOs but executable.
744

SEE ALSO

746     gold(1), ld(1), elf(5) ld.so(8)
747

AUTHORS

749     Rui Ueyama <ruiu@cs.stanford.edu>
750

BUGS

752     Report bugs to https://github.com/rui314/mold/issues
753
754BSD                              July 21, 2022                             BSD
Impressum