[SERVER-10576] Use --detect-odr-violation if linking with a supported linker Created: 19/Aug/13 Updated: 05/Apr/17 Resolved: 29/Nov/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.1 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | build-planning | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Platforms 2017-01-23 |
| Participants: |
| Description |
|
ODR = One definition rule. This would detect if there were two classes or functions with the same name in the same namespace even if they are never both included in the same translation unit. Currently this flag is only supported by gold although other linkers may have similar flags. Actual flag to be added to LINKFLAGS is:
|
| Comments |
| Comment by Githook User [ 29/Nov/16 ] | ||||
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: | ||||
| Comment by Andrew Morrow (Inactive) [ 07/Apr/16 ] | ||||
|
I just tried building with -Wl,--detect-odr-violation, and gold crashes. This is on Ubuntu 15.10, so this is pretty recent. Perhaps this feature isn't quite ready. | ||||
| Comment by Mathias Stearn [ 10/Aug/15 ] | ||||
|
acm, yes, since I think we should have it on by default. At the very least, one of the evergreen builders should be run with this flag so we fail the build on ODR violations. FYI, I tried adding that to my scons alias, but it is currently failing apparently due to forward declaring StatusWith. I can't tell if this is a false positive or not, but since it stops once it finds the first duplicate, I can't tell how many other errors it may be masking:
| ||||
| Comment by Andrew Morrow (Inactive) [ 10/Aug/15 ] | ||||
|
redbeard0531 - Do you think this is still useful, now that you can say: LINKFLAGS="-fuse-ld=gold -Wl,--detect-odr-violations" in your ~/.scons/site_scons/mongo_custom_variables.py file? | ||||
| Comment by Andrew Morrow (Inactive) [ 04/Nov/13 ] | ||||
|
We don't yet have an analogue for AddToCXXFlagsIfSupported for linker flags, but that is how this should be done
|