Article View: comp.arch
Article #852Re: Large constants in RISC
From: Stefan Monnier
Date: Sat, 21 Nov 2026 03:23
Date: Sat, 21 Nov 2026 03:23
46 lines
3626 bytes
3626 bytes
On 2026-Nov-19 08:59, Stefan Monnier wrote: > aph@littlepinkcloud.invalid [2026-11-19 09:42:51] wrote: >> In a way, it does. Most large constants I see are addresses. >> AArch64 (almost) always has a 48-bit user space, so except for >> floating-point doubles and the very occasional large integer, constant >> loads look like >> mov x0, 42857; movk x0, 0x60b8, lsl 16; movk x0, 0xaaaa, lsl 32 > Interesting. I would have expected that most AArch64 code is position > independent (e.g. for address space randomization purposes), so I wonder > in which circumstances we end up with such instruction sequences to > build hardcoded addresses. EricP [2026-11-20 15:47:57] wrote: > An application or OS can require that certain data structures > are mapped at predefined virtual addresses. I find it hard to believe that these thingies would account for a large portion of large constants. Scott Lurndal [2026-11-19 23:19:31] wrote: > Consider the case where one is creating the 64-bit address (virtual or > physical) of a hardware component, or a VDSO. Similarly, for hardware addresses what I see in U-Boot and Linux code is that such addresses are usually relegated to device-tree files so should presumably not appear in the actual instruction stream. Do you know of a concrete case where it accounts for a large portion of large constants? Anton Ertl [2026-11-20 16:01:31] wrote: > You can support ASLR without PIC when you generate your code at > run-time (i.e., a load-and-go or JIT compiler). Hmm... didn't think of that. Indeed this could lead to actual addresses embedded in the code. Then again, I'd expect most such JIT setups to want to keep most of those addresses in data rather than in the code so the GC can more easily trace through them. So, we now have 3 suggested circumstances, but it's not clear if these occur enough to explain Andrew's experience. Andrew, do you know what causes all those large constant addresses you're seeing? === Stefan
Technical Details
Message-ID:
<jwvo6bidgit.fsf-monnier+comp.arch@gnu.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org> <SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com> <jwv1p8hhqmy.fsf-monnier+comp.arch@gnu.org> <4m2MS.132607$Lt64.106487@fx41.iad>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Stefan Monnier <monnier@iro.umontreal.ca> Newsgroups: comp.arch Subject: Re: Large constants in RISC Date: Fri, 20 Nov 2026 22:23:33 -0500 Organization: A noiseless patient Spider Lines: 46 Message-ID: <jwvo6bidgit.fsf-monnier+comp.arch@gnu.org> References: <11d76uq$11cdc$1@paganini.bofh.team> <11d7ct8$17akn$1@dont-email.me> <11d7ih2$11orr$1@paganini.bofh.team> <11d9d0d$1rsce$1@dont-email.me> <11d9tq8$1b9c1$2@paganini.bofh.team> <2026Nov14.201017@mips.complang.tuwien.ac.at> <6af911ea.18530156@news.eternal-september.org> <SYScnWsR3rgGWWP3nZ2dnZfqn_WdnZ2d@supernews.com> <jwv1p8hhqmy.fsf-monnier+comp.arch@gnu.org> <4m2MS.132607$Lt64.106487@fx41.iad> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Sat, 21 Nov 2026 11:04:21 +0000 (UTC) Injection-Info: dont-email.me; logging-data="22098"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JWf6c5PTOCbYM4dzTBxXcEy++SuVK/v0="; posting-host="eca9a02ea42e2ce5aed05df698cf1c6e" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:4ONQ5J6jYT9egxnxAjbZPChffaU= sha1:cAD1sHEEHUXPdzFiafH+zaFRLg4= sha256:zNbviNSC4RbFQ0sWDq4HW9248fYmE7tQxbiR2UPzhwk= sha1:jCvjWI6g7xpeY9HsHx/n8CkHJQc= sha256:4piHMifz1LNPVEGwzWoEhZTr3tj9fb8L19IyrRbvMFM= In-Reply-To: <4m2MS.132607$Lt64.106487@fx41.iad> (message from EricP <ThatWouldBeTelling@thevillage.com> on Fri, 20 Nov 2026 15:47:57 -0500)