mbox series

[v2,0/3] kbuild: always use relative path for __FILE__

Message ID 1507888305-20628-1-git-send-email-yamada.masahiro@socionext.com
Headers show
Series kbuild: always use relative path for __FILE__ | expand

Message

Masahiro Yamada Oct. 13, 2017, 9:51 a.m. UTC
We discussed the __FILE__ problem when U-Boot is built out of tree.
https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html

The deeper your build directory is located, the larger
your U-Boot image becomes.
If your platform has memory footprint limit, this is a problem.

Recently, I submitted the following patches to Kbuild ML.
(no RFC, this time)
https://patchwork.kernel.org/patch/10001419/
https://patchwork.kernel.org/patch/10001409/

I consider them for Linux 4.15 unless there is
a strong objection or a problem report.

This series is a port for U-Boot.

If Tom wants to pick this up earlier, it is OK.
If not in hurry, you can wait for the activity in Linux.
Either will do.


Changes in v2:
  - Rephrase comments for clarification
  - Fix a typo

Masahiro Yamada (2):
  kbuild: add stringify helper to quote a string passed to C files
  kbuild: redefine __FILE__ as relative path from $(srctree) if possible

Michal Marek (1):
  kbuild: Get rid of KBUILD_STR

 Makefile               | 9 +++++++++
 scripts/Kbuild.include | 4 ++++
 scripts/Makefile.lib   | 8 ++++----
 3 files changed, 17 insertions(+), 4 deletions(-)

Comments

Tom Rini Oct. 13, 2017, 12:11 p.m. UTC | #1
On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:

> We discussed the __FILE__ problem when U-Boot is built out of tree.

> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html

> 

> The deeper your build directory is located, the larger

> your U-Boot image becomes.

> If your platform has memory footprint limit, this is a problem.

> 

> Recently, I submitted the following patches to Kbuild ML.

> (no RFC, this time)

> https://patchwork.kernel.org/patch/10001419/

> https://patchwork.kernel.org/patch/10001409/

> 

> I consider them for Linux 4.15 unless there is

> a strong objection or a problem report.

> 

> This series is a port for U-Boot.

> 

> If Tom wants to pick this up earlier, it is OK.

> If not in hurry, you can wait for the activity in Linux.

> Either will do.


Yay.  I plan to pick these up after v2017.11 has been released, so no
need to re-spin this if it stops applying cleanly until we're closer to
release.  Thanks!

-- 
Tom
Masahiro Yamada Oct. 13, 2017, 12:21 p.m. UTC | #2
2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:
> On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:
>
>> We discussed the __FILE__ problem when U-Boot is built out of tree.
>> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html
>>
>> The deeper your build directory is located, the larger
>> your U-Boot image becomes.
>> If your platform has memory footprint limit, this is a problem.
>>
>> Recently, I submitted the following patches to Kbuild ML.
>> (no RFC, this time)
>> https://patchwork.kernel.org/patch/10001419/
>> https://patchwork.kernel.org/patch/10001409/
>>
>> I consider them for Linux 4.15 unless there is
>> a strong objection or a problem report.
>>
>> This series is a port for U-Boot.
>>
>> If Tom wants to pick this up earlier, it is OK.
>> If not in hurry, you can wait for the activity in Linux.
>> Either will do.
>
> Yay.  I plan to pick these up after v2017.11 has been released, so no
> need to re-spin this if it stops applying cleanly until we're closer to
> release.  Thanks!
>

Good.

According to this:
http://phb-crystal-ball.org/

The MW for v4.15 will open 2017-11-12.

So, the next MW for U-Boot and Linux will be almost lined up.

You will be able to apply it more confidently
if Linus pulls the Linux counterpart.

Until then, I will test it in linux-next.
Tom Rini Oct. 13, 2017, 1:53 p.m. UTC | #3
On Fri, Oct 13, 2017 at 09:21:19PM +0900, Masahiro Yamada wrote:
> 2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:

> > On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:

> >

> >> We discussed the __FILE__ problem when U-Boot is built out of tree.

> >> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html

> >>

> >> The deeper your build directory is located, the larger

