From patchwork Mon Apr 16 04:18:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 898448 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=socionext.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nifty.com header.i=@nifty.com header.b="USlNJ74b"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40PZsd0yTrz9ry1 for ; Mon, 16 Apr 2018 14:19:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 22A8CC21DCA; Mon, 16 Apr 2018 04:19:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id EB631C21C27; Mon, 16 Apr 2018 04:19:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D3FA5C21BE5; Mon, 16 Apr 2018 04:19:35 +0000 (UTC) Received: from conuserg-10.nifty.com (conuserg-10.nifty.com [210.131.2.77]) by lists.denx.de (Postfix) with ESMTPS id E9D29C21C27 for ; Mon, 16 Apr 2018 04:19:33 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id w3G4IbDD024944; Mon, 16 Apr 2018 13:18:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w3G4IbDD024944 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1523852318; bh=47jTY7cP3fQh2h+HbljLN0O+k5b/wmQlp3VIFiRbPjA=; h=From:To:Cc:Subject:Date:From; b=USlNJ74bGfSKMb79Ev+Yh7fmA9gdTJPSP6+qC1Bxu1r7JA930c5ru9r27fRB3lVnt K4nqXMMOdP2ZB0l8uB4OwzVVejFqx1LSxe8R+rcYl67lWTb/Y5hE3Uwa9uwsFPPb// Gj/fNjFBK2htwPE95OlFqzI4nn5u4FPz4wgEpzpixo6YygAQ0rasFZtSOu0+S+rQEt qPN/ULRhiZHfq6ZbkVu1uBJmK267E93PUSXfPWVpb/tZhCO3cj7X5yU3AcjDgaexEO XhodRddtbc+lrHAzCB6E2A+b+X/ycFBdG0Y+p/bDWutgCowujHO+sXUHkWZzHVKDta rhr+Ui5cn6D0w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 16 Apr 2018 13:18:31 +0900 Message-Id: <1523852311-15588-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Tom Rini , Stephen Warren , Andre Przywara , Jagan Teki Subject: [U-Boot] [PATCH] kbuild: use -fmacro-prefix-map to make __FILE__ a relative path X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The __FILE__ macro is used everywhere in U-Boot to locate the file printing the log message, such as WARN_ON(), etc. If U-Boot is built out of tree, this can be a long absolute path. This is because Kbuild runs in the objtree instead of the srctree, then __FILE__ is expanded to a file path prefixed with $(srctree)/. A brand-new option from GCC, -fmacro-prefix-map, solves this problem. If your compiler supports it, __FILE__ is the relative path from the srctree regardless of O= option. This provides more readable log, more reproducible builds, and smaller image size. [ Linux commit: a73619a845d5625079cc1b3b820f44c899618388 ] Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- GCC 8 is required to use this new option. Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 5cfe43f..243add1 100644 --- a/Makefile +++ b/Makefile @@ -595,6 +595,9 @@ endif KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector) KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks) +# change __FILE__ to the relative path from the srctree +KBUILD_CFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=) + KBUILD_CFLAGS += -g # $(KBUILD_AFLAGS) sets -g, which causes gcc to pass a suitable -g # option to the assembler.