Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Aug 2005 08:56:15 GMT
From:      Kostik Belousov <kostikbel@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/85242: [patch] libc contains relocation to the .text section
Message-ID:  <200508230856.j7N8uFQM049173@www.freebsd.org>
Resent-Message-ID: <200508230900.j7N90d7X003608@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200508230856.j7N8uFQM049173>