summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/sys/brk.S
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2012-09-05 21:41:05 +0000
committerjilles <jilles@FreeBSD.org>2012-09-05 21:41:05 +0000
commita78b4512de2417c42cb715e4a9749dac0db57870 (patch)
treeab6fbc2386bbf370c267af773fea5b1552266781 /lib/libc/i386/sys/brk.S
parent4076c29bf70fb2f37d9ad4355d79bf316addf0ba (diff)
downloadFreeBSD-src-a78b4512de2417c42cb715e4a9749dac0db57870.zip
FreeBSD-src-a78b4512de2417c42cb715e4a9749dac0db57870.tar.gz
libc/i386: Do not export .cerror.
For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit in the FBSDprivate_1.0 version. It looks like there is no reason for this since it is not used from other libraries. Given that it cannot be accessed from C and its strange calling convention, it is rather unlikely that other things rely on it. Perhaps it is from a time when symbols could not be hidden. Not exporting .cerror causes it to be jumped to directly instead of via the PLT. This change also takes advantage of .cerror's new status by not saving and loading %ebx before jumping to it. (Therefore, .cerror now saves and loads %ebx itself.) Where there was a conditional jump to a jump to .cerror, the conditional jump has been changed to jump to .cerror directly (many modern CPUs don't do static prediction and in any case it is not much of a benefit anyway). This change makes libc.so.7 a few kilobytes smaller. Reviewed by: kib
Diffstat (limited to 'lib/libc/i386/sys/brk.S')
-rw-r--r--lib/libc/i386/sys/brk.S9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/libc/i386/sys/brk.S b/lib/libc/i386/sys/brk.S
index 968e437..8a465d2 100644
--- a/lib/libc/i386/sys/brk.S
+++ b/lib/libc/i386/sys/brk.S
@@ -58,14 +58,11 @@ ENTRY(brk)
ok:
mov $SYS_break,%eax
KERNCALL
- jb err
+ jb HIDENAME(cerror)
movl 4(%esp),%eax
movl %eax,(%edx)
movl $0,%eax
ret
-err:
- PIC_PROLOGUE
- jmp PIC_PLT(HIDENAME(cerror))
#else
@@ -77,13 +74,11 @@ err:
ok:
mov $SYS_break,%eax
KERNCALL
- jb err
+ jb HIDENAME(cerror)
movl 4(%esp),%eax
movl %eax,HIDENAME(curbrk)
movl $0,%eax
ret
-err:
- jmp HIDENAME(cerror)
#endif
END(brk)
OpenPOWER on IntegriCloud