Skip to contentSkip to conversation

GCC patch Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch

DISCUSSION Tomasz Meresinski 2 participants 2 messages Sep 21, 2016

lore
Share & tools
lore
#0 lore raw

Hi
I found some difficulties when compiling some of our internal applications because of gcc patch called "Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch" As far as I can see it makes __FILE__ macro to point to Yocto source file location not build system's.

Now let me describe that problem:
1) CMake script gets source directory (so it's build system path)
2) CMake calculates its length and adds it as a define to application (call it LEN)
3) A simple way to get a filename from __FILE__ macro is to compute __FILE__ + LEN
4) Crash

Is this patch really a big deal?

Tomasz Meresiński

#1 lore raw
Quoted 16 lines · Tomasz Meresinski

Hi
I found some difficulties when compiling some of our internal applications because of gcc patch called "Reuse-fdebug-prefix-map-to-replace-ffile-prefix-map.patch" As far as I can see it makes __FILE__ macro to point to Yocto source file location not build system's.

Now let me describe that problem:
1) CMake script gets source directory (so it's build system path)
2) CMake calculates its length and adds it as a define to application
(call it LEN)
3) A simple way to get a filename from __FILE__ macro is to compute __FILE__ + LEN
4) Crash

Quoted 1 line

Is this patch really a big deal?

Without it, build paths get encoded into the binaries. This means the binaries differ depending on where they're built, it also means those paths can be exposed to end users which can be confusing and doesn't match the debug source locations used on target.

If you don't care about those things, its not a big deal. Personally, I do believe that reproducible binaries are important though. I think cmake is making some assumptions here it shouldn't.

Cheers,

Richard