From patchwork Mon Mar 30 17:42:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Dasmohapatra X-Patchwork-Id: 38665 Return-Path: X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by sourceware.org (Postfix) with ESMTPS id 1E02A385B836 for ; Mon, 30 Mar 2020 17:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1E02A385B836 Received: from noise.collabora.co.uk (unknown [IPv6:2a00:5f00:102:0:c0a7:51ff:feaf:e642]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 8F6082966E1; Mon, 30 Mar 2020 18:42:16 +0100 (BST) From: =?utf-8?q?Vivek_Das=C2=A0Mohapatra?= To: vivek@etla.org, libc-alpha@sourceware.org Subject: [RFC][PATCH 6/6] Implement and document DF_1_UNIQUE handling in gold Date: Mon, 30 Mar 2020 18:42:07 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-27.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Mar 2020 17:42:20 -0000 --- gold/layout.cc | 2 ++ gold/options.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/gold/layout.cc b/gold/layout.cc index be437f3900..d97ac57afc 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().unique()) + flags |= elfcpp::DF_1_UNIQUE; if (flags != 0) odyn->add_constant(elfcpp::DT_FLAGS_1, flags); } diff --git a/gold/options.h b/gold/options.h index b2059d984c..de151642c7 100644 --- a/gold/options.h +++ b/gold/options.h @@ -1459,6 +1459,9 @@ class General_options DEFINE_bool(interpose, options::DASH_Z, '\0', false, N_("Mark object to interpose all DSOs but executable"), NULL); + DEFINE_bool(unique, options::DASH_Z, '\0', false, + N_("Mark DSO to be loaded at most once, and only in the main namespace"), + NULL); DEFINE_bool_alias(lazy, now, options::DASH_Z, '\0', N_("Mark object for lazy runtime binding"), NULL, true);