From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m42-4.mailgun.net (m42-4.mailgun.net [69.72.42.4]) by mx.groups.io with SMTP id smtpd.web09.27491.1605013723561960123 for ; Tue, 10 Nov 2020 05:08:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=DJE8QSfw; spf=pass (domain: mg.codeaurora.org, ip: 69.72.42.4, mailfrom: bounce+b068b4.be9e4a-devel=edk2.groups.io@mg.codeaurora.org) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605013723; h=Content-Transfer-Encoding: Content-Type: MIME-Version: Date: Message-ID: Subject: From: To: Sender; bh=XC+2qh2aAYGHs1vLkDA4hWez5hqg3U12hbN9UtVhEXs=; b=DJE8QSfwOEpW1UhN9gdFBvqRaoZvUHYCm45MCkzczaPohPlRba0+EIO60K+Xemjkpt4gg45x JXUPe4LfiLABzKYFsnI4nureJ4nfGrfiT+zOAVjCqIbzRnlB7p/+/4hND4LQP7nUOVnQGyqd fG+Sce63fxqoVIQQVtjJrtdEfg8= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyI3NDFkMyIsICJkZXZlbEBlZGsyLmdyb3Vwcy5pbyIsICJiZTllNGEiXQ== Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-east-1.postgun.com with SMTP id 5faa90dab276b93431526138 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 10 Nov 2020 13:08:42 GMT Sender: mojha=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8CD2DC433C6; Tue, 10 Nov 2020 13:08:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.29.2] (unknown [49.37.87.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mojha) by smtp.codeaurora.org (Postfix) with ESMTPSA id 352C7C433C8; Tue, 10 Nov 2020 13:08:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 352C7C433C8 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=mojha@codeaurora.org To: devel@edk2.groups.io, discuss@edk2.groups.io From: mojha@codeaurora.org Subject: [edk2-devel] : Query regarding IsTextShdr inside Basetools Message-ID: Date: Tue, 10 Nov 2020 18:37:14 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Hi All, I have a doubt about the check we have put inside IsTextShdr() . STATIC BOOLEAN IsTextShdr (   Elf_Shdr *Shdr   ) {   return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); } We are observing one issue where while generate EFI using GenFW in EDK2 because test/data section offset is different than calculated mCoffSectionsOffset when scanning sections. I run GenFW with a failure dll in my local after adding some logs into GenFW. and found that “mCoffSectionsOffset” for data section seems not to have expected value due to “.note.gnu.property” size. Because compiled dll has “.note.gnu.property” section with alloc flag and GenFW thinks that it’s a text section if alloc flag is set. So its size is added to the mCoffSectionsOffset. Could you please give us an advice whether we can fix IsTextShdr() function like below ? --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -229,7 +229,7 @@ IsTextShdr (    Elf_Shdr *Shdr    ) { -  return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC); +  return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_EXECINSTR));^ Thanks, Mukesh