> >> your U-Boot image becomes.

> >> If your platform has memory footprint limit, this is a problem.

> >>

> >> Recently, I submitted the following patches to Kbuild ML.

> >> (no RFC, this time)

> >> https://patchwork.kernel.org/patch/10001419/

> >> https://patchwork.kernel.org/patch/10001409/

> >>

> >> I consider them for Linux 4.15 unless there is

> >> a strong objection or a problem report.

> >>

> >> This series is a port for U-Boot.

> >>

> >> If Tom wants to pick this up earlier, it is OK.

> >> If not in hurry, you can wait for the activity in Linux.

> >> Either will do.

> >

> > Yay.  I plan to pick these up after v2017.11 has been released, so no

> > need to re-spin this if it stops applying cleanly until we're closer to

> > release.  Thanks!

> >

> 

> Good.

> 

> According to this:

> http://phb-crystal-ball.org/

> 

> The MW for v4.15 will open 2017-11-12.

> 

> So, the next MW for U-Boot and Linux will be almost lined up.

> 

> You will be able to apply it more confidently

> if Linus pulls the Linux counterpart.

> 

> Until then, I will test it in linux-next.


FWIW, a world build is:
https://gist.github.com/trini/ad0f55b9f46997fd11801aac48bf0c10

I wonder why we see size increase in a few cases?  In both cases, the
obj directory is /tmp/something/01_of_.. (or 04_of_..)/current/..

-- 
Tom
Masahiro Yamada Oct. 13, 2017, 5:37 p.m. UTC | #4
2017-10-13 22:53 GMT+09:00 Tom Rini <trini@konsulko.com>:
> On Fri, Oct 13, 2017 at 09:21:19PM +0900, Masahiro Yamada wrote:
>> 2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:
>> > On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:
>> >
>> >> We discussed the __FILE__ problem when U-Boot is built out of tree.
>> >> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html
>> >>
>> >> The deeper your build directory is located, the larger
>> >> your U-Boot image becomes.
>> >> If your platform has memory footprint limit, this is a problem.
>> >>
>> >> Recently, I submitted the following patches to Kbuild ML.
>> >> (no RFC, this time)
>> >> https://patchwork.kernel.org/patch/10001419/
>> >> https://patchwork.kernel.org/patch/10001409/
>> >>
>> >> I consider them for Linux 4.15 unless there is
>> >> a strong objection or a problem report.
>> >>
>> >> This series is a port for U-Boot.
>> >>
>> >> If Tom wants to pick this up earlier, it is OK.
>> >> If not in hurry, you can wait for the activity in Linux.
>> >> Either will do.
>> >
>> > Yay.  I plan to pick these up after v2017.11 has been released, so no
>> > need to re-spin this if it stops applying cleanly until we're closer to
>> > release.  Thanks!
>> >
>>
>> Good.
>>
>> According to this:
>> http://phb-crystal-ball.org/
>>
>> The MW for v4.15 will open 2017-11-12.
>>
>> So, the next MW for U-Boot and Linux will be almost lined up.
>>
>> You will be able to apply it more confidently
>> if Linus pulls the Linux counterpart.
>>
>> Until then, I will test it in linux-next.
>
> FWIW, a world build is:
> https://gist.github.com/trini/ad0f55b9f46997fd11801aac48bf0c10
>
> I wonder why we see size increase in a few cases?  In both cases, the
> obj directory is /tmp/something/01_of_.. (or 04_of_..)/current/..
>


Hmm, this patch seems buggy.

At least, it is not working at all for SPL.

