From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0CCD8384CBA1; Fri, 10 May 2024 08:44:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0CCD8384CBA1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715330700; bh=TAEP/LbfuvPUsIXF0qqlb5jZN0KMDkHtfh2gpNekO2Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pnJo/cRHPdDPzFt2bXXTActi/b/ItM7o/rpnxv1z4hYrIQLEI7yweaVoyKR2nvpiT Rs5HnTKoStUDO0LCE1+q1iKL+/qEWsAZj0IFTkqIP5TvpJTIKjl80o57yl1n4TjUJ0 ZxHgKoHX2XMk3N27q7oyzmdLFQztOFEPdPgFS4So= From: "mdoucha at suse dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115014] GCC generates incorrect instructions for addressing the data segment through EBP register Date: Fri, 10 May 2024 08:44:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: mdoucha at suse dot cz X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115014 --- Comment #6 from Martin Doucha --- (In reply to Xi Ruoyao from comment #5) > No, "Freestanding Environment" has a very specific meaning in the C > standard. If we must add this it'd be a separate -m{something} argument. I would say that "execution without any benefit of an operating system" does have some implication for what you can assume about the stack segment, therefore properly prefixing EBP dereferences should be controlled by the parameter. Just to be clear, I'm not asking for support of arbitrary segment base addresses, not even for the stack segment alone, because that would require flawless tracking of segment association for every single pointer. What I'm asking for is that in a freestanding environment, the stack segment should = be treated as a limited subset of the data segment. All stack addresses must be accessible through the data segment but some data segment addresses may fall outside the stack segment limit. This will allow embedded code to set up ba= sic protection against stack overflow without configuring full page translation= .=