This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
src/ld ChangeLog ldmisc.c
- From: vapier at sourceware dot org
- To: binutils-cvs at sourceware dot org
- Date: 3 Apr 2012 03:37:26 -0000
- Subject: src/ld ChangeLog ldmisc.c
CVSROOT: /cvs/src
Module name: src
Changes by: vapier@sourceware.org 2012-04-03 03:37:26
Modified files:
ld : ChangeLog ldmisc.c
Log message:
ld: optimize vfinfo output slightly
ld atm ends up calling the write() syscall on every char when displaying
an error message. For example:
$ echo 'main(){foo();}' | strace -f -ewrite gcc -x c -o /dev/null -
...
[pid 13035] write(2, ":", 1) = 1
[pid 13035] write(2, " ", 1) = 1
[pid 13035] write(2, "I", 1) = 1
[pid 13035] write(2, "n", 1) = 1
[pid 13035] write(2, " ", 1) = 1
[pid 13035] write(2, "f", 1) = 1
[pid 13035] write(2, "u", 1) = 1
[pid 13035] write(2, "n", 1) = 1
[pid 13035] write(2, "c", 1) = 1
[pid 13035] write(2, "t", 1) = 1
[pid 13035] write(2, "i", 1) = 1
[pid 13035] write(2, "o", 1) = 1
[pid 13035] write(2, "n", 1) = 1
[pid 13035] write(2, " ", 1) = 1
[pid 13035] write(2, "`", 1) = 1
...
That's just to write ": In function `main':". A slight optimization in
the vfinfo() func gives a much more reasonable syscall footprint:
...
write(2, ": In function `", 15) = 15
...
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2425&r2=1.2426
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/ldmisc.c.diff?cvsroot=src&r1=1.42&r2=1.43