I will take a look.
Masahiro Yamada Oct. 13, 2017, 6:35 p.m. UTC | #5
2017-10-13 22:53 GMT+09:00 Tom Rini <trini@konsulko.com>:
> On Fri, Oct 13, 2017 at 09:21:19PM +0900, Masahiro Yamada wrote:
>> 2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:
>> > On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:
>> >
>> >> We discussed the __FILE__ problem when U-Boot is built out of tree.
>> >> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html
>> >>
>> >> The deeper your build directory is located, the larger
>> >> your U-Boot image becomes.
>> >> If your platform has memory footprint limit, this is a problem.
>> >>
>> >> Recently, I submitted the following patches to Kbuild ML.
>> >> (no RFC, this time)
>> >> https://patchwork.kernel.org/patch/10001419/
>> >> https://patchwork.kernel.org/patch/10001409/
>> >>
>> >> I consider them for Linux 4.15 unless there is
>> >> a strong objection or a problem report.
>> >>
>> >> This series is a port for U-Boot.
>> >>
>> >> If Tom wants to pick this up earlier, it is OK.
>> >> If not in hurry, you can wait for the activity in Linux.
>> >> Either will do.
>> >
>> > Yay.  I plan to pick these up after v2017.11 has been released, so no
>> > need to re-spin this if it stops applying cleanly until we're closer to
>> > release.  Thanks!
>> >
>>
>> Good.
>>
>> According to this:
>> http://phb-crystal-ball.org/
>>
>> The MW for v4.15 will open 2017-11-12.
>>
>> So, the next MW for U-Boot and Linux will be almost lined up.
>>
>> You will be able to apply it more confidently
>> if Linus pulls the Linux counterpart.
>>
>> Until then, I will test it in linux-next.
>
> FWIW, a world build is:
> https://gist.github.com/trini/ad0f55b9f46997fd11801aac48bf0c10
>
> I wonder why we see size increase in a few cases?  In both cases, the
> obj directory is /tmp/something/01_of_.. (or 04_of_..)/current/..
>


Figured out.


This patch changes the string in some places
where BUG() etc. is used in functions
included from another .c file.

For example,

drivers/usb/gadget/composite.c is included from
drivers/usb/gadget/g_dnl.c


The BUG_ON() in composite_unbind(),
previously printed drivers/usb/gadget/composite.c,
but will print drivers/usb/gadget/g_dnl.c with this patch.

This is the cause of slight increase/decrease.

Then, I do not have a solution...
Tom Rini Oct. 13, 2017, 9:39 p.m. UTC | #6
On Sat, Oct 14, 2017 at 03:35:23AM +0900, Masahiro Yamada wrote:
> 2017-10-13 22:53 GMT+09:00 Tom Rini <trini@konsulko.com>:

> > On Fri, Oct 13, 2017 at 09:21:19PM +0900, Masahiro Yamada wrote:

> >> 2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:

> >> > On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:

> >> >

> >> >> We discussed the __FILE__ problem when U-Boot is built out of tree.

> >> >> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html

> >> >>

> >> >> The deeper your build directory is located, the larger

> >> >> your U-Boot image becomes.

> >> >> If your platform has memory footprint limit, this is a problem.

> >> >>

> >> >> Recently, I submitted the following patches to Kbuild ML.

> >> >> (no RFC, this time)

> >> >> https://patchwork.kernel.org/patch/10001419/

> >> >> https://patchwork.kernel.org/patch/10001409/

> >> >>

> >> >> I consider them for Linux 4.15 unless there is

> >> >> a strong objection or a problem report.

> >> >>

> >> >> This series is a port for U-Boot.

> >> >>

> >> >> If Tom wants to pick this up earlier, it is OK.

> >> >> If not in hurry, you can wait for the activity in Linux.

> >> >> Either will do.

> >> >

> >> > Yay.  I plan to pick these up after v2017.11 has been released, so no

> >> > need to re-spin this if it stops applying cleanly until we're closer to

> >> > release.  Thanks!

> >> >

> >>

> >> Good.

> >>

> >> According to this:

> >> http://phb-crystal-ball.org/

> >>

> >> The MW for v4.15 will open 2017-11-12.

> >>

> >> So, the next MW for U-Boot and Linux will be almost lined up.

> >>

> >> You will be able to apply it more confidently

> >> if Linus pulls the Linux counterpart.

> >>

> >> Until then, I will test it in linux-next.

> >

> > FWIW, a world build is:

> > https://gist.github.com/trini/ad0f55b9f46997fd11801aac48bf0c10

> >

> > I wonder why we see size increase in a few cases?  In both cases, the

> > obj directory is /tmp/something/01_of_.. (or 04_of_..)/current/..

