Re: __FILE__ gets expanded to absolute pathname

From: Michael Tokarev
Date: Tue Apr 25 2006 - 07:50:59 EST


Denis Vlasenko wrote:
> Sometime ago I noticed that __FILE__ gets expanded into
> *absolute* pathname if one builds kernel in separate object directory.
>
> I thought a bit about it but failed to arrive at any sensible
> solution.
>
> Any thoughs?
> --
> vda
>
> # strings vmlinux | grep /usr/src
> /.share/usr/src2/kernel/linux-2.6.16.via-rhine.src/drivers/net/3c505.c
> /.share/usr/src2/kernel/linux-2.6.16.via-rhine.src/arch/i386/kernel/time.c
....

As far as I remember, this happens when compiling with O=xxx only, ie,
only when specifying alternative object (or source) directory. Normally
(when you compile in the source directory) they'll be like drivers/net/3c505.c,
arch/i386/kernel/time.c etc, ie, relative to the kernel top source dir.
It's because when you specify O= etc, complete source dir is passed from
makefiles, instead of relative one.

But it was long time since I switched to symlink-tree + compile instead of
compiling with O=, and things may had changed since that.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/