Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Conversation

@sandreenko
Copy link

@sandreenko sandreenko commented Mar 2, 2017

Code sections should have special HasInstructions flag set.
It is done for .text inside objectWriter.

@sandreenko
Copy link
Author

sandreenko commented Mar 7, 2017

@MichalStrehovsky, @nattress could you take a look please?
llilc commit .

SetCodeSectionAttribute(_nativeObjectWriter, section.Name);
}

_currentSection = section;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this actually changing the current section being emitted? If not, we should not alter _currentSection

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

managedCodeSection = MethodCodeNode.UnixContentSection;
objectWriter.SetSection(LsdaSection);
}
objectWriter.SetCodeSectionAttribute(managedCodeSection);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to add a new ObjectWriter API for this? We have the existing CustomSectionAttributes flags we pass through when setting a section that objectwriter could look for. We could key off CustomSectionAttributes.Executable for instance.

Copy link
Author

@sandreenko sandreenko Mar 7, 2017

Choose a reason for hiding this comment

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

Yes, it is possible. But I think we should check a contract for CustomSectionAttributes.Executable.
Should Windows sentinels have executable attribute? Do they contain instructions?

Should .text section be IsStandardSection, if it has executable attribute set on and we don't pass it right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

The sentinels do not contain instructions. It makes sense to have standard sections also have the correct attributes instead of just for custom sections so things are more consistent. I filed issue #2913 for this.

@sandreenko sandreenko force-pushed the ObjectWriterUpdate branch from 418d8f7 to 2e4b948 Compare March 7, 2017 03:07
if (factory.Target.OperatingSystem == TargetOS.OSX)
{
// TODO fix: we set the section, but do not emit anything,
// but the generic test fails without this code.
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear what this TODO tracks. Is this an issue that should be filed? What are the next steps?

the generic test fails might be a clear thing right now, but 6 months from now, maybe the test won't even exist anymore.

Copy link
Author

Choose a reason for hiding this comment

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

Issue #2916 was added. Code was updated.

{
objectWriter.SetSection(MethodCodeNode.UnixContentSection);
managedCodeSection = MethodCodeNode.UnixContentSection;
if (factory.Target.OperatingSystem == TargetOS.OSX)
Copy link
Member

Choose a reason for hiding this comment

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

Why cannot we do this unconditionally? Is there any downside for other Unixes?

Copy link
Author

Choose a reason for hiding this comment

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

We can, but we don't have to.

Copy link
Member

Choose a reason for hiding this comment

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

If there is no downside, then I'd prefer simpler code without the conditional.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed

@sandreenko sandreenko force-pushed the ObjectWriterUpdate branch from 99af593 to dc53f6c Compare March 7, 2017 22:01
Code sections should have special HasInstructions flag set.
It is done for .text inside objectWriter.
@sandreenko sandreenko force-pushed the ObjectWriterUpdate branch from dc53f6c to 7efaaa8 Compare March 7, 2017 22:25
Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM

@sandreenko sandreenko merged commit 5eef9b8 into dotnet:master Mar 8, 2017
@sandreenko sandreenko deleted the ObjectWriterUpdate branch March 8, 2017 00:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants