From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id B14323861841 for ; Mon, 31 Aug 2020 13:46:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B14323861841 Received: by mail-lj1-x22b.google.com with SMTP id v12so6735109ljc.10 for ; Mon, 31 Aug 2020 06:46:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=qB0u9bHa6ox5KmaYB/Gw/QiaNXjl9+pSQpbJZjUIJ1E=; b=Hbmy3EZbmGJQZBb7qhw86ofJHKw57vdfPNOgbpwykm4kk4lOaMxisHipiJQ/EBxRoz VBAIlDGXc6GlIPk3TVTaL3dW7faEnOz5++xdZnLzQoTmTRfJ4vQvdW7N4GScHHUTIop6 zvyo34LNdN+xd0CYo+vsnnInrBVjq2O6/5+0ZgarWtwZQqdhMCERhD/lzgofsZf6VJlY Awm+cRcTnNSv3dflWXeo13FLNCKhYvUoKlnPbjIPAREeFAG+j1NicQvcT7aOfMGxOg+7 I3m7Cw4qs1qBJxmvIcThH/afIH4X3v42mg/FhPfkf9pGQsgb071inMF0E5xZQ3xX6Yp5 hT2w== X-Gm-Message-State: AOAM533zjzMEN4jc0WUsoOEJdXyXJgzDnuKa+Yr9iNwAzeMawVUYEUVr 6Ze7B7zADDCu5oQ1tcDWdtcEl6XZu28QMckPxBrICksqi6oOVw== X-Google-Smtp-Source: ABdhPJxWX/pQ22vMN/TFx3eeMV6hbOv0yP4TIGqT+y/Ep8yuVb/zhbzZ4oPSebDzeA7ibQjMz88FdDZJTBR+lH1PscY= X-Received: by 2002:a2e:9019:: with SMTP id h25mr733020ljg.186.1598881563149; Mon, 31 Aug 2020 06:46:03 -0700 (PDT) MIME-Version: 1.0 References: <20200831115859.mwcruabbzoj3x4w7@jozef-acer-manjaro> <875z8zj95u.fsf@oldenburg2.str.redhat.com> In-Reply-To: <875z8zj95u.fsf@oldenburg2.str.redhat.com> From: James Y Knight Date: Mon, 31 Aug 2020 09:45:36 -0400 Message-ID: Subject: Re: [RFC] Proposal for new ELF extension - "Symbol meta-information" To: Florian Weimer Cc: Jozef Lawrynowicz , gnu-gabi@sourceware.org X-Spam-Status: No, score=-18.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gnu-gabi@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnu-gabi mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 13:46:06 -0000 On Mon, Aug 31, 2020 at 8:24 AM Florian Weimer via Gnu-gabi < gnu-gabi@sourceware.org> wrote: > > 3.3.3 SMT_PRINTF_FMT use case > > Can this achieved in C++ with a library-only solution? So that > printf ("%s", str); > and > printf ("%f", num); > resolve to different printf symbols externally? > The LLVM backend optimizer already does this automatically for XCore, TCE, and Emscripten targets, without interrogating the format string, or adding anything to the object format. On all three: if there are no floating-point arguments to the call, it will translate {s,f,}printf -> i{s,f,}printf. Otherwise, on emscripten only, if there are no 128-bit float arguments, it will translate {s,f,}printf -> small_{s,f,}printf MSVC (and therefore also LLVM targeting windows) uses a slightly different scheme: the compiler emits a reference to a global "_fltused" whenever there's any floating-point instructions in the program (related to printf or not). Then, the undefined reference to that symbol pulls in the floating-point support for printf/scanf in the MS libc.