This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - Trigger error when -R <filename> is given.
AbandonedPublic

Authored by grimar on Nov 28 2017, 7:16 AM.

Details

Reviewers
ruiu
rafael
Summary

-R option has 2 meanings according to spec:

-R filename
--just-symbols=filename
..... For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option.

-rpath dir
.... For compatibility with other ELF linkers, if the -R option is followed by a directory name, rather than a file name, it is treated as the -rpath option.

Currently we always treat -R as -rpath what confuses users (see comments for PR35067) and also produces unexpected/broken output.
I am not sure we want to implement logic sharing -R between --just-symbols and -rpath. I would at least try to avoid that, it seems bad
approach to share flags. Since --just-symbols looks not used too often I would suggest users to switch from -R <filename> to explicit --just-symbols.
But that is a bit different story though, what I think we should do right now is stop handling -R <filename> as -rpath and error out in that case instead.
That is what this patch do.

Diff Detail

Event Timeline

grimar created this revision.Nov 28 2017, 7:16 AM
ruiu edited edge metadata.Nov 28 2017, 12:22 PM

I'm not a fan of this patch. Even though it is traditionally implemented in other linkers, this behavior looks too hairy.

ruiu added a comment.Nov 28 2017, 12:32 PM

Did you mean we emit an error for -R?

ruiu added a comment.Nov 28 2017, 1:54 PM

If you are suggesting we emit something like "cannot open file for -R: foo/bar is a directory. Did you mean -rpath?" for -R, I think I'd agree that that is probably better than just emitting an error without the hint.

grimar abandoned this revision.Dec 1 2017, 11:32 PM

Abandoning in according to discussions about this one in corresponding llvm-mails thread.