This is an archive of the discontinued LLVM Phabricator instance.

Teach cc1as driver to accept ARM ropi/rwpi reloc model
Needs ReviewPublic

Authored by weimingz on Jul 27 2017, 6:03 PM.

Details

Reviewers
rengolin
olista01
Summary

Cureently, passing -frwpi/-fropi for assmebling causes assertion.
This patch teaches the cc1as driver to accept the flags

Diff Detail

Event Timeline

weimingz created this revision.Jul 27 2017, 6:03 PM
weimingz updated this revision to Diff 109009.Jul 31 2017, 3:05 PM

add test case

This looks like it'll get the build attributes wrong (since only PIC gets plumbed through to the backend). That's probably worse than simply rejecting the arguments.

This looks like it'll get the build attributes wrong (since only PIC gets plumbed through to the backend). That's probably worse than simply rejecting the arguments.

Do you mean the attributes like:

Tag_ABI_PCS_R9_use: SB
Tag_ABI_PCS_RW_data: SB-relative
Tag_ABI_PCS_GOT_use: direct

For cc1as, it won't add such tags no matter PIC or static relocation model. The PIC value only affects MIPS target and some DWARF info.

And since it's an assertion, in Release build, the flag will still be accepted silently.

olista01 edited edge metadata.Aug 14 2017, 1:46 AM

I think it would be better to reject these options than to silently accept them, unless you plan on using them to emit build attributes.

I think it would be better to reject these options than to silently accept them, unless you plan on using them to emit build attributes.

For asm file, I think it's the asm file's responsibility to set the corresponding .eabi_attribute. I tried to assemble a .S with -fPIC and don't see any attributes is generated by assembler. And linker should catch if objs with incompatible ABIs are used.

In which case, I think assembling with -fropi or -frwpi should be an error, rather than it being accepted and silently ignored.