[PATCH] Makefile: Use relative paths for debugging symbols.

Rasmus Villemoes rasmus.villemoes at prevas.dk
Sun Aug 28 14:24:28 CEST 2022


On 26/08/2022 22.59, Tom Rini wrote:
> On Thu, Aug 18, 2022 at 10:31:34AM -0700, Vagrant Cascadian wrote:
> 
>> From: Vagrant Cascadian <vagrant at reproducible-builds.org>
>>
>> The KBUILD_CFLAGS and KBUILD_AFLAGS variables are adjusted to use
>> -ffile-prefix-map and --debug-prefix-map, respectively, to use
>> relative paths for occurrences of __FILE__ and debug paths.
>>
>> This enables reproducible builds regardless of the absolute path to
>> the build directory:
>>
>>   https://reproducible-builds.org/docs/build-path/
>>
>> Signed-off-by: Vagrant Cascadian <vagrant at reproducible-builds.org>
>> Acked-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> 
> This needs some sort of clang check and then perhaps different flag
> used? How does the linux kernel handle this?

Well, interestingly it seems that the kernel doesn't do anything like
this for debug info, they only apply the -fmacro-prefix-map. Which one
should probably raise with them at some point.

It seems we're not actually calling gas directly, but always invokes
$(CC) whatever that may be to compile assembler files. So I think the
right fix is to simply pass the same -ffile-prefix-map in both
KBUILD_CFLAGS as in KBUILD_AFLAGS - and if there's some variable that
ends up being included in both automatically, then just adding it there
should do the trick.

Rasmus


More information about the U-Boot mailing list