From owner-freebsd-i386@FreeBSD.ORG Tue Aug 23 09:00:43 2005 Return-Path: X-Original-To: freebsd-i386@hub.freebsd.org Delivered-To: freebsd-i386@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 449FD16A420 for ; Tue, 23 Aug 2005 09:00:43 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id DACE443D45 for ; Tue, 23 Aug 2005 09:00:39 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j7N90dtI003609 for ; Tue, 23 Aug 2005 09:00:39 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j7N90d7X003608; Tue, 23 Aug 2005 09:00:39 GMT (envelope-from gnats) Resent-Date: Tue, 23 Aug 2005 09:00:39 GMT Resent-Message-Id: <200508230900.j7N90d7X003608@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-i386@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Kostik Belousov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 30CB916A41F for ; Tue, 23 Aug 2005 08:56:16 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id EE9F543D46 for ; Tue, 23 Aug 2005 08:56:15 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j7N8uFs3049175 for ; Tue, 23 Aug 2005 08:56:15 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id j7N8uFQM049173; Tue, 23 Aug 2005 08:56:15 GMT (envelope-from nobody) Message-Id: <200508230856.j7N8uFQM049173@www.freebsd.org> Date: Tue, 23 Aug 2005 08:56:15 GMT From: Kostik Belousov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: i386/85242: [patch] libc contains relocation to the .text section X-BeenThere: freebsd-i386@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: I386-specific issues for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2005 09:00:43 -0000 >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: