This is an archive of the discontinued LLVM Phabricator instance.

Update Error Message
ClosedPublic

Authored by rdhindsa on Mar 13 2018, 5:28 PM.

Details

Summary

Updates error message for dynamic relocation attempt for read only segments.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

rdhindsa created this revision.Mar 13 2018, 5:28 PM
arichardson added inline comments.Mar 14 2018, 2:42 AM
ELF/Relocations.cpp
818

I would not use line continuations here.

819

I think mentioning -z notext is very useful. It is hard to know from the current error message that the build error is due to differing default behaviours in bfd and lld.
However, this message is too long. I don't think we need to mention the default behaviour since the end of the sentence implies it. Also most users will not be invoking lld directly so maybe using -Wl,-z,notext in the message is better?

Maybe ... " in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output"?

ruiu added inline comments.Mar 14 2018, 11:27 AM
ELF/Relocations.cpp
818

Yes. I think your actual error message contains a lot of spaces between "relocations." and "Recompile object files..." because of the indentation of the next line. In general line continuation should be avoided. You can just write two string literals without any operator or anything to make compiler concatenate the two strings.

rdhindsa updated this revision to Diff 138436.Mar 14 2018, 12:28 PM
rdhindsa marked 3 inline comments as done.
ruiu added inline comments.Mar 14 2018, 12:51 PM
test/ELF/aarch64-fpic-add_abs_lo12_nc.s
4

I think you need to update this test as well. (Your C++ code recommends -Wl,-z,notext but this error message mentions "-z notext".

rdhindsa updated this revision to Diff 138444.Mar 14 2018, 1:24 PM
ruiu accepted this revision.Mar 14 2018, 1:26 PM

LGTM

This revision is now accepted and ready to land.Mar 14 2018, 1:26 PM
rdhindsa added inline comments.Mar 14 2018, 1:26 PM
test/ELF/aarch64-fpic-add_abs_lo12_nc.s
4

Done! Sorry, I missed it earlier.

This revision was automatically updated to reflect the committed changes.