From 4888c4aba5a1eaca0f0b9f4ec2ab7008c2fc103b Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Thu, 13 Dec 2018 19:40:12 +0000 Subject: [llvm-size][libobject] Add explicit "inTextSegment" methods similar to "isText" section methods to calculate size correctly. Summary: llvm-size uses "isText()" etc. which seem to indicate whether the section contains code-like things, not whether or not it will actually go in the text segment when in a fully linked executable. The unit test added (elf-sizes.test) shows some types of sections that cause discrepencies versus the GNU size tool. llvm-size is not correctly reporting sizes of things mapping to text/data segments, at least for ELF files. This fixes pr38723. Reviewers: echristo, Bigcheese, MaskRay Reviewed By: MaskRay Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54369 llvm-svn: 349074 --- llvm/tools/llvm-size/llvm-size.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/tools/llvm-size') diff --git a/llvm/tools/llvm-size/llvm-size.cpp b/llvm/tools/llvm-size/llvm-size.cpp index a92a8ab25a1..be1e5bb7268 100644 --- a/llvm/tools/llvm-size/llvm-size.cpp +++ b/llvm/tools/llvm-size/llvm-size.cpp @@ -457,8 +457,8 @@ static void printObjectSectionSizes(ObjectFile *Obj) { // Make one pass over the section table to calculate sizes. for (const SectionRef &Section : Obj->sections()) { uint64_t size = Section.getSize(); - bool isText = Section.isText(); - bool isData = Section.isData(); + bool isText = Section.isBerkeleyText(); + bool isData = Section.isBerkeleyData(); bool isBSS = Section.isBSS(); if (isText) total_text += size; -- cgit v1.2.3