From 9a17a136439c200b13a69d453f38824b7edc522c Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 18 Jun 2020 10:46:18 +0100 Subject: [PATCH] [PATCH] gold: Set DF_1_PIE for -pie 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/ChangeLog | 5 +++++ elfcpp/elfcpp.h | 3 ++- gold/ChangeLog | 5 +++++ gold/layout.cc | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog index a0d1e0061eb..dc37f65bab4 100644 --- a/elfcpp/ChangeLog +++ b/elfcpp/ChangeLog @@ -1,3 +1,8 @@ +2020-06-18 Fangrui Song + + PR gold/26039 + * elfcpp.h (enum DF_1): New enum member DF_1_PIE. + 2020-06-06 Alan Modra * powerpc.h: Rename diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h index 339faadaf3f..9c7c6294e42 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/ChangeLog b/gold/ChangeLog index d429e9debb3..f4679f9a646 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2020-06-18 Fangrui Song + + PR gold/26039 + * layout.cc (Layout::finish_dynamic_section): Set DF_1_PIE. + 2020-06-16 Alan Modra * testsuite/discard_locals_test.c: Replace uses of asm with __asm__. diff --git a/gold/layout.cc b/gold/layout.cc index b3b0c5701d3..0c7be85240e 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -5352,6 +5352,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.30.2