i386/85242: [patch] libc contains relocation to the .text section
Kostik Belousov
kostikbel at gmail.com
Tue Aug 23 09:00:43 GMT 2005
>Number: 85242
>Category: i386
>Synopsis: [patch] libc contains relocation to the .text section
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-i386
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Aug 23 09:00:39 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Kostik Belousov
>Release: 7-CURRENT
>Organization:
-
>Environment:
FreeBSD deviant.zoral.local 5.4-STABLE FreeBSD 5.4-STABLE #72: Fri Aug 19 11:58:24 EEST 2005 root at deviant.zoral.local:/usr/obj/usr/src/sys/DEVIANT i386
>Description:
All versions of FreeBSD on i386, starting from 5, constain R_386_PC32 relocations against .text in the libc.so. E.g., objdump -p /lib/libc.so shows TEXTREL dynamic entry. This leads to slower load time, since loader needs to remap libc text page rw, make reloc and remap ro; also it wastes a private page per process.
The offender is _ctx_start subroutine from lib/libc/i386/gen/_ctx_start.S. It shall use plt-based addressing of the called symbols for pic code. Attached trivial patch solves the problem. Tested on 7-CURRENT, applicable for 5-, 6- and HEAD branches.
>How-To-Repeat:
>Fix:
--- orig/lib/libc/i386/gen/_ctx_start.S
+++ mod/lib/libc/i386/gen/_ctx_start.S
@@ -45,6 +45,6 @@
* setup stack for completion routine;
* ucp is now at top of stack
*/
- call _ctx_done /* should never return */
- call abort /* fubar */
+ call PIC_PLT(_ctx_done) /* should never return */
+ call PIC_PLT(abort) /* fubar */
ret
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-i386
mailing list