🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #850

Re: Large constants in RISC

#850
From: aph
Date: Sat, 21 Nov 2026 10:33
23 lines
2625 bytes
Stefan Monnier <monnier@iro.umontreal.ca> 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.

It depends on the language. In a simple ahead-of-time-compiled
language like C that may well mostly be true, but in an Object-Oriented
language it's more complicated. Code is PIC, but still contains things
like pointer type checks, and these refer to structures at absolute
addresses. Also, address constants in code can point to data, as in

    if (a == some_well_known_object) { ... }

Andrew.
Technical Details
Message-ID: <PSmdnUYArIML7pz2nZ2dnZfqnPqdnZ2d@supernews.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
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>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-4.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!nntp.supernews.com!news.supernews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 21 Nov 2026 10:33:58 +0000
Sender: Andrew Haley <aph@li-f2cf9ecc-3241-11b2-a85c-b613f11f80f0.ibm.com>
From: aph@littlepinkcloud.invalid
Subject: Re: Large constants in RISC
Newsgroups: comp.arch
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>
User-Agent: tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/7.3.3-100.fc43.x86_64 (x86_64))
Message-ID: <PSmdnUYArIML7pz2nZ2dnZfqnPqdnZ2d@supernews.com>
Date: Sat, 21 Nov 2026 10:33:58 +0000
Lines: 23
X-Trace: sv3-YPIK7U+YJz6jL6m/rG0pxNvrOOWuX46WBsEXsLv9UT8Z4HRy/ijbsrSXdAPMQvC1pSwgCDKaGqdmF36!OEnE0s5SADb0xhKdcEiwvLv9qRnplqQzTdFqPqISkUxlxQczjYFnpFujjZspy7zDfbtr7drCZPQT!mDzr3Jet0PFa
X-Complaints-To: www.supernews.com/docs/abuse.html
X-DMCA-Complaints-To: www.supernews.com/docs/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40