From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 4D1943858D33 for ; Thu, 6 Apr 2023 11:51:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4D1943858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680781918; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=+ZfgY6DFEbDMBr+NWmNI/LGt63IhOWW/8d59avrXp1I=; b=GDVAvGJcbS9ehky3SWx8eJ0zNqgMrYaEGgscKnzFUEdDbL1OlxVK249/EFzlaQhTTTEKgV Y2+ZEqyZpPtfMffAZtYQVfNX+bYwH+TsTgo5FAZFruf8CbglRyukaTI2roiMYnS/faVQbs yyKJvQ+W0pLVCc0YAk8mPKAf43jimMM= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-47-w3XHTroVOOudjRbzy3GVKA-1; Thu, 06 Apr 2023 07:51:54 -0400 X-MC-Unique: w3XHTroVOOudjRbzy3GVKA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 65C093806700; Thu, 6 Apr 2023 11:51:54 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B32318EC6; Thu, 6 Apr 2023 11:51:53 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 336Bppou3998359 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 6 Apr 2023 13:51:51 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 336Bpnvg3998358; Thu, 6 Apr 2023 13:51:49 +0200 Date: Thu, 6 Apr 2023 13:51:49 +0200 From: Jakub Jelinek To: Yash Shinde Cc: gcc-patches@gcc.gnu.org, raj.khem@gmail.com, Yash.Shinde@windriver.com Subject: Re: [PATCH] Add ssp_nonshared to link commandline for musl targets Message-ID: Reply-To: Jakub Jelinek References: <20230406113322.3182296-1-yashinde145@gmail.com> MIME-Version: 1.0 In-Reply-To: <20230406113322.3182296-1-yashinde145@gmail.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Apr 06, 2023 at 05:03:22PM +0530, Yash Shinde via Gcc-patches wrote: > When -fstack-protector options are enabled we need to > link with ssp_shared on musl since it does not provide > the __stack_chk_fail_local() so essentially it provides > libssp but not libssp_nonshared something like > TARGET_LIBC_PROVIDES_SSP_BUT_NOT_SSP_NONSHARED > where-as for glibc the needed symbols > are already present in libc_nonshared library therefore > we do not need any library helper on glibc based systems > but musl needs the libssp_noshared from gcc > > diff --git a/gcc/config/linux.h b/gcc/config/linux.h > index e3aca79cccc..33f9265bb93 100644 > --- a/gcc/config/linux.h > +++ b/gcc/config/linux.h > @@ -189,6 +189,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see > } > #endif > > +#ifdef TARGET_LIBC_PROVIDES_SSP > +#undef LINK_SSP_SPEC > +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all" \ > + "|fstack-protector-strong|fstack-protector-explicit" \ > + ":-lssp_nonshared}" > +#endif This links with -lssp_nonshared even for glibc, that certainly shouldn't be done. Jakub