sorear changed the topic of #riscv to: RISC-V instruction set architecture | https://riscv.org | Logs: https://libera.irclog.whitequark.org/riscv
Leopold has quit [*.net *.split]
vagrantc has quit [*.net *.split]
jimbzy has quit [*.net *.split]
hrberg has quit [*.net *.split]
Perflosopher has quit [*.net *.split]
solrize has quit [*.net *.split]
motherfsck has quit [*.net *.split]
clandmeter has quit [*.net *.split]
ncopa has quit [*.net *.split]
unlord has quit [*.net *.split]
crest has quit [*.net *.split]
drewfustini has quit [*.net *.split]
seds has quit [*.net *.split]
stefanct has quit [*.net *.split]
mturquette has quit [*.net *.split]
simpl_e has quit [*.net *.split]
jedix has quit [*.net *.split]
vagrantc has joined #riscv
unlord has joined #riscv
hrberg has joined #riscv
crest has joined #riscv
jedix has joined #riscv
jimbzy has joined #riscv
solrize has joined #riscv
ncopa has joined #riscv
drewfustini has joined #riscv
motherfsck has joined #riscv
seds has joined #riscv
seds has quit [Changing host]
seds has joined #riscv
clandmeter has joined #riscv
mturquette has joined #riscv
solrize has joined #riscv
solrize has quit [Changing host]
simpl_e has joined #riscv
clandmeter has quit [Changing host]
clandmeter has joined #riscv
stefanct has joined #riscv
Leopold has joined #riscv
knolle has joined #riscv
jimbzy has joined #riscv
jimbzy has quit [Changing host]
pecastro has quit [Ping timeout: 250 seconds]
mtinman[m] has joined #riscv
mechaniputer has quit [Quit: leaving]
EchelonX has quit [Quit: Leaving]
vagrantc has quit [Quit: leaving]
zjason` is now known as zjason
aredridel has quit [Quit: The Lounge - https://thelounge.chat]
aredridel has joined #riscv
jn has quit [Ping timeout: 250 seconds]
jn has joined #riscv
jn has joined #riscv
jn has quit [Changing host]
JanC_ has joined #riscv
JanC_ is now known as JanC
pabs3 has quit [Quit: Don't rest until all the world is paved in moss and greenery.]
pabs3 has joined #riscv
heat has quit [Read error: Connection reset by peer]
heat_ has joined #riscv
BootLayer has joined #riscv
heat_ has quit [Ping timeout: 255 seconds]
JanC has quit [Read error: Connection reset by peer]
JanC has joined #riscv
JanC has quit [Read error: Connection reset by peer]
JanC has joined #riscv
JanC has quit [Ping timeout: 250 seconds]
JanC has joined #riscv
JanC has quit [Remote host closed the connection]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Ping timeout: 250 seconds]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
jay321_ is now known as jay321
JanC has quit [Remote host closed the connection]
JanC has joined #riscv
JanC has quit [Ping timeout: 250 seconds]
frkazoid333 has joined #riscv
jay321 has quit [Read error: Connection reset by peer]
JanC has joined #riscv
jay321 has joined #riscv
freakazoid332 has quit [Ping timeout: 265 seconds]
JanC has quit [Read error: Connection reset by peer]
JanC_ has joined #riscv
JanC_ is now known as JanC
Stat_headcrabed has joined #riscv
TMM_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TMM_ has joined #riscv
aerkiaga has quit [Remote host closed the connection]
Stat_headcrabed has quit [Quit: Stat_headcrabed]
pbsds has quit [Quit: The Lounge - https://thelounge.chat]
pbsds has joined #riscv
pecastro has joined #riscv
pecastro has quit [Ping timeout: 260 seconds]
JanC has quit [Ping timeout: 255 seconds]
JanC has joined #riscv
unlord has quit [Ping timeout: 248 seconds]
unlord has joined #riscv
FL4SHK has quit [Ping timeout: 240 seconds]
FL4SHK has joined #riscv
junaid_ has joined #riscv
JanC_ has joined #riscv
JanC is now known as Guest8392
Guest8392 has quit [Killed (sodium.libera.chat (Nickname regained by services))]
JanC_ is now known as JanC
pecastro has joined #riscv
Tenkawa has joined #riscv
Wickram has joined #riscv
junaid_ has quit [Quit: leaving]
JanC has quit [Ping timeout: 240 seconds]
JanC has joined #riscv
PobodysNerfect has quit [Quit: Gone to sleep. ZZZzzz…]
JanC has quit [Ping timeout: 265 seconds]
junaid_ has joined #riscv
wingsorc has joined #riscv
Wickram has quit [Quit: WeeChat 3.8]
JanC has joined #riscv
Wickram has joined #riscv
JanC has quit [Read error: Connection reset by peer]
junaid_ has quit [Remote host closed the connection]
PobodysNerfect has joined #riscv
JanC has joined #riscv
JanC has quit [Read error: Connection reset by peer]
Wickram has quit [Quit: WeeChat 3.8]
BootLayer has quit [Quit: Leaving]
Trifton has quit [Quit: Client exited]
JanC has joined #riscv
EchelonX has joined #riscv
JanC has quit [Remote host closed the connection]
JanC has joined #riscv
Tenkawa has quit [Quit: Was I really ever here?]
BootLayer has joined #riscv
heat_ has joined #riscv
heat_ is now known as heat
Stat_headcrabed has joined #riscv
pecastro has quit [Ping timeout: 260 seconds]
rneese has joined #riscv
Trifton has joined #riscv
rneese has left #riscv [#riscv]
radu242753435752 has joined #riscv
grimbergen is now known as dilfridge
SpaceCoaster has quit [Read error: Connection reset by peer]
TMM_ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
TMM_ has joined #riscv
SpaceCoaster has joined #riscv
radu242753435752 has quit [Ping timeout: 260 seconds]
JanC has quit [Remote host closed the connection]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
SpaceCoaster has quit [Ping timeout: 240 seconds]
SpaceCoaster has joined #riscv
JanC_ has joined #riscv
JanC is now known as Guest7282
JanC_ is now known as JanC
Guest7282 has quit [Ping timeout: 250 seconds]
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Excess Flood]
JanC has joined #riscv
mechaniputer has joined #riscv
JanC has quit [Read error: Connection reset by peer]
JanC has joined #riscv
pecastro has joined #riscv
JanC_ has joined #riscv
JanC is now known as Guest3457
Guest3457 has quit [Killed (calcium.libera.chat (Nickname regained by services))]
JanC_ is now known as JanC
JanC_ has joined #riscv
JanC has quit [Read error: Connection reset by peer]
JanC_ is now known as JanC
SpaceCoaster has quit [Read error: Connection reset by peer]
JanC has quit [Excess Flood]
SpaceCoaster has joined #riscv
JanC has joined #riscv
Stat_headcrabed has quit [Quit: Stat_headcrabed]
JanC_ has joined #riscv
JanC has quit [Killed (molybdenum.libera.chat (Nickname regained by services))]
JanC_ is now known as JanC
PobodysNerfect has quit [Ping timeout: 240 seconds]
JanC_ has joined #riscv
JanC is now known as Guest4797
JanC_ is now known as JanC
Guest4797 has quit [Killed (silver.libera.chat (Nickname regained by services))]
JanC has quit [Excess Flood]
JanC has joined #riscv
JanC has quit [Ping timeout: 255 seconds]
JanC_ has joined #riscv
PobodysNerfect has joined #riscv
JanC_ is now known as JanC
SpaceCoaster has quit [Ping timeout: 260 seconds]
SpaceCoaster has joined #riscv
Tenkawa has joined #riscv
PobodysNerfect has quit [Quit: Gone to sleep. ZZZzzz…]
PobodysNerfect has joined #riscv
BootLayer has quit [Quit: Leaving]
cousteau has joined #riscv
Tenkawa has quit [Quit: Was I really ever here?]
hrberg has quit [Ping timeout: 240 seconds]
hrberg has joined #riscv
terminalpusher has joined #riscv
mechaniputer has quit [Quit: leaving]
terminalpusher has quit [Ping timeout: 245 seconds]
Andre_Z has joined #riscv
DynamiteDan has quit [Excess Flood]
DynamiteDan has joined #riscv
DynamiteDan has quit [Excess Flood]
DynamiteDan has joined #riscv
PobodysNerfect_ has joined #riscv
JanC has quit [Ping timeout: 255 seconds]
PobodysNerfect has quit [Ping timeout: 260 seconds]
JanC has joined #riscv
Andre_Z has quit [Quit: Leaving.]
solrize has quit [Ping timeout: 246 seconds]
PobodysNerfect has joined #riscv
PobodysNerfect_ has quit [Ping timeout: 260 seconds]
Tenkawa has joined #riscv
solrize has joined #riscv
solrize has joined #riscv
solrize has quit [Changing host]
Leopold has quit [Remote host closed the connection]
jay321 has quit [Quit: Leaving...]
PobodysNerfect has quit [Quit: Gone to sleep. ZZZzzz…]
solrize has quit [Ping timeout: 255 seconds]
Leopold has joined #riscv
vagrantc has joined #riscv
dobson has quit [Quit: Leaving]
Xav101 has joined #riscv
JanC has quit [Remote host closed the connection]
JanC has joined #riscv
<Xav101> So I'm running into a bit of an odd issue with RISC-V assembly and I'm not sure what's going on. I'm using crosscompiled gas from the riscv-collab /
<Xav101> riscv-gnu-toolchain repo and I'm trying to assemble the instruction "jal 16". According to the ISA manual this is a pseudoinstruction which should assemble to a "jal x1, 16". However when I actually assemble it and then objdump it I get machine code of "000000ef". This has the correct opcode for JAL (1101111) and a destination register of (00001) but the fields for the immediate are just zeroed out. Any idea what's going on?
<Xav101> It just doesn't seem to be encoding the immediate for some reason.
dobson has joined #riscv
<Xav101> Am I missing something obvious here
Tenkawa has quit [Quit: Was I really ever here?]
<dh`> (a) are you assembling to an .o file or to a whole program?
<dh`> and (b) how are you expecting the assembler to interpret that "16"?
<Xav101> a - Just assembling to a .o file.
<Xav101> b - I'd expect it to get interpreted as a signed decimal number and encoded into the J-type immediate field
<dh`> ok, b first.
<dh`> that's not how it works.
<dh`> the target of a branch instruction is an assembler label
<Xav101> Can you not just specify the constant?
<dh`> no
<Xav101> ah
<dh`> not in ~any assembly language
<Xav101> So as is probably just unable to find a label and so it emits a zero
<dh`> second, the symbol doesn't get an address assigned until link time (if then) so there'll be a relocation entry in the .o file that you need to look at to get the full picture
<dh`> no
<dh`> 16 likely means scratch label #16
<dh`> I would expect it to fail if you don't define such a label, though
<Xav101> ok
<dh`> hmm, I'm not sure how it _is_ interpreting just '16'
<Xav101> Numeric label maybe?
<Xav101> for a local reference
<dh`> might actually be treating it as an absolute address after all
<dh`> but, don't do that :-|
<dh`> if you want to call an absolute address for some reason, define an absolute symbol and call that
<dh`> more robust, plus also you don't want to explore dusty and likely untested paths in the toolchain
<Xav101> Ok, cool
<Xav101> Wouldn't that actually emit multiple instructions depending on where it's located
<dh`> I forget what the gas syntax for absolute symbols is, might be just foo = 16
<Xav101> Because jal can only do a +/- 1MB range and anything more needs a jalr
<dh`> if you do it right, nm on the output object file will show an absolute symbol with A
<dh`> yes probably but you need that regardless
<dh`> if you're trying to jump forward 16 bytes you need to put a label 16 bytes forward to jump to
<dh`> (which is annoying to arrange, but it's also something you don't normally ever need to do)
<dh`> I'm not sure what the output encoding I'm seeing in the .o file here means but it's pretty clearly not that
<Xav101> What's the syntax for that? Is it something with %pcrel_high and $pcrel_lo
<Xav101> *%pcrel_lo
<dh`> no, something like jal 1f; nop; nop; nop; nop; 1:
<Xav101> ah
<dh`> %pcrel_lo will give you the low part of the pc-relative offset to the argument symbol
<jrtc27> jal 16 gives 0: ef 00 00 01 jal0x10 <.text+0x10>
<jrtc27> in LLVM
<jrtc27> sounds like gas is just buggy
<jrtc27> integers should work just fine for jumps
<jrtc27> if generally ill-advised
<jrtc27> 0: ef 00 00 00 jal0x0 <.text>
<jrtc27> 0000000000000000: R_RISCV_JAL*ABS*+0x10
<jrtc27> that's what gas gives
<jrtc27> kinda stupid but technically correct
<jrtc27> probably it being overly-conservative about linker relaxations
Xav101 has quit [Remote host closed the connection]
Xav101 has joined #riscv
cousteau has quit [Quit: ♫ I can't forget the day I shot that network down ♫]
pecastro has quit [Ping timeout: 260 seconds]
<dh`> hmm, I used readelf -r and it wasn't clear what the thing it printed was supposed to mean
<dh`> anyway, I swear I remember gas interpreting "4" instead of "4f" as still meaning "4f", or maybe "4b", and getting burned by it
<dh`> (because I'd meant to write 4f and it got me 4b, or vice versa, something like that)
<jrtc27> jal 16; 16: still seems to do the same thing
<jrtc27> as does 16: jal 16
<jrtc27> at least with this version
Xav101 has quit [Ping timeout: 255 seconds]