Skip to contentSkip to conversation

KCFLAGS vs KCPPFLAGS for -fdebug-prefix-map

DISCUSSION Alexander Coffin 2 participants 2 messages Mar 1 – Mar 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello,

From personally building the kernel a few months ago (reproducibly) one of the parts that was incorrect in the docs was that is says to use KCFLAGS when you should use KCPPFLAGS for the following. I had forgotten to report this until now and I'm not sure exactly what is expected to make a patch to the Kernel docs, so I am hoping someone else can do the probably one line fix (or maybe 2 if you count the other reference to KCFLAGS in the file).

Quoted 3 lines

When the kernel is built out-of-tree, debug information may include absolute filenames for the source files. This must be overridden by including the ``-fdebug-prefix-map`` option in the KCFLAGS_ variable.

from Documentation/kbuild/reproducible-builds.rst.

Regards,
Alex Coffin

#1 lore raw

Hi Alex,

Quoted 7 lines · Alexander Coffin

From personally building the kernel a few months ago (reproducibly) one of the parts that was incorrect in the docs was that is says to use KCFLAGS when you should use KCPPFLAGS for the following. I had forgotten to report this until now and I'm not sure exactly what is expected to make a patch to the Kernel docs, so I am hoping someone else can do the probably one line fix (or maybe 2 if you count the other reference to KCFLAGS in the file).

Quoted 5 lines
Quoted 3 lines

When the kernel is built out-of-tree, debug information may include absolute filenames for the source files. This must be overridden by including the ``-fdebug-prefix-map`` option in the KCFLAGS_ variable.

from Documentation/kbuild/reproducible-builds.rst.

Thanks for bringing this up. I assume this is due to the debug information generated in assembler files. While the KCPPFLAGS suggestion works because it is included for both .c and .S compilation, I think it would be more proper to recommend applying '-fdebug-prefix-map' to KAFLAGS in addition to KCFLAGS to insure the flag is only added when truly needed, just as a defensive measure against compiler and Kbuild changes. I can send a patch for this later.

Cheers,
Nathan