From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3645938485A8; Wed, 11 May 2022 11:10:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3645938485A8 From: "mark at klomp dot org" To: elfutils-devel@sourceware.org Subject: [Bug general/29141] _FORTIFY_SOURCE=3 fail for gcc 12/glibc 2.35 Date: Wed, 11 May 2022 11:10:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: elfutils X-Bugzilla-Component: general X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mark at klomp dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 11:10:03 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29141 Mark Wielaard changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mark at klomp dot org, | |siddhesh at sourceware dot= org --- Comment #1 from Mark Wielaard --- This is interesting. I recently fixed a similar warning in gdb (also for -Werror=3Dstringop-overflow, but not _FORTIFY_SOURCE related): https://sourceware.org/pipermail/gdb-patches/2022-May/188694.html I have added Siddhesh to the CC who might have seen this earlier. Background is that in elfutils we are trying to use _FORTIFY_SOURCE=3D3 whe= n it is available using this configure snippet: # See if we can add -D_FORTIFY_SOURCE=3D2 or =3D3. Don't do it if it is alr= eady # (differently) defined or if it generates warnings/errors because we # don't use the right optimisation level (string.h will warn about that). AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=3D2 or =3D3 to CFLAGS]) case "$CFLAGS" in *-D_FORTIFY_SOURCE=3D*) AC_MSG_RESULT([no, already there]) ;; *) save_CFLAGS=3D"$CFLAGS" # Try 3 first. CFLAGS=3D"-D_FORTIFY_SOURCE=3D3 $save_CFLAGS -Werror" fortified_cflags=3D"" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include int main() { return 0; } ]])], [ AC_MSG_RESULT([yes -D_FORTIFY_SOURCE=3D3]) fortified_cflags=3D"-D_FORTIFY_SOURCE=3D3" ], []) # If that didn't work, try 2. if test -z "$fortified_cflags"; then CFLAGS=3D"-D_FORTIFY_SOURCE=3D2 $save_CFLAGS -Werror" AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ #include int main() { return 0; } ]])], [ AC_MSG_RESULT([yes -D_FORTIFY_SOURCE=3D2]) fortified_cflags=3D"-D_FORTIFY_SOURCE=3D2" ], [ AC_MSG_RESULT([no, cannot be used])]) fi CFLAGS=3D"$fortified_cflags $save_CFLAGS" CXXFLAGS=3D"$fortified_cflags $CXXFLAGS" ;; esac But it seems to produce gcc warnings like the above, so either our configure foo is bad or we simply have to always use _FORTIFY_SOURCE=3D2. --=20 You are receiving this mail because: You are on the CC list for the bug.=