From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: static musl-based gdb and -fPIC
Date: Sun, 20 Apr 2014 16:31:40 -0400 [thread overview]
Message-ID: <20140420203140.GA26358@brightrain.aerifal.cx> (raw)
In-Reply-To: <5353FDD0.6090903@midipix.org>
On Sun, Apr 20, 2014 at 01:03:12PM -0400, writeonce@midipix.org wrote:
> Greetings,
>
> While building a statically linked musl-based gdb, ld asked that
> libc.a be recompiled with -fPIC.
This is a bug in the gdb build process. Despite your request for a
static gdb, it's trying to build a shared library for something.
There's a way to disable it (IIRC --disable-gdbserver is a big hammer
that can do it, and there might be a more fine-grained approach) but
the real issue is that the build process is broken and doing something
that can't work.
> After recompiling musl with the
> above flag, gdb built successfully. The reason I wanted to have a
> static gdb (other than the trivial ones) was to be able to debug a
> musl-based python. The distribution's gdb has a dynamic dependency
> on a glibc-based libpython, and the two friends don't play well
> together.
>
> Now that the static gdb is up and running, my questions are:
>
> 1) is there any reason not to "always" compile musl with -fPIC, at
> least on x86_64?
Compare the .lo and .o files. I think you'll find the .lo files are a
considerably more bloated and slower -- not as bad as on 32-bit x86,
but still undesirable.
Some users will want to use -fPIC even for static linking to be able
to produce static PIE binaries, but this is not a mainstream usage
(there's not even any official toolchain support for it, just a local
hack I posted to the list a year or two back) and not something we
would want to impose on everyone.
> 2) is there any reason to revert to the old build of libc.so?
> Although I rebuilt musl because of libc.a, it turns out that the
> -fPIC flag also helped libc.so become much smaller: 699299 bytes,
> instead of 2767910 bytes (musl v1.0.0, binutils v2.24). Any other
> factors to consider?
You must have done something else like disabling debugging info at the
same time.
Rich
next prev parent reply other threads:[~2014-04-20 20:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-20 17:03 writeonce
2014-04-20 20:29 ` writeonce
2014-04-20 20:31 ` Rich Felker [this message]
2014-04-20 21:39 ` writeonce
2014-04-21 7:33 ` Szabolcs Nagy
2014-04-21 8:21 ` Szabolcs Nagy
2014-04-21 11:16 ` writeonce
2014-04-21 11:16 ` writeonce
2014-04-29 21:40 ` writeonce
2014-04-30 2:57 ` Rich Felker
2014-04-30 3:26 ` writeonce
2014-04-30 4:07 ` Rich Felker
2014-04-30 4:29 ` Zvi Gilboa
2014-05-22 20:14 ` John Spencer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140420203140.GA26358@brightrain.aerifal.cx \
--to=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).