From owner-freebsd-hackers@FreeBSD.ORG Sat Jan 10 14:25:09 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6DC5216A4CE for ; Sat, 10 Jan 2004 14:25:09 -0800 (PST) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id D83B943D73 for ; Sat, 10 Jan 2004 14:24:41 -0800 (PST) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 4CA2F5C74C; Sat, 10 Jan 2004 14:24:41 -0800 (PST) Date: Sat, 10 Jan 2004 14:24:41 -0800 From: Alfred Perlstein To: Dag-Erling Sm?rgrav Message-ID: <20040110222441.GS9623@elvis.mu.org> References: <20040110050033.GP9623@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i cc: hackers@freebsd.org Subject: Re: help with linking please X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jan 2004 22:25:09 -0000 * Dag-Erling Sm?rgrav [040110 03:17] wrote: > Alfred Perlstein writes: > > I'm having a hell of a time doing this so I can produce a static > > .o or .a with most of the symbols stripped. Two problems seem to be > > that even if I use "ld -r -o main.o obj1.o obj2.c libfoo.a" then I > > can not strip symbols in obj1.o that are referenced from obj2.o > > even after I combine the object files. > > You can link all your object files into one: > > $ ld -r -o all.o foo.o bar.o baz.o > > then strip unwanted symbols with {objcopy,strip} -N (or better yet, > use {objcopy,strip} -K to strip all symbols except the ones you want > to export) > > this is precisely what we do with klds to reduce namespace pollution. It will refuse to strip symbols if: foo.o:func1() references bar.o:func2(). But I need it to. -- - Alfred Perlstein - Research Engineering Development Inc. - email: bright@mu.org cell: 408-480-4684