Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
DescriptionChristian Hägele
2020-02-24 13:55:08 UTC
Description of problem:
Precompiled-Headers don't work with the system-compiler. Same code compiles on all other platforms I tried. Even with the same Compiler-Version.
Version-Release number of selected component (if applicable):
gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4)
How reproducible:
Any C++-Program which tries to use precompiled-headers and uses -Winvalid-pch.
I added a minimal example to reproduce.
Steps to Reproduce:
1. echo "#include <iostream>" > test.txt
2. echo "#include "stdafx.h"
int main() {
std::cout << "Hello World" << std::endl;
return 0; }
" > test.txt
3. mkdir stdafx.h.gch
4. /usr/bin/c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h
5. /usr/bin/c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp
Actual results:
main.cpp:1:20: error: stdafx.h.gch/.c++: had text segment at different address [-Werror]
#include "stdafx.h"
^
Expected results:
Compile succeeds without Warnings and Error and is using Precompiled-Headers
Additional info:
I tested the same code also with DevToolset-8 (GCC-8.3.1)on RHEL7 and also with GCC-8.2.1 on openSUSE Leap 15.1 and it works without problems.
JFTR, the same code compiles on GCC-9 from GCC Toolset.
$ sudo dnf install gcc-toolset-9-gcc-c++
$ scl enable gcc-toolset-9 bash
$ c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h
$ c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp
$ c++ --version
c++ (GCC) 9.1.1 20190605 (Red Hat 9.1.1-2)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
This is expected behavior. GCC's PCH mechanism is fundamentally incompatible with the security hardening requirements for RHEL (PIE in particular). We are currently evaluating the best way to present a more friendly diagnostic for this issue.
Description of problem: Precompiled-Headers don't work with the system-compiler. Same code compiles on all other platforms I tried. Even with the same Compiler-Version. Version-Release number of selected component (if applicable): gcc (GCC) 8.3.1 20190507 (Red Hat 8.3.1-4) How reproducible: Any C++-Program which tries to use precompiled-headers and uses -Winvalid-pch. I added a minimal example to reproduce. Steps to Reproduce: 1. echo "#include <iostream>" > test.txt 2. echo "#include "stdafx.h" int main() { std::cout << "Hello World" << std::endl; return 0; } " > test.txt 3. mkdir stdafx.h.gch 4. /usr/bin/c++ -Wall -Wextra -Werror -x c++-header -o stdafx.h.gch/.c++ stdafx.h 5. /usr/bin/c++ -Wall -Wextra -Werror -Winvalid-pch -o main.o -c main.cpp Actual results: main.cpp:1:20: error: stdafx.h.gch/.c++: had text segment at different address [-Werror] #include "stdafx.h" ^ Expected results: Compile succeeds without Warnings and Error and is using Precompiled-Headers Additional info: I tested the same code also with DevToolset-8 (GCC-8.3.1)on RHEL7 and also with GCC-8.2.1 on openSUSE Leap 15.1 and it works without problems.