From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 37EE8385842B; Thu, 30 Sep 2021 11:49:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 37EE8385842B From: "iains at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug objc/102537] Objective-C: can't use >= USE_FIXUP_BEFORE paths on non-Darwin Date: Thu, 30 Sep 2021 11:49:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: objc X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: iains at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: target_milestone everconfirmed bug_severity cf_reconfirmed_on bug_status 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Sep 2021 11:49:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102537 Iain Sandoe changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |12.0 Ever confirmed|0 |1 Severity|normal |enhancement Last reconfirmed| |2021-09-30 Status|UNCONFIRMED |NEW --- Comment #1 from Iain Sandoe --- (In reply to Matt Jacobson from comment #0) > I am working on a NeXTv2-ABI-compatible Objective-C runtime for a non-Dar= win > platform (AVR micros). I'd like my Objective-C code to make use of the m= ost > modern ABI features, namely those guarded in the code by `flag_next_runti= me > >=3D USE_FIXUP_BEFORE`. >=20 > However, there appears to be no way to control `flag_next_runtime` (short= of > modifying the compiler source). I can set it to zero with `-fgnu-runtime` > or one with `-fnext-runtime`, but `USE_FIXUP_BEFORE` is an encoded Mac OS= X > version (namely 100600, referring to Snow Leopard). by current design, there are enough bits in the value so that ne can have N MSBs representing the platform and N representing the version. > There is Darwin-specific option parsing code (`darwin_override_options()`) > that appears to set `flag_next_runtime` based on `-mmacosx-version-min`, = but > obviously that doesn't run for non-Darwin targets. Most targets have an equivalent "override options" section where they could make a similar selection. A simplistic case would be to say any value >990000 is not Darwin (i.e we m= ake the Darwin platform part of the runtime value =3D=3D 0 and then any other p= latform that wants to take an encoding takes a value higher; this would default to = the next runtime just using "latest and greatest" - but that might not be what = you want in say 2 years time... ... however, it would be better to use bit boundaries rather than arbitrary decimal. maybe ... 0xff000000 masks the platform=20 0x00ffffff masks the version selector and Darwin is platform 0 for this purpose. so as a quick fix you could just say AVR is platform 1 and set it to=20 0x01000000 in your platform flags override ... > I could imagine a few approaches to fixing this: >=20 > 1. Parse `-mmacosx-version-min` even when the target is not Darwin, whene= ver > we're compiling Objective-C. On non-Darwin, this would be interpreted as > requesting Objective-C codegen compatible with the Objective-C ABI of the > specified release of Mac OS X. I do not think that is going to fly ;) > 2. Allow an argument to `-fnext-runtime`, with the meaning approximately = the > same as in #1. >=20 > 3. Instead of using `flag_next_runtime` as a version number, switch it ba= ck > to being zero or one, and use a separate flag (perhaps the existing > `-fobjc-abi-version`?) to differentiate ABIs. These two were both thoughts during the development but I suspect that the mapping to values is a build-time decision and ought to be done in the flags override code. thoughts?=