gcc: amend __FILE__ mangling patch to only affect -fmacro-prefix-map=#285662
Merged
marsam merged 1 commit intoNixOS:stagingfrom Feb 19, 2024
Merged
Conversation
13 tasks
symphorien
reviewed
Feb 2, 2024
Member
symphorien
left a comment
There was a problem hiding this comment.
The message of the patch mentions debug symbols but as far as I understand this is now outdated.
THe initial intent of the change was to only affect
`-fmacro-prefix-map=` option.
Due to the bug of `if (maps == macro_prefix_maps)` condition of initial
setting all three of:
static file_prefix_map *macro_prefix_maps; /* -fmacro-prefix-map */
static file_prefix_map *debug_prefix_maps; /* -fdebug-prefix-map */
static file_prefix_map *profile_prefix_maps; /* -fprofile-prefix-map */
matches the comparison and applied the mangling (as long as on options
were passed into those before).
As a result not only (intended) `__FILE__` embedding happened in `.data`
section, but also (unintended) debugging symbols (`-fdebug-prefix-map`)
and profiling data (`-fprofile-prefix-map`) were broken by mangling.
The patch update fixes it by explicitly passing a boolean that controls
the mangling in a single call site relevant to `-fmacro-prefix-map`.
While at it fixed `int / size_t` mismatch that caused build failure on
upcoming `gcc-14`.
Tested as:
- `nix` still has no `nlohmann_json` retention
- `gdb` can now resolve `stdc++` debugging symbols in templates
- `--coverage` has working source file paths
5c72622 to
be41f86
Compare
Contributor
Author
Good catch! Dropped mention of debugging symbols. |
symphorien
approved these changes
Feb 3, 2024
marsam
approved these changes
Feb 18, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
THe initial intent of the change was to only affect
-fmacro-prefix-map=option.Due to the bug of
if (maps == macro_prefix_maps)condition of initial setting all three of:matches the comparison and applied the mangling (as long as on options were passed into those before).
As a result not only (intended)
__FILE__embedding happened in.datasection, but also (unintended) debugging symbols (-fdebug-prefix-map) and profiling data (-fprofile-prefix-map) were broken by mangling.The patch update fixes it by explicitly passing a boolean that controls the mangling in a single call site relevant to
-fmacro-prefix-map.While at it fixed
int / size_tmismatch that caused build failure on upcominggcc-14.Tested as:
nixstill has nonlohmann_jsonretentiongdbcan now resolvestdc++debugging symbols in templates--coveragehas working source file pathsDescription of changes
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.