[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/28399] Flag to order functions in a specific order based on orde

From: hiraditya at msn dot com
Subject: [Bug ld/28399] Flag to order functions in a specific order based on order file
Date: Tue, 05 Oct 2021 17:35:06 +0000


--- Comment #2 from hiraditya <hiraditya at msn dot com> ---
> the format of the file
it is a text file with line separated (mangled) symbol name.

> nor what happens to symbols that are not in the file
IIUC symbols that are in the file get preference over all other symbols

>  or symbols that are in the file but which do not appear in any of the input 
> files.

Those symbols get ignored. And can be printed with -order_file_statistics flag

>  (Or what happens to weak symbols, or aliases or ...)
I think the linker may print warning in case of duplicates. but it can take any
conservative approach.

I forgot to mention that MacOS linker also has similar functionality. 

Here is relevant output from `man ld` on Mac OS

     -order_file file
                 Alters the order in which functions and data are laid out. 
For each section in the output file, any symbol
                 in that section that are specified in the order file file is
moved to the start of its section and laid out
                 in the same order as in the order file file.  Order files are
text files with one symbol name per line.
                 Lines starting with a # are comments.  A symbol name may be
optionally preceded with its object file leaf
                 name and a colon (e.g. foo.o:_foo).  This is useful for static
functions/data that occur in multiple files.
                 A symbol name may also be optionally preceded with the
architecture (e.g. ppc:_foo or ppc:foo.o:_foo).
                 This enables you to have one order file that works for
multiple architectures.  Literal c-strings may be
                 ordered by by quoting the string (e.g. "Hello, world\n") in
the order file.

                 When the -order_file option is not used, the linker lays out
functions in object file order and it moves
                 all initializer routines to the start of the __text section
and terminator routines to the end. Use this
                 option to disable the automatic rearrangement of initializers
and terminators.
     -exported_symbols_order file
                 When targeting Mac OS X 10.6 or later, the format of the
exported symbol information can be optimized to
                 make lookups of popular symbols faster.  This option is used
to pass a file containing a list of the sym-
                 bols most frequently used by clients of the dynamic library
being built. Not all exported symbols need to
                 be listed.
                 Logs information about the processing of a -order_file.

You are receiving this mail because:
You are on the CC list for the bug.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]