Re: Linking

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

 



On 08Dec2006 12:01, Luca <luca.piol@xxxxxxxxxxxxx> wrote:
| How do I capture the linking time and data size of ld?
| 
| I mean, example, when I compile a package foo from scratch, what
| commands should I use to save a log file with something like:
| 
| /usr/bin/ld: total time in link: [time]
| /usr/bin/ld: data size [size]

Second part first: the 'size" command reports on the section sizes of
an executable, so if the ld command makes a file "bah", the command:

  size bah

will report on its size. See "man size" for details.

For timing, you can get the time with the "time" command. Where you
have "ld foo...", put "time ld foo...". Time writes to standard error,
so you will need to send that somewhere:

  time ld foo... 2>output-file

However, ld will write its own error messages to stderr too, and you
_don't_ want to interfere with them. This incantation

  time sh -c 'exec 2>&3 3>&-; exec ld foo...' 3>&2 2>output-file

will work around that, sending time's stderr to the output-file and ld's
stderr wherever the original stderr went (usually your terminal). It
takes a copy of the original stderr and the reattaches the copy as stderr
inside the sh command.

Finally, "time" is often a builtin command in shells. You may get better
behaviour by saying "/usr/bin/time" instead of just "time". That will
run the system "time" executable rather than whatever your shell provides
internally.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

This bottle of whisky is awful.  I'll be glad when it's done.
        - One Scot to another

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux