From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40801 invoked by alias); 1 Aug 2018 16:14:41 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 40755 invoked by uid 89); 1 Aug 2018 16:14:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=pie, D*io, UD:gcc.c, gol X-HELO: mailrelay3-3.pub.mailoutpod1-cph3.one.com Received: from mailrelay3-3.pub.mailoutpod1-cph3.one.com (HELO mailrelay3-3.pub.mailoutpod1-cph3.one.com) (46.30.212.12) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 Aug 2018 16:14:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carewolf.com; s=20140924; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding; bh=KFzFzEpPoT7XAh4AMbom0fB3jHYPaVNiv4fdn6nCFTY=; b=zaaOpn9pGIaoN2rqnRE48mxNFpXQj7q4zrdHnqG6j/S/5l1j8gf1eK5x8HZobb7tqDuBPVlJntTAX 08iGkzIbdVqV1yl8i7/+d2bh80fI1h/0kwygm1Dk9j6vPixaz6RoTyeBVWDtX7WTbOZl4l5XL8VzHV cF4AxscknpjG2N4Y= X-HalOne-Cookie: 7cf5468de6e0c426ff81eddcfd999528a603521b X-HalOne-ID: f822de03-95a5-11e8-80ba-d0431ea8bb03 Received: from twilight.localnet (unknown [62.220.2.194]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id f822de03-95a5-11e8-80ba-d0431ea8bb03; Wed, 01 Aug 2018 16:14:30 +0000 (UTC) From: Allan Sandfeld Jensen To: gcc-patches@gcc.gnu.org Subject: [Patch][GCC] Document and fix -r (partial linking) Date: Wed, 01 Aug 2018 16:14:00 -0000 Message-ID: <5835862.YDeY9hZc7r@twilight> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart56789398.4RmXjoufqb" Content-Transfer-Encoding: 7Bit X-IsSubscribed: yes X-SW-Source: 2018-08/txt/msg00116.txt.bz2 This is a multi-part message in MIME format. --nextPart56789398.4RmXjoufqb Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 393 The option has existed and been working for years, make sure it implies the right extra options, and list it in the documentation. 2018-08-01 Allan Sandfeld Jensen gcc/doc * invoke.texi: Document -r gcc/ * gcc.c: Correct default specs for -r --- gcc/doc/invoke.texi | 7 ++++++- gcc/gcc.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) --nextPart56789398.4RmXjoufqb Content-Disposition: inline; filename="0001-Fix-and-document-r-option.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Fix-and-document-r-option.patch" Content-length: 2879 >From 638966e6c7e072ca46c6af0664fbd57bedbfff80 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 1 Aug 2018 18:07:05 +0200 Subject: [PATCH] Fix and document -r option The option has existed and been working for years, make sure it implies the right extra options, and list it in the documentation. 2018-07-29 Allan Sandfeld Jensen gcc/doc * invoke.texi: Document -r gcc/ * gcc.c: Correct default specs for -r --- gcc/doc/invoke.texi | 7 ++++++- gcc/gcc.c | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6047d82065a..7da30bd9d99 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -518,7 +518,7 @@ Objective-C and Objective-C++ Dialects}. @xref{Link Options,,Options for Linking}. @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol -nostartfiles -nodefaultlibs -nolibc -nostdlib @gol --pie -pthread -rdynamic @gol +-pie -pthread -r -rdynamic @gol -s -static -static-pie -static-libgcc -static-libstdc++ @gol -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol -shared -shared-libgcc -symbolic @gol @@ -12444,6 +12444,11 @@ x86 Cygwin and MinGW targets. On some targets this option also sets flags for the preprocessor, so it should be used consistently for both compilation and linking. +@item -r +@opindex r +Produce a relocatable object as output. This is also known as partial +linking. + @item -rdynamic @opindex rdynamic Pass the flag @option{-export-dynamic} to the ELF linker, on targets diff --git a/gcc/gcc.c b/gcc/gcc.c index 780d4859ef3..858a5600c14 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -675,7 +675,7 @@ proper position among the other output files. */ /* config.h can define LIB_SPEC to override the default libraries. */ #ifndef LIB_SPEC -#define LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" +#define LIB_SPEC "%{!shared|!r:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" #endif /* When using -fsplit-stack we need to wrap pthread_create, in order @@ -797,7 +797,7 @@ proper position among the other output files. */ /* config.h can define STARTFILE_SPEC to override the default crt0 files. */ #ifndef STARTFILE_SPEC #define STARTFILE_SPEC \ - "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}" + "%{!shared|!r:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}}" #endif /* config.h can define ENDFILE_SPEC to override the default crtn files. */ @@ -936,7 +936,7 @@ proper position among the other output files. */ #else #define LD_PIE_SPEC "" #endif -#define LINK_PIE_SPEC "%{static|shared|r:;" PIE_SPEC ":" LD_PIE_SPEC "} " +#define LINK_PIE_SPEC "%{static|shared|r|ar:;" PIE_SPEC ":" LD_PIE_SPEC "} " #endif #ifndef LINK_BUILDID_SPEC -- 2.17.0 --nextPart56789398.4RmXjoufqb--