From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 2E885399C03E for ; Fri, 9 Apr 2021 17:17:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2E885399C03E Received: by mail-pj1-x1030.google.com with SMTP id t23so3207893pjy.3 for ; Fri, 09 Apr 2021 10:17:43 -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=uWuEzovkaGJjrKfocHugw1i8XqmjcnIXEFMvN5CRr24=; b=mEN3g5SCoeLU2vbqPKzoatd+PLv4nG67Kk/cSw4uVXl61Z7gMImEp19jJoFVvX0BOq cEs2+Tbaxpzy63XJS4LH7CjO1SHNwva+w55r7xPcEZW/i6uFuDqPOFUoRiwgCCmMxrwd Bhg9P0h7SYZtedLIJRse/GCppBlFEzEspWFojMF34WRp+efe1iG9cN2cnBNTlT3Dg1LP qULSudutAp8K363uGB+4wyboW8mCwDoGOF4+mciWZ10GcPKQzkM6BoWyamvU1v5ezXm6 ffbr66CyDfh/BLcq3En88WIdUl+huRe8dh5lV/cx+hCeDIshwLePwVEkkV39bd0BZCKT KlNw== X-Gm-Message-State: AOAM533dg/8eHw5e59D/LR0BojGZbnITZsifvow2lGOGcoC9fc9AgJlX F41bix5DhNQyBhia1C5bbBmwSL45nNgz5/I78xHxZg== X-Google-Smtp-Source: ABdhPJwsPNEXvzVOiKFPy27i07wSKL0yI6/op4UbQHMg8aVc8zaLNmHS+27Fk4CRY31CbVUfS5rByjjc+K+7lmyJQKc= X-Received: by 2002:a17:90a:9409:: with SMTP id r9mr14624002pjo.157.1617988662311; Fri, 09 Apr 2021 10:17:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: "Carlos O'Donell" Date: Fri, 9 Apr 2021 13:17:31 -0400 Message-ID: Subject: Re: Is there a way to distinguish binary files compiled with -D_FORTIFY_SOURCE=1 and -D_FORTIFY_SOURCE=2? To: Peng Yu Cc: libc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 17:17:44 -0000 On Thu, Apr 8, 2021 at 8:12 PM Peng Yu via Libc-help wrote: > > https://gcc.gnu.org/legacy-ml/gcc-patches/2004-09/msg02055.html > > When I compile a .c file with -D_FORTIFY_SOURCE=1 and > -D_FORTIFY_SOURCE=2, the binary files both contain symbols like > ..._chk@... > > So I can not tell whether _FORTIFY_SOURCE is 1 or 2 just by whether > symbols have ..._chk@.... > > Is there a way to tell the difference only from the binary file? If you want to know about this feature you want to know about all the features. In Fedora and in RHEL we use annobin to answer this question: https://fedoraproject.org/wiki/Changes/Annobin Cheers, Carlos.