> >

> 

> 

> Figured out.

> 

> 

> This patch changes the string in some places

> where BUG() etc. is used in functions

> included from another .c file.

> 

> For example,

> 

> drivers/usb/gadget/composite.c is included from

> drivers/usb/gadget/g_dnl.c

> 

> 

> The BUG_ON() in composite_unbind(),

> previously printed drivers/usb/gadget/composite.c,

> but will print drivers/usb/gadget/g_dnl.c with this patch.

> 

> This is the cause of slight increase/decrease.

> 

> Then, I do not have a solution...


Ah yes, this was the potential complication with going down this path...
Thanks!

-- 
Tom
Masahiro Yamada Oct. 15, 2017, 9:48 a.m. UTC | #7
2017-10-14 6:39 GMT+09:00 Tom Rini <trini@konsulko.com>:
> On Sat, Oct 14, 2017 at 03:35:23AM +0900, Masahiro Yamada wrote:
>> 2017-10-13 22:53 GMT+09:00 Tom Rini <trini@konsulko.com>:
>> > On Fri, Oct 13, 2017 at 09:21:19PM +0900, Masahiro Yamada wrote:
>> >> 2017-10-13 21:11 GMT+09:00 Tom Rini <trini@konsulko.com>:
>> >> > On Fri, Oct 13, 2017 at 06:51:42PM +0900, Masahiro Yamada wrote:
>> >> >
>> >> >> We discussed the __FILE__ problem when U-Boot is built out of tree.
>> >> >> https://www.mail-archive.com/u-boot@lists.denx.de/msg242852.html
>> >> >>
>> >> >> The deeper your build directory is located, the larger
>> >> >> your U-Boot image becomes.
>> >> >> If your platform has memory footprint limit, this is a problem.
>> >> >>
>> >> >> Recently, I submitted the following patches to Kbuild ML.
>> >> >> (no RFC, this time)
>> >> >> https://patchwork.kernel.org/patch/10001419/
>> >> >> https://patchwork.kernel.org/patch/10001409/
>> >> >>
>> >> >> I consider them for Linux 4.15 unless there is
>> >> >> a strong objection or a problem report.
>> >> >>
>> >> >> This series is a port for U-Boot.
>> >> >>
>> >> >> If Tom wants to pick this up earlier, it is OK.
>> >> >> If not in hurry, you can wait for the activity in Linux.
>> >> >> Either will do.
>> >> >
>> >> > Yay.  I plan to pick these up after v2017.11 has been released, so no
>> >> > need to re-spin this if it stops applying cleanly until we're closer to
>> >> > release.  Thanks!
>> >> >
>> >>
>> >> Good.
>> >>
>> >> According to this:
>> >> http://phb-crystal-ball.org/
>> >>
>> >> The MW for v4.15 will open 2017-11-12.
>> >>
>> >> So, the next MW for U-Boot and Linux will be almost lined up.
>> >>
>> >> You will be able to apply it more confidently
>> >> if Linus pulls the Linux counterpart.
>> >>
>> >> Until then, I will test it in linux-next.
>> >
>> > FWIW, a world build is:
>> > https://gist.github.com/trini/ad0f55b9f46997fd11801aac48bf0c10
>> >
>> > I wonder why we see size increase in a few cases?  In both cases, the
>> > obj directory is /tmp/something/01_of_.. (or 04_of_..)/current/..
>> >
>>
>>
>> Figured out.
>>
>>
>> This patch changes the string in some places
>> where BUG() etc. is used in functions
>> included from another .c file.
>>
>> For example,
>>
>> drivers/usb/gadget/composite.c is included from
>> drivers/usb/gadget/g_dnl.c
>>
>>
>> The BUG_ON() in composite_unbind(),
>> previously printed drivers/usb/gadget/composite.c,
>> but will print drivers/usb/gadget/g_dnl.c with this patch.
>>
>> This is the cause of slight increase/decrease.
>>
>> Then, I do not have a solution...
>
> Ah yes, this was the potential complication with going down this path...
> Thanks!
>

I marked them Rejected except 1/3.

1/3 is a stable commit imported from Linux.