Bug 1852781
| Summary: | Compiling with -flto and -g removes CET support | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Nick Clifton <nickc> |
| Component: | gcc | Assignee: | Marek Polacek <mpolacek> |
| gcc sub component: | system-version | QA Contact: | Alexandra Petlanová Hájková <ahajkova> |
| Status: | CLOSED ERRATA | Docs Contact: | |
| Severity: | unspecified | ||
| Priority: | unspecified | CC: | ahajkova, fweimer, jakub, mcermak, ohudlick, sipoyare, vmukhame |
| Version: | 8.3 | Keywords: | Bugfix, Triaged |
| Target Milestone: | rc | ||
| Target Release: | 8.0 | ||
| Hardware: | x86_64 | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | gcc-8.4.1-1.el8 | Doc Type: | No Doc Update |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-18 13:28:00 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
After talking with H.J. it appears that this problem might be due to this bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93966 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (gcc bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:1571 |
Description of problem: It appears that compiling with -flto enabled disables CET support. Version-Release number of selected component (if applicable): How reproducible: 100% using current RHEL-8.3 latest nightly compose. Steps to Reproduce: 1. cat delme.c int main (void) { return 0; } 2. gcc -fcf-protection delme.c -o delme.exe 3. readelf --wide --notes delme.exe | grep IBT GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT, SHSTK 4. gcc -fcf-protection -flto delme.c -o delme.lto.exe 5. readelf --wide --notes delme.lto.exe | grep IBT GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT, SHSTK 6. gcc -fcf-protection -g delme.c -o delme.g.exe 7. readelf --wide --notes delme.g.exe | grep IBT GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT, SHSTK 8. gcc -fcf-protection -flto -g delme.c -o delme.g.lto.exe 9. readelf --wide --notes delme.g.lto.exe | grep IBT <no output> Expected results: Additional info: Adding -Wl,-Map,delme.g.lto.map to the gcc command line and then looking in the map file shows: Removed property 0xc0000000 to merge 0x55edf35fc4f0B (not found) and 0x55edf3650e10B (0x0) Removed property 0xc0000001 to merge 0x55edf35fc4f0B (not found) and 0x55edf3650e10B (0x0) Removed property 0xc0000002 to merge 0x55edf35fc4f0B (0x3) and 0x55edf3822920B (not found) Removed property 0xc0000002 to merge 0x55edf35fc4f0B (not found) and 0x55edf3822d30B (0x3) For the failing case (-g -flto) but for other cases: Removed property 0xc0000000 to merge 0x5640400bf4f0B (not found) and 0x56404013ff10B (0x0) Removed property 0xc0000001 to merge 0x5640400bf4f0B (not found) and 0x56404013ff10B (0x0) The versions of the tools involved: gcc-8.3.1-5.1.el8.x86_64 binutils-2.30-75.el8.x86_64 Note - This may well be a linker bug, but the fact that it is triggered by adding -g to the gcc command line makes me suspect that gcc, or the LTO plugin, is having problems, rather than ld.