mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] kbuild: use -fmacro-prefix-map to make __FILE__ a relative path
Date: Mon, 12 Aug 2019 09:02:59 +0200	[thread overview]
Message-ID: <20190812070259.smq4wxhsxqlxdt4e@pengutronix.de> (raw)
In-Reply-To: <20190807164808.15228-1-yamada.masahiro@socionext.com>

On Thu, Aug 08, 2019 at 01:48:08AM +0900, Masahiro Yamada wrote:
> Linux commit a73619a845d5625079cc1b3b820f44c899618388
> 
> The __FILE__ macro is used everywhere in the kernel to locate the file
> printing the log message, such as WARN_ON(), etc.  If the kernel is
> built out of tree, this can be a long absolute path, like this:
> 
>   WARNING: CPU: 1 PID: 1 at /path/to/build/directory/arch/arm64/kernel/foo.c:...
> 
> This is because Kbuild runs in the objtree instead of the srctree,
> then __FILE__ is expanded to a file path prefixed with $(srctree)/.
> 
> Commit 9da0763bdd82 ("kbuild: Use relative path when building in a
> subdir of the source tree") improved this to some extent; $(srctree)
> becomes ".." if the objtree is a child of the srctree.
> 
> For other cases of out-of-tree build, __FILE__ is still the absolute
> path.  It also means the kernel image depends on where it was built.
> 
> 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 and
> more reproducible builds.
> 
> Please note __FILE__ is always an absolute path for external modules.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>  Makefile | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2019-08-12  7:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 16:48 Masahiro Yamada
2019-08-12  7:02 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190812070259.smq4wxhsxqlxdt4e@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox