This is an archive of the discontinued LLVM Phabricator instance.

Fix Thumb text sections' flags under COFF/Windows (1/2)
ClosedPublic

Authored by aguinet on Jun 23 2016, 3:11 PM.

Details

Reviewers
rengolin
compnerd
Summary

the "SCN_MEM_16BIT" flag (which indicate that the text sections contain thumb code [1]) is set even if we are compiling non-thumb code.
I couldn't check this as thumb mode seems to be forced in clang/lib/Driver/ToolChain.cpp, function ToolChain::ComputeLLVMTriple. Forcing the ARM mode by default will makes clang/llvm complains that this isn't supported (I didn't dug further).

Diff Detail

Event Timeline

aguinet updated this revision to Diff 61732.Jun 23 2016, 3:11 PM
aguinet retitled this revision from to Fix Thumb text sections' flags under COFF/Windows (1/2).
aguinet updated this object.
aguinet added reviewers: rengolin, compnerd.
compnerd accepted this revision.Jun 23 2016, 5:30 PM
compnerd edited edge metadata.

Im not sure that this change is really worth it. We do not support Windows ARM at all. The ARM NT is a pure thumb mode execution. I don't think you can even get MSVC to generate code for ARM mode. That said, with the minor tweak to the overly verbose comment, I don't think that this harms anything as we normalize the target triple to thumb anyways and we have a number of other assumptions based on the fact that the triple is set to thumb.

lib/MC/MCObjectFileInfo.cpp
608

I think that the comment is a bit verbose. Plus, the comment is better applied to the flag calculation below. I would recommend something like:

Set the `IMAGE_SCN_MEM_16BIT` flag when compiling for thumb mode.  This is
used to indicate to the linker that the text segment contains thumb instructions
and to set the ISA selection bit for calls accordingly.
This revision is now accepted and ready to land.Jun 23 2016, 5:30 PM
rengolin accepted this revision.Jun 25 2016, 3:41 AM
rengolin edited edge metadata.

I agree with Saleem. LGTM.

rengolin closed this revision.Jun 27 2016, 7:49 AM

r273880