public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Fangrui Song <maskray@google.com>
To: binutils@sourceware.org, Cary Coutant <ccoutant@gmail.com>
Cc: palves@redhat.com
Subject: Re: [PATCH] gold: Set DF_1_PIE for -pie
Date: Sat, 30 May 2020 17:14:01 -0700	[thread overview]
Message-ID: <20200531001401.hqhslo4xdcyic3kp@google.com> (raw)
In-Reply-To: <20200530220423.186280-1-maskray@google.com>

Drop incorrect CCes...  Sorry, in my git-send-email command

git send-email --to binutils@sourceware.org --to 'Cary Coutant <hidden>' --cc 'Pedro Alves hidden' --validate 0001-gold-Set-DF_1_PIE-for-pie.patch

I forgot to quote Pedro's address with < >

On 2020-05-30, Fangrui Song wrote:
>DF_1_PIE originated from Solaris.
>GNU ld since 5fe2850dd96483f176858fd75c098313d5b20bc2
>sets the flag on non-Solaris platforms.
>
>It can help distinguish PIE from ET_DYN.
>eu-classify from elfutils uses this flag to recognize PIE.
>glibc uses this flag to reject dlopen'ing a PIE (PR glibc/24323).
>
>	PR gold/26039
>	* layout.cc (Layout::finish_dynamic_section): Set DF_1_PIE.
>
>	elfcpp/
>	* elfcpp.h (enum DF_1): New enum member DF_1_PIE.
>---
> elfcpp/elfcpp.h | 3 ++-
> gold/layout.cc  | 2 ++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
>diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
>index 339faadaf3..a1d0090ab6 100644
>--- a/elfcpp/elfcpp.h
>+++ b/elfcpp/elfcpp.h
>@@ -913,7 +913,8 @@ enum DF_1
>   DF_1_INTERPOSE = 0x400,
>   DF_1_NODEFLIB = 0x800,
>   DF_1_NODUMP = 0x1000,
>-  DF_1_CONLFAT = 0x2000
>+  DF_1_CONLFAT = 0x2000,
>+  DF_1_PIE = 0x08000000,
> };
>
> // Version numbers which appear in the vd_version field of a Verdef
>diff --git a/gold/layout.cc b/gold/layout.cc
>index be437f3900..ee75c50cad 100644
>--- a/gold/layout.cc
>+++ b/gold/layout.cc
>@@ -5351,6 +5351,8 @@ Layout::finish_dynamic_section(const Input_objects* input_objects,
>     flags |= elfcpp::DF_1_NOW;
>   if (parameters->options().Bgroup())
>     flags |= elfcpp::DF_1_GROUP;
>+  if (parameters->options().pie())
>+    flags |= elfcpp::DF_1_PIE;
>   if (flags != 0)
>     odyn->add_constant(elfcpp::DT_FLAGS_1, flags);
> }
>-- 
>2.27.0.rc0.183.gde8f92d652-goog
>

  reply	other threads:[~2020-05-31  0:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 22:04 Fangrui Song
2020-05-31  0:14 ` Fangrui Song [this message]
2020-06-14  0:30   ` Cary Coutant
2020-06-14  0:51     ` Fāng-ruì Sòng

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=20200531001401.hqhslo4xdcyic3kp@google.com \
    --to=maskray@google.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    --cc=palves@redhat.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.
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).