I do understand, both ADR and ADRP is for PC relative addressing where with 20 bit of immediate address (for ADR) , it can point upto +/-1 MB (2^20) of address range but how +/- 4GB is calculated for ADRP.
Apart from that I have simple snippet:
int g =1;
main()
{
  return g;
}
After disassembling it:
adrp.o:     file format elf64-littleaarch64
Disassembly of section .text:
0000000000000000 <main>:
0:  90000000    adrp    x0, 0 <main>
4:  b9400000    ldr w0, [x0]
8:  d65f03c0    ret
How do the addresses are patched in, and is the address of main at offset > 1MB ?