Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 2002 02:56:21 +0600
From:      Max Khon <fjoe@iclub.nsu.ru>
To:        Jake Burkholder <jake@locore.ca>
Cc:        current@FreeBSD.ORG
Subject:   Re: libc size
Message-ID:  <20021106025621.A78377@iclub.nsu.ru>
In-Reply-To: <20021105152757.Y22677@locore.ca>; from jake@locore.ca on Tue, Nov 05, 2002 at 03:27:57PM -0500
References:  <3DC1AB26.5020708@acm.org> <20021103155858.3be6eda9.flynn@energyhq.homeip.net> <3DC6CB56.8090809@acm.org> <20021104215734.GA47193@dragon.nuxi.com> <20021105125454.A51180@iclub.nsu.ru> <20021105021823.T22677@locore.ca> <20021105132142.A52607@iclub.nsu.ru> <20021105120833.V22677@locore.ca> <20021106002050.A72989@iclub.nsu.ru> <20021105152757.Y22677@locore.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
hi, there!

On Tue, Nov 05, 2002 at 03:27:57PM -0500, Jake Burkholder wrote:

> > Are you talking about STATICOBJS and SHOBJS? This is how libpam is built
> > right now. You have different sets object files in shared and static
> > versions of libpam. Please take a look at src/lib/libpam/libpam/Makefile
> > and corresponding /usr/share/mk bits.
> 
> What I was referring to is a trick to force the linker to generate
> a dynamic binary with all the usual elf dynamic tables, but which is
> actually statically linked.
> 
> eg:
> 
> > cat test.c
> int
> main(void)
> {
>         printf("hello world\n");
> }
> > cc -static -Wl,-r -o test test.c
> > touch hack.c
> > cc -shared -o hack.So hack.c
> > ld -o test1 test /home/jake/hack.So 
> > ./test1
> hello world
> > 
> 
> Conceivably this would allow dlopen to work on the main program, and is
> what we do to allow the kernel to link klds against itself.  But you
> also need to do something about the .interp section that gets put in,
> and the .dynamic, .dynsym and .dynstr sections aren't free.
 
Got it. But this will not solve the problem. All the symbols
in statically linked executable are resolved at linking stage
and there is no information in it that libdl can use in find_symdef()
(if we strip the executable. Do we want unstripped executables?).
Patching binutils is not easy and I doubt that someone would like to do this.

/fjoe


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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