From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3677 invoked by alias); 22 May 2015 14:49:51 -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 3667 invoked by uid 89); 22 May 2015 14:49:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-vn0-f41.google.com Received: from mail-vn0-f41.google.com (HELO mail-vn0-f41.google.com) (209.85.216.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 22 May 2015 14:49:49 +0000 Received: by vnbf1 with SMTP id f1so1417808vnb.6 for ; Fri, 22 May 2015 07:49:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=VsRaEM6kzDYfTUNWY6riRRoktiW3592qJBV2HLVE7QM=; b=McpfzbcTAThD2gDic+ELTTPuWaratMXCMZx9zsfzkXisSMISVaWHHr4cV48y5Z5xA5 kXDIw42xo64WUL5Kz75Z1Y662EJa760HkRCxWXvZRSejP9v+v3bY0i+pPkJT1OT0t01c cV7iMIMD/4Txq9drlihTOk6Ci0GPO5WtEMybEg6mxZDDU99M2t/+YPYELTIp9Hgl4/ZU ONBQPzM9HQBEy85zocQdtUjS3V1u6NUnW9dEKM16SSWtQ2Sx+EAyUyD6Q+H9kD7D24Jh Z6UnBvKZEC+l7l/HPFnCb9fNiZ1jAWGqktx11PLMivqf1FXzI1allbUt38vdJMtPzPzT PqDQ== X-Gm-Message-State: ALoCoQml9HObtj4FlBdCXUqT8IGMmcl2Ppc5ayGjrnmDZ0ol4roycMK9F5XAIQ6og3Pknv8irrTE MIME-Version: 1.0 X-Received: by 10.52.231.102 with SMTP id tf6mr7368652vdc.47.1432306187248; Fri, 22 May 2015 07:49:47 -0700 (PDT) Received: by 10.52.229.196 with HTTP; Fri, 22 May 2015 07:49:47 -0700 (PDT) In-Reply-To: <555EF018.2050309@redhat.com> References: <555E5376.3060706@redhat.com> <555EF018.2050309@redhat.com> Date: Fri, 22 May 2015 15:13:00 -0000 Message-ID: Subject: Re: [RFC][PATCH][X86_64] Eliminate PLT stubs for specified external functions via -fno-plt= From: Sriraman Tallam To: Pedro Alves Cc: "H.J. Lu" , Michael Matz , David Li , GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg02134.txt.bz2 On Fri, May 22, 2015 at 2:00 AM, Pedro Alves wrote: > On 05/21/2015 11:02 PM, Sriraman Tallam wrote: >> On Thu, May 21, 2015 at 2:51 PM, Pedro Alves wrote: >>> On 05/21/2015 10:12 PM, Sriraman Tallam wrote: >>>> >>>> My original proposal, for x86_64 only, was to add >>>> -fno-plt=. This lets the user decide for which >>>> functions PLT must be avoided. Let the compiler always generate an >>>> indirect call using call *func@GOTPCREL(%rip). We could do this for >>>> non-PIC code too. No need for linker fixups since this relies on the >>>> user to know that func is from a shared object. >>> >>> Having to pass function names on the command line seems like an odd >>> interface. E.g, you'll need to pass the mangled name for >>> C++ functions. Any reason this isn't a function attribute? >> >> It is not clear to me where I would stick the attribute. Example >> usage in foo.cc: >> >> #include >> >> int main() { >> int n = memcmp(....); >> } >> >> I want memcmp to not go through PLT, do you propose explicitly >> re-declaring it in foo.cc with the attribute? > > I guess you'd do: > > #include > > __attribute__((no_plt)) typeof (memcpy) memcpy; > > int main() { > int n = memcmp(....); > } > > or even: > > #include > > int main() { > if (hotpath) { > __attribute__((no_plt)) typeof (memcpy) memcpy; > for (..) { > int n = memcmp(....); > } > } else { > int n = memcmp(....); > } > } > > or globally: > > $ cat no-plt/string.h: > #include_next > __attribute__((no_plt)) typeof (memcpy) memcpy; > > $ gcc -I no-plt/ ... That looks good, thanks. Sri > > Thanks, > Pedro Alves >