Skip to content

[Debugging] Use __TEXT segment for DebugDescription macro #71639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 16, 2024

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Feb 15, 2024

The data emitted by DebugDescriptionMacro is constant. For that reason, it was placed in __DATA_CONST. However, this causes a problem with the linker, which emits an error if the __DATA_CONST segment is not marked SG_READ_ONLY.

After discussion, it was pointed out that if the constant data has no fixups, then it can and should be in the the __TEXT segment. The __DATA_CONST segment is for data that is essentially constant but contains dyld fixups.

There are no fixups in the summar records, which makes `__TEXT` a more
appropriate segment.
@kastiglione
Copy link
Contributor Author

@swift-ci smoke test

@kastiglione kastiglione merged commit 63e42a4 into main Feb 16, 2024
@kastiglione kastiglione deleted the dl/lldbsummaries-text-section branch February 16, 2024 15:49
kastiglione added a commit that referenced this pull request Feb 21, 2024
Introduces the first use of `@_DebugDescription` in the standard library, applying it 
to `ObjectIdentifier`. In order to use the DebugDescription macro in the stdlib, the 
following changes are required:

1. Compilation must reference the just built macros (ie `libSwiftMacros.dylib`), not 
those from the SDK. This is addressed by adding an explicit `-external-plugin-path` 
flag that overrides the defaults generated by the compiler (which uses SDK paths, where 
the macro may or may not exist, and may not be the current version).
2. As DebugDescription uses `@_section`, compilation enables the `SymbolLinkageMarkers` 
feature.

Note that the use of DebugDescription is conditionally enabled for the following 
reasons:

1. Use is disabled in freestanding builds, where the stdlib macros are not built.
2. Use is temporarily disabled in Linux builds due to a dynamic loader issue that needs 
further investigation

The dynamic loader error causing issues with Linux CI is:
> swift-plugin-server: error while loading shared libraries: libswiftGlibc.so: cannot 
open shared object file: No such file or directory

This PR depended on #71639, #71588, and #71685.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants