Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ADRP operates on the 4kB page of the pc (by truncation), not the entire pc. RISC-V could have implicitly added 2k in auipc and balanced out the bias. But they didn't.


I know how ADRP operates. It's symmetric about the truncated PC. It's not symmetric about the actual PC.

As I said in the last post.


I think you are misunderstanding the benefit of having symmetric reach by the page.

On AArch64, you can define a 2 GB contiguous slice of address space, built up out of whatever page size you find convenient for your system and plant a relocatable binary into it, up to 2 GB of size. Any instruction anywhere in the last page can reach any address in the first page, and vice versa.

In RISC-V, if you try to do the same thing, you'd find that while any instructions in the last page can reach any address in the first page with room to spare. But some instructions in the first page cannot reach portions of the last page.

Sure, it doesn't matter most of the time. It isn't ever really an obstacle in practice for the feller writing application code for the platform. But the linker has to be aware of it in the 'medium' code model as a special case for just this particular platform. Somebody had to write that special case to work around the hardware.


The linker code to calculate the necessary auipc and remaining offset for a relocation and do something else when out of bounds, was written years ago, is two lines of code, and no doubt took less time than this conversation.

I don't even know of any application that has 1 GB of code, let alone 2 GB minus 2 KB (2,147,481,600 bytes).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: