public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Florian Weimer <fweimer@redhat.com>
Cc: Samuel Thibault <sthibault@debian.org>,
	libc-alpha@sourceware.org, glibc@packages.debian.org
Subject: Re: static pie: confusion between _DYNAMIC, crt1.o, Scrt1.o
Date: Mon, 24 Oct 2022 21:41:51 +0545	[thread overview]
Message-ID: <Y1a1w+ajIQlSGBO8@vapier> (raw)
In-Reply-To: <877d0p5vbz.fsf@oldenburg.str.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]

On 24 Oct 2022 13:12, Florian Weimer via Libc-alpha wrote:
> * Samuel Thibault:
> > Florian Weimer, le lun. 24 oct. 2022 12:11:03 +0200, a ecrit:
> >> * Samuel Thibault:
> >> 
> >> > Is it not possible to make -static -pie get the same behavior? That'd be
> >> > way more orthogonal for people to understand.
> >> 
> >> I think you want -static to mean -static-pie if GCC defaults to PIE,
> >> right?
> >
> > That would actually provide the pie benefit automatically for all
> > static executable, yes. Otherwise static pie will be a nice thing, but
> > not actually largely used in practice. And most people won't actually
> > realize it.
> 
> That's true.
> 
> Fedora uses a specs file fragment that turns -static into -static-pie
> under certain conditions.
> 
> >> That will break a few things that use gcc -static to build binaries for
> >> quasi-bare-metal targets using the GNU ELF toolchain (where glibc's
> >> startup code is not use).
> >
> > But then the piece which is saying that glibc's startup code is not in
> > use can be fixed into not using static-pie, can't it?
> 
> In theory, yes.  How hard it will be depends on the specs file change
> for --enable-default-pie.

i don't see a problem with -static DTRT.  people abusing a compiler for a
target it wasn't designed for means they get the pieces.  it's not like
they're using -static in the first place to pull in the C library & gcc
internal libs (which also depend/assume the corresponding OS & C lib).

plus, -static -no-pie would get you back to a non-PIE static binary.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-10-24 17:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-22 14:06 Samuel Thibault
2022-10-22 14:25 ` Xi Ruoyao
2022-10-22 14:45   ` Samuel Thibault
2022-10-23  2:08     ` Xi Ruoyao
2022-10-23  9:43       ` Samuel Thibault
2022-10-24 10:11     ` Florian Weimer
2022-10-24 10:33       ` Samuel Thibault
2022-10-24 11:12         ` Florian Weimer
2022-10-24 15:56           ` Mike Frysinger [this message]
2022-10-24 17:36             ` Florian Weimer

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=Y1a1w+ajIQlSGBO8@vapier \
    --to=vapier@gentoo.org \
    --cc=fweimer@redhat.com \
    --cc=glibc@packages.debian.org \
    --cc=libc-alpha@sourceware.org \
    --cc=sthibault@debian.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).