mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Youren Shen <shenyouren@gmail.com>
Cc: musl@lists.openwall.com
Subject: Re: [BUG] Force to use a dynamic linker in musl-clang wapper cause a crash for static-pie c++ programs.
Date: Tue, 24 Dec 2019 10:03:31 -0500	[thread overview]
Message-ID: <20191224150331.GX1666@brightrain.aerifal.cx> (raw)
In-Reply-To: <CAHu4ykg6K9wBU8dF3gkjC1LCK3UrH9xQxuodD8VepA7P=Qf7Wg@mail.gmail.com>

On Tue, Dec 24, 2019 at 10:38:49PM +0800, Youren Shen wrote:
> Hey, there,
> Recently I'm trying to build a non-gnu toolchain with musl, clang, llvm,
> libc++, compiler-rt. While static-pie feature is very useful in our
> project, musl-clang force to link a dynamic linker into the binary. This
> behavior will cause a crash in c++ programs with compiler-rt and libc++.
> For more details and reproduction of this bug, you can read my previous
> email to llvm-dev mail lists.[1]
> I spend a few days to find the reason -- in function _dlstart_c, the
> program will get a "base" of relocation in /lib/ld-musl-x86_64.so.1, which
> is not right when it tries to relocate .rel.dyn section in the binary.
> Overall, the static-pie program does not need a dynamic linker at all. So
> maybe we should remove this argument in wrapper when static-pie is enabled.
> 
> Thank you very much.
> 
> [1]. https://groups.google.com/forum/#!msg/llvm-dev/XPrSPqD2zjM/YtH6Fi2YAgAJ

I don't think the wrappers (gcc or clang one) have been updated with
logic for static pie since it was added, and I'm not sure how easy it
is to add. I'd welcome patches for review, though.

Rich


  reply	other threads:[~2019-12-24 15:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-24 14:38 Youren Shen
2019-12-24 15:03 ` Rich Felker [this message]
2019-12-25 10:37   ` Youren Shen
2019-12-26  4:46     ` Fangrui Song

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=20191224150331.GX1666@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=shenyouren@gmail.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).