From patchwork Sun Dec 11 19:21:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 87610 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp1312556qgi; Sun, 11 Dec 2016 11:21:53 -0800 (PST) X-Received: by 10.84.178.195 with SMTP id z61mr180855912plb.176.1481484113557; Sun, 11 Dec 2016 11:21:53 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id d7si41086405plj.99.2016.12.11.11.21.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Dec 2016 11:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-444103-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-444103-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-444103-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=pPZpXPtc8zMJQ7LIfg9fZ0wRkvnMVCJh9PRhkLi4qaokOsFp4b JTdXqEhd3Sxy8g+tlteNxA/mvdYZORHF5tysS94OROelffVHFx9kaZ1FqyUs4lUW PSM1wlmhe6VQBSZVa/UoG2HmxTm8mCvB2QHNiESDi4xSmchSFy7JPFOpc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=JRbS2KUz4+tIukkXBmbTZwU6bUM=; b=ZY0u5ZNlElP1lxirOklP RjJN22hF6WQwVesXkAYbyhlgNooxDTNgY60GPiaLHdb/iwDgQ1vI5KoSt5svth+9 UgdQxcxCYwUu8mPQvEB8EDQm4Ju+ZNzos6jygw5UnofUXA4akfbGzvUVhEe3Xfla pJoVAOhlEMJRYVSCxLDytTk= Received: (qmail 19717 invoked by alias); 11 Dec 2016 19:21:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19691 invoked by uid 89); 11 Dec 2016 19:21:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPAM_SUBJECT1, SPF_PASS, URIBL_RED autolearn=no version=3.3.2 spammy=6000, dialects, sk:sandra, 481, 7 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Dec 2016 19:21:26 +0000 Received: from svr-orw-mbx-03.mgc.mentorg.com ([147.34.90.203]) by relay1.mentorg.com with esmtp id 1cG9gZ-0004fx-Jx from Sandra_Loosemore@mentor.com for gcc-patches@gcc.gnu.org; Sun, 11 Dec 2016 11:21:23 -0800 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 11 Dec 2016 11:21:20 -0800 To: "gcc-patches@gcc.gnu.org" From: Sandra Loosemore Subject: [patch, doc] Move -pthread documentation to linker options Message-ID: <584DA72F.6090800@codesourcery.com> Date: Sun, 11 Dec 2016 12:21:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 X-ClientProxiedBy: svr-orw-mbx-01.mgc.mentorg.com (147.34.90.201) To svr-orw-mbx-03.mgc.mentorg.com (147.34.90.203) PR 16519 notes that -pthread has only ever been documented as an RS6000 and Solaris 2 option. In fact it's supported by most/all(?) POSIX-flavored targets, including GNU/Linux, BSD variants, Darwin, etc. It's probably best to document it as a generic option, with the expectation that GCC supports -pthread if the underlying operating system or C library provides an implementation of the POSIX threads API. After scratching my head about it, it seemed that it's best categorized as a linker option even though it also affects the preprocessor on some targets. I'll wait a day or two before committing the attached patch, in case anybody wants to argue that this is the wrong way to categorize it. -Sandra Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 243520) +++ gcc/doc/invoke.texi (working copy) @@ -481,7 +481,7 @@ Objective-C and Objective-C++ Dialects}. @item Linker Options @xref{Link Options,,Options for Linking}. @gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol --nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol +-nostartfiles -nodefaultlibs -nostdlib -pie -pthread -rdynamic @gol -s -static -static-libgcc -static-libstdc++ @gol -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol -static-libmpx -static-libmpxwrappers @gol @@ -1012,7 +1012,7 @@ See RS/6000 and PowerPC Options. -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol -mprototype -mno-prototype @gol -msim -mmvme -mads -myellowknife -memb -msdata @gol --msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol +-msdata=@var{opt} -mvxworks -G @var{num} @gol -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol -mno-recip-precision @gol -mveclibabi=@var{type} -mfriz -mno-friz @gol @@ -1085,7 +1085,7 @@ See RS/6000 and PowerPC Options. @emph{Solaris 2 Options} @gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol --pthreads -pthread} +-pthreads} @emph{SPARC Options} @gccoptlist{-mcpu=@var{cpu-type} @gol @@ -11526,6 +11526,14 @@ or model suboptions) when you specify th @opindex no-pie Don't produce a position independent executable. +@item -pthread +@opindex pthread +Link with the POSIX threads library. This option is supported on +GNU/Linux targets, most other Unix derivatives, and also on +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 -rdynamic @opindex rdynamic Pass the flag @option{-export-dynamic} to the ELF linker, on targets @@ -22040,11 +22048,6 @@ reliably associate function call with ar TLS optimization, which in turn allows GCC to better schedule the sequence. -@item -pthread -@opindex pthread -Adds support for multithreading with the @dfn{pthreads} library. -This option sets flags for both the preprocessor and linker. - @item -mrecip @itemx -mno-recip @opindex mrecip @@ -23186,14 +23189,7 @@ These switches are supported in addition @table @gcctabopt @item -pthreads @opindex pthreads -Add support for multithreading using the POSIX threads library. This -option sets flags for both the preprocessor and linker. This option does -not affect the thread safety of object code produced by the compiler or -that of libraries supplied with it. - -@item -pthread -@opindex pthread -This is a synonym for @option{-pthreads}. +This is a synonym for @option{-pthread}. @end table @node SPARC Options