Received: by 10.192.165.148 with SMTP id m20csp4312836imm; Tue, 8 May 2018 06:35:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpFCK4Rzuyo5hIzefO9wwM7JSx4xvm9u4nYsGLaSR/ZBNJlhXN5N7pv8NBGftiIzA46gFGC X-Received: by 2002:a17:902:8602:: with SMTP id f2-v6mr15162240plo.5.1525786517951; Tue, 08 May 2018 06:35:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525786517; cv=none; d=google.com; s=arc-20160816; b=QaXls0njc/5g9qEU7A0VLzddHIq0nZfE23+lIVbH0xmW+SjrdbktO2fxsxLJZuczSS an5NJOZhzxNRgkCitxTfdcdBQSVU2neC53jYzR5A2J+6n8pm8gBZLH91MMJCnnyt7uyb nA72PLDpFJD2LR74S82EldibpHtpnuki/F0CSLWToVE3yD50Ina40SH2Z45grG+/BD36 BfW9/8lzvugKQi8/Ku8kSJopOiJUvYcDhbts5JjMK/BYxkoOBGL653yxxYfO4i/U7x3j WGhzu8fXKsnmBw0BV3O1wnG8JRqvEz6sUIMm3ve6jmWLGWtP6Bw+IzyJm48Th8ly/ol/ Xw4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=XWlG/yaiNf+OF5LFXMfhCD7n1iz5YdMpC1uaOKktrmE=; b=QBuqgaLLjPoZDM1WkXgbb9CirnAHYmE7fuwShHFXFna+30YY/H63y4N0QDVfYJuRC9 cOsMfwsXhSJHakgPGUGjy60aBjm7auqDrNzK7Q5CjQXC7dAgSYkr7oSF34hyzRZ9xCnF 0jc5ZfAEWhDHYLOB/7bI039Zbm4dU6nwze/VUtHKPcev7H0psLQlX6rPrk2tbhiDm6u1 tO0Ty4bFNU2ZTeHp8pP3TViV53feK2LJtBZRKMy2HgHoRcaxPzusg0sfj4V0C16g3foy 1a6W9CEarTIoXbgK9XyMZeEo1eK/8W5ZyOuMau125kvIkkfYViNHKv0pTPrnf+GKxt+e 3K0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si24813691pfg.114.2018.05.08.06.35.03; Tue, 08 May 2018 06:35:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932127AbeEHNeu (ORCPT + 99 others); Tue, 8 May 2018 09:34:50 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49754 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754932AbeEHNet (ORCPT ); Tue, 8 May 2018 09:34:49 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C01DA2025; Tue, 8 May 2018 13:34:49 +0000 (UTC) Received: from treble (ovpn-124-150.rdu2.redhat.com [10.10.124.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E01D0AFD5A; Tue, 8 May 2018 13:34:48 +0000 (UTC) Date: Tue, 8 May 2018 08:34:47 -0500 From: Josh Poimboeuf To: Greg KH Cc: damian , peterz@infradead.org, linux-kernel@vger.kernel.org Subject: Re: Kernel build with gcc 8 a lot of warnings Message-ID: <20180508133226.uwjbx44fwlxgyzu5@treble> References: <20180505192112.GA18728@zrhn9910b> <20180507045453.leou4zypnlcck4vr@treble> <20180508055126.GA18724@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180508055126.GA18724@kroah.com> User-Agent: NeoMutt/20180323 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 08 May 2018 13:34:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 08 May 2018 13:34:49 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 08, 2018 at 07:51:26AM +0200, Greg KH wrote: > On Sun, May 06, 2018 at 11:54:53PM -0500, Josh Poimboeuf wrote: > > On Sat, May 05, 2018 at 09:21:12PM +0200, damian wrote: > > > Helllo together, > > > > > > Hello everybody, > > > > > > is something special to note when kernel build with gcc 8? I receive various warnings from the objtool: > > > With GCC 7 works all fine. > > > > > > kernel/cgroup/cgroup.o: warning: objtool: parse_cgroup_root_flags()+0x40: sibling call from callable instruction with modified stack frame > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_addrm_files()+0x2a3: sibling call from callable instruction with modified stack frame > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_apply_control_enable()+0x20b: sibling call from callable instruction with modified stack frame > > > kernel/cgroup/cgroup.o: warning: objtool: rebind_subsystems()+0x296: sibling call from callable instruction with modified stack frame > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_sk_alloc_disable()+0x10: sibling call from callable instruction with modified stack frame > > > kernel/cgroup/cgroup.o: warning: objtool: parse_cgroup_root_flags.cold.45()+0xa: call without frame pointer save/setup > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_addrm_files.cold.46()+0x17: call without frame pointer save/setup > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_apply_control_enable.cold.47()+0x24: call without frame pointer save/setup > > > kernel/cgroup/cgroup.o: warning: objtool: rebind_subsystems.cold.48()+0x10: call without frame pointer save/setup > > > kernel/cgroup/cgroup.o: warning: objtool: cgroup_sk_alloc_disable.cold.49()+0x7: call without frame pointer save/setup > > > CC kernel/cgroup/stat.o > > > CC [M] arch/x86/kvm/../../../virt/kvm/kvm_main.o > > > arch/x86/kernel/acpi/boot.o: warning: objtool: acpi_register_lapic()+0x10: sibling call from callable instruction with modified stack frame > > > arch/x86/kernel/acpi/boot.o: warning: objtool: acpi_map_cpu()+0x2c: sibling call from callable instruction with modified stack frame > > > arch/x86/kernel/acpi/boot.o: warning: objtool: acpi_register_lapic.cold.6()+0x7: call without frame pointer save/setup > > > arch/x86/kernel/acpi/boot.o: warning: objtool: acpi_map_cpu.cold.7()+0x7: call without frame pointer save/setup > > > > Thanks, this is a known issue with GCC 8 that I haven't gotten a chance > > to fix yet. They're related to the fact that GCC 8 is splitting out > > 'unlikely' code into 'cold' subfunctions in .text.unlikely. > > > > I've got some old patches that fix it. Now that GCC 8 is out, I'll need > > get the patches dusted off and cleaned up for merging. > > Any pointers to these patches? Archi linux just changed their default > compiler to gcc 8 and now I'm seeing this in my local builds :( I'm still dusting the code off, but this fixes most of the warnings. The rest of the code should hopefully be ready soon. From: Josh Poimboeuf Subject: [PATCH] objtool: Detect GCC 8 cold subfunctions GCC 8 moves a lot of unlikely code out of line to "cold" subfunctions in .text.unlikely. Properly detect the new subfunctions and treat them as extensions of the original functions. This fixes a bunch of warnings like: kernel/cgroup/cgroup.o: warning: objtool: parse_cgroup_root_flags()+0x33: sibling call from callable instruction with modified stack frame kernel/cgroup/cgroup.o: warning: objtool: cgroup_addrm_files()+0x290: sibling call from callable instruction with modified stack frame kernel/cgroup/cgroup.o: warning: objtool: cgroup_apply_control_enable()+0x25b: sibling call from callable instruction with modified stack frame kernel/cgroup/cgroup.o: warning: objtool: rebind_subsystems()+0x325: sibling call from callable instruction with modified stack frame Reported-by: Arnd Bergmann Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 7 ++++--- tools/objtool/elf.c | 3 +++ tools/objtool/elf.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 264522d4e4af..a8b3a8613b5e 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1753,7 +1753,6 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, while (1) { next_insn = next_insn_same_sec(file, insn); - if (file->c_file && func && insn->func && func != insn->func) { WARN("%s() falls through to next function %s()", func->name, insn->func->name); @@ -1869,7 +1868,9 @@ static int validate_branch(struct objtool_file *file, struct instruction *first, case INSN_JUMP_UNCONDITIONAL: if (insn->jump_dest && (!func || !insn->jump_dest->func || - func == insn->jump_dest->func)) { + func == insn->jump_dest->func || + insn->func->subfunc || + insn->jump_dest->func->subfunc)) { ret = validate_branch(file, insn->jump_dest, state); if (ret) @@ -2064,7 +2065,7 @@ static int validate_functions(struct objtool_file *file) for_each_sec(file, sec) { list_for_each_entry(func, &sec->symbol_list, list) { - if (func->type != STT_FUNC) + if (func->type != STT_FUNC || func->subfunc) continue; insn = find_insn(file, sec, func->offset); diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index c1c338661699..0c0c7ab4a014 100644 --- a/tools/objtool/elf.c +++ b/tools/objtool/elf.c @@ -260,6 +260,9 @@ static int read_symbols(struct elf *elf) sym->offset = sym->sym.st_value; sym->len = sym->sym.st_size; + if (sym->type == STT_FUNC && strstr(sym->name, ".cold.")) + sym->subfunc = true; + /* sorted insert into a per-section list */ entry = &sym->sec->symbol_list; list_for_each_prev(tmp, &sym->sec->symbol_list) { diff --git a/tools/objtool/elf.h b/tools/objtool/elf.h index d86e2ff14466..dc411f9859b1 100644 --- a/tools/objtool/elf.h +++ b/tools/objtool/elf.h @@ -61,6 +61,7 @@ struct symbol { unsigned char bind, type; unsigned long offset; unsigned int len; + bool subfunc; }; struct rela { -- 2.17.0