mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [musl] Static linking is broken after creation of DT_TEXTREL segment
Date: Wed, 29 Jan 2020 16:46:41 -0500	[thread overview]
Message-ID: <20200129214641.GN30412@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAMw0szKYTWd2vbBi7M1Zs7ik=Vi6tWxuNASxtsVwghdi=_zdXA@mail.gmail.com>

On Thu, Jan 30, 2020 at 12:35:52AM +0300, Андрей Аладьев wrote:
> "readelf -d main | grep TEXTREL" returns the same text on both musl and
> glibc containers:
> 
> 0x0000000000000016 (TEXTREL) 0x0
> 0x000000000000001e (FLAGS)     TEXTREL
> 
> "gcc -no-pie" is another workaround for musl container like Rich said. But
> I think that 'set(CMAKE_EXE_LINKER_FLAGS "-static")' will be best cross
> platform solution. As I know "-static" implies "no-pie".

-static normally does not imply -no-pie with musl target. musl was the
first to introduce static pie, and it was not treated as something
special/weird you have to request, just what you get with -static +
-pie or -static and default-pie toolchain.

When GCC upstreamed static pie with glibc support, they made it so
-static overrides -pie and so you need the new -static-pie to get
static pie. musl patches for gcc revert this change since it's a
regression to the original behavior, treats static-pie a second-class,
and does not work with environments where pie is mandatory (like nommu
targets) where default-pie *must* be honored.

Rich

  reply	other threads:[~2020-01-29 21:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 18:41 Андрей Аладьев
2020-01-29 19:19 ` Markus Wichmann
2020-01-29 19:38   ` Markus Wichmann
2020-01-29 20:48     ` Rich Felker
2020-01-29 20:08   ` Андрей Аладьев
2020-01-30 17:02     ` Markus Wichmann
2020-01-31  4:24       ` Rich Felker
2020-01-31 14:47         ` Markus Wichmann
2020-01-31 16:35           ` Rich Felker
2020-01-31 15:16       ` Андрей Аладьев
2020-01-31 16:40         ` Rich Felker
2020-01-31 17:51           ` Андрей Аладьев
2020-01-31 18:01             ` Rich Felker
2020-01-31 19:11               ` Андрей Аладьев
2020-02-03  3:10       ` Rich Felker
2020-02-03  4:05         ` Rich Felker
2020-02-03  4:32         ` Markus Wichmann
2020-02-03  4:40           ` Rich Felker
2020-01-29 20:53 ` Rich Felker
2020-01-29 21:10   ` Szabolcs Nagy
2020-01-29 21:35     ` Андрей Аладьев
2020-01-29 21:46       ` Rich Felker [this message]
2020-01-29 23:10         ` Андрей Аладьев
2020-01-29 23:20       ` Szabolcs Nagy
2020-01-29 21:14   ` Андрей Аладьев
2020-01-29 21:43     ` Rich Felker

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=20200129214641.GN30412@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).