Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1648301ybt; Thu, 18 Jun 2020 13:49:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy429NdbSymm+Olf1j9FUojv47lVYn8qV07mXuhDvKwdk9oFfj9caPe8s906K64xCdFkdwH X-Received: by 2002:a17:906:4b50:: with SMTP id j16mr521732ejv.415.1592513393634; Thu, 18 Jun 2020 13:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592513393; cv=none; d=google.com; s=arc-20160816; b=IYTCab6Duc9QiPDVflLV5jJlU2FNIBnwjybX+vOvbSV8axxLfksQz9WhUzBMmPcgDA 0B+Thmh4niwNAitC/otX3F138meuSv6F1G8GK+3BHVY1W6njWwvY2fPVh+JacHa1mUZ6 6fLB9wtDHcwW3T4rrzQ5+yXOhu321jElBe0uJ1yayeRFMQP36qNd9qDCC3C2pFM5VicK fAGSgJEQoZ8ZvQs3SSFr9Bzt0BsYQunMthPvcC7CA+iU2IkimgIt/LgxMtnOCdn1hO2u fRIcKTPhW20qMSPZgB7DRUgOtOgcs0vX7BNmA5ApYSn4l2oWFBgykKHl1Lc1GdX+xXId Ps2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zESy7BaVwbwl2xh2hdg/CsuYuZgKeXvMFJM9Mco674M=; b=jFh6+iAzvZPwMXeatZTXtb++ARO2LRLMYzP+iRhiUulWvNrlH3U6k4q1rbN88M59Ic xI8Irf5NqwKllGmUYdRRSnMtYoLGIedymgGPE+1NTIwCYjGFP2vAGyzfwx9s2I5+CMgD 39yYQpQuTDPbA9WAScJxLzz5UZZm1jmBCmO2f7xZPeww2tV8qnj7Z0u8oM7z+bgx06gq V2Y0/U2LNwmrCQTjW5r1fWThSmun0B/elbUJnKEAvq3Hzps7tPADAE4zU2TT5dR/pBDj YawQAisza8h1LVg28t721+A452S3umuE1Y32cqCGqr765Uia07mQ9nFFaKIV2uVfCP+o KMIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si2550412ejd.527.2020.06.18.13.49.31; Thu, 18 Jun 2020 13:49:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732299AbgFRUkp (ORCPT + 99 others); Thu, 18 Jun 2020 16:40:45 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:10226 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731487AbgFRUjm (ORCPT ); Thu, 18 Jun 2020 16:39:42 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Thu, 18 Jun 2020 13:39:36 -0700 Received: from sc9-mailhost2.vmware.com (unknown [10.129.221.29]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 8014CB2659; Thu, 18 Jun 2020 16:39:39 -0400 (EDT) From: Matt Helsley To: CC: Josh Poimboeuf , Peter Zijlstra , Steven Rostedt , Julien Thierry , Kamalesh Babulal , Matt Helsley Subject: [RFC][PATCH v5 47/51] objtool: mcount: Merge section mcount flags Date: Thu, 18 Jun 2020 13:38:33 -0700 Message-ID: X-Mailer: git-send-email 2.25.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII Received-SPF: None (EX13-EDG-OU-001.vmware.com: mhelsley@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org One flag is only for relocation sections and the other only for text (not relocation) sections so we can share the same flag and test the section type when we need to. Signed-off-by: Matt Helsley --- tools/objtool/elf.c | 5 ++--- tools/objtool/elf.h | 2 +- tools/objtool/mcount.c | 9 ++++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index 3708f85fe36d..12bd889a62ba 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -384,8 +384,7 @@ static int read_sections(struct elf *elf) } sec->len = sec->sh.sh_size; - sec->mcounted = is_mcounted_section_name(sec->name); - sec->relocs_mcountable = false; + sec->mcountable = is_mcounted_section_name(sec->name); list_add_tail(&sec->list, &elf->sections); elf_hash_add(elf->section_hash, &sec->hash, sec->idx); @@ -642,7 +641,7 @@ static int read_relocs(struct elf *elf) } sec->base->reloc = sec; - sec->relocs_mcountable = relocs_mcountable(sec); + sec->mcountable = relocs_mcountable(sec); nr_reloc = 0; for (i = 0; i < sec->sh.sh_size / sec->sh.sh_entsize; i++) { diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index 92d3e68abf59..fb10f470d1a4 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -39,7 +39,7 @@ struct section { char *name; int idx; unsigned int len; - bool changed, text, rodata, noinstr, mcounted, relocs_mcountable; + bool changed, text, rodata, noinstr, mcountable; }; enum symbol_class { diff --git a/tools/objtool/mcount.c b/tools/objtool/mcount.c index 9cd52beed871..80daf0e17eab 100644 --- a/tools/objtool/mcount.c +++ b/tools/objtool/mcount.c @@ -279,7 +279,10 @@ static void tot_relsize(unsigned int *rel_entsize) const struct section *sec; list_for_each_entry(sec, &lf->sections, list) { - if (sec->relocs_mcountable) + if (sec->sh.sh_type != SHT_REL && + sec->sh.sh_type != SHT_RELA) + continue; + if (sec->mcountable) *rel_entsize = sec->sh.sh_entsize; } } @@ -419,13 +422,13 @@ static int do_mcount(unsigned const reltype, size_t rela_size) sec->sh.sh_type != SHT_RELA) continue; /* Which may relocate mcount calls.. */ - if (!sec->relocs_mcountable) + if (!sec->mcountable) continue; txts = sec->base; if (!txts) continue; - if (txts->mcounted) { + if (txts->mcountable) { /* In mcountable text sections */ unsigned long recval = 0; unsigned int recsym; -- 2.20.1