zyfeier opened a new pull request, #21604:
URL: https://github.com/apache/nuttx/pull/21604

   TASKING cctc has no `-fmacro-prefix-map` equivalent, so with the CMake build
   every `__FILE__` site (assert/panic/debug messages) embeds the full absolute
   source path into `.rodata`, which both bloats the binary and makes builds
   non-reproducible across working directories.
   
   `CONFIG_OUTPUT_STRIP_PATHS` already provides path stripping for the GCC
   toolchain but was gated on `ARCH_TOOLCHAIN_GNU`. This opens it up for the
   TASKING toolchain and implements the equivalent behavior for cctc by
   overriding `CMAKE_C_COMPILE_OBJECT`: cd into the code root and sed-strip the
   absolute prefix before invoking the compiler, so `__FILE__` embeds short
   relative paths instead. The `-fmacro-prefix-map` injection in
   `cmake/nuttx_toolchain.cmake` gains a TASKING exclusion accordingly, since
   cctc does not accept that flag; the existing MSVC and GHS guards are kept
   unchanged.
   
   CMake's built-in Tasking support (CMake >= 3.28) injects a build-dir-relative
   `--dep-file=<DEP_FILE>` into the compile rule, which would break after the
   `cd`; the template therefore rewrites the dep-file argument to an absolute
   path (older CMake without the depfile injection is unaffected).
   
   ## Testing
   
   * `triboard_tc4x9_com:nsh` (GCC): builds OK, binary byte-identical to master
   * `a2g-tc397-5v-tft:nsh` (GCC): builds OK, binary byte-identical to master
   * `triboard_tc4x9_com:nsh` with `CONFIG_TRICORE_TOOLCHAIN_TASKING=y`
     (TASKING SmartCode cctc v10.4, CMake 3.28 + Ninja): full build passes, and
     `.rodata` contains zero absolute source paths (previously every `__FILE__`
     site embedded the full build path); residual absolute paths only remain in
     debug info, matching the GCC behavior which maps macros but not debug paths
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to