Bug 20824 - enable warn-shared-textrel by default
Summary: enable warn-shared-textrel by default
Status: UNCONFIRMED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.28
: P2 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-15 08:21 UTC by ma.jiang
Modified: 2016-11-16 10:04 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
enable warn-shared-textrel by default (999 bytes, patch)
2016-11-15 08:21 UTC, ma.jiang
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ma.jiang 2016-11-15 08:21:38 UTC
Created attachment 9636 [details]
enable warn-shared-textrel by default

In gnu-ld, warn-shared-textrel is disabled by default. Why not to enable it by default? 
  One of our customers found that he did not have enough memory to run his application after a recompilation. The root cause turn out to be a silly mistake that he forgot to add "-fPIC" for his shared libraries. Yes yes, the one who make mistakes got to pay the price, it's very reasonable. But there were no warning at all, a normal user(not a expert) probably did not know  what was wrong (and how to fix). This does not seem reasonable...
  Although some arches(like x86-64) force all shared libraries to be PIC, there are some that does not. In my opinion, the linker should be a good place to make the warnings. So, warn-shared-textrel should be enable by default.
  attached patch enable "warn-shared-textrel" and add a new option to close this warning, is that ok?
Comment 1 Mike Frysinger 2016-11-15 15:16:21 UTC
patches should be sent to the binutils@sourceware.org mailing list for discussion.  there are problems with this particular patch, but that can be ironed out after we discuss whether we want to do this in the first place.

you'll also need to update gold.
Comment 2 ma.jiang 2016-11-16 10:04:50 UTC
(In reply to Mike Frysinger from comment #1)
> patches should be sent to the binutils@sourceware.org mailing list for
> discussion.  there are problems with this particular patch, but that can be
> ironed out after we discuss whether we want to do this in the first place.
> 
> you'll also need to update gold.

  Thanks for the reply. I have send a mail to  binutils@sourceware.org. 
  for the things about gold: we did not use the gold linker,so I am not familiar with it. if this behavior change were accepted by the binutils community, I will pay some time for the gold.