Skip to content
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

Place read-only data symbols in the .rodata section. #2460

Merged
merged 1 commit into from
Aug 10, 2019

Conversation

mundaym
Copy link
Contributor

@mundaym mundaym commented Aug 5, 2019

This data was previously put into the default section, .text, which
is generally used for executable data.

This fixes a gold warning on IBM Z: "S/390 code fill of odd length
requested". This warning was triggered because executable
instructions on IBM Z must be 2-byte aligned and the data in one of
these sections is 1-byte aligned.

@mundaym
Copy link
Contributor Author

mundaym commented Aug 5, 2019

@swift-ci Please test.

@millenomi
Copy link
Contributor

What is the effect on other platforms here? Is there any platform that would balk at this, and should we conditionalize it?

@mundaym
Copy link
Contributor Author

mundaym commented Aug 5, 2019

What is the effect on other platforms here? Is there any platform that would balk at this, and should we conditionalize it?

I'm not totally sure. It is definitely fine when targeting ELF objects. Windows might need to be .rdata and I think .rodata will do the right thing on Darwin but I'm not certain since MACH doesn't seem to have that section by default. Given the uncertainty I've modified the PR to only target ELF objects.

We should probably do the other object file formats too though at some point. Dumping the data into the .text section isn't ideal.

@mundaym
Copy link
Contributor Author

mundaym commented Aug 5, 2019

@swift-ci Please test.

@millenomi
Copy link
Contributor

@swift-ci please test

@compnerd
Copy link
Member

compnerd commented Aug 6, 2019

@millenomi since this is a property of the object file, no platform would balk at this. The flags need to be setup appropriately for the target object file format, __ELF__ should ensure that the correct section is used for ELF targets. MachO and PE/COFF can be addressed in a follow up IMO.

This data was previously put into the default section, .text, which
is generally used for executable data. Currently this is only fixed
when using ELF but we should probably fix this for other object file
formats too.

This fixes a gold warning on IBM Z: "S/390 code fill of odd length
requested". This warning was triggered because executable
instructions on IBM Z must be 2-byte aligned and the data in some of
these symbols is 1-byte aligned.
@mundaym
Copy link
Contributor Author

mundaym commented Aug 6, 2019

@swift-ci Please test.

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: I tend to prefer the .section directive indented. I leave the formatting related items to @millenomi

@millenomi
Copy link
Contributor

@swift-ci please test

@compnerd
Copy link
Member

compnerd commented Aug 9, 2019

@swift-ci please test Linux platform

@compnerd compnerd merged commit 84d6a68 into swiftlang:master Aug 10, 2019
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.

3 participants