Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jan 2004 14:24:41 -0800
From:      Alfred Perlstein <alfred@freebsd.org>
To:        Dag-Erling Sm?rgrav <des@des.no>
Cc:        hackers@freebsd.org
Subject:   Re: help with linking please
Message-ID:  <20040110222441.GS9623@elvis.mu.org>
In-Reply-To: <xzp3caojbo5.fsf@dwp.des.no>
References:  <20040110050033.GP9623@elvis.mu.org> <xzp3caojbo5.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help
* Dag-Erling Sm?rgrav <des@des.no> [040110 03:17] wrote:
> Alfred Perlstein <alfred@freebsd.org> 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



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