| 1 | extern _GLOBAL_OFFSET_TABLE_ |
|---|
| 2 | |
|---|
| 3 | section .rodata |
|---|
| 4 | myvar: dd 0 |
|---|
| 5 | myptr: dd myvar |
|---|
| 6 | |
|---|
| 7 | section .text |
|---|
| 8 | global main |
|---|
| 9 | main: |
|---|
| 10 | push ebx |
|---|
| 11 | call .getgot |
|---|
| 12 | .getgot: |
|---|
| 13 | pop ebx |
|---|
| 14 | add ebx, _GLOBAL_OFFSET_TABLE_ + $$ - .getgot wrt ..gotpc |
|---|
| 15 | mov eax, [myptr + ebx wrt ..gotoff] |
|---|
| 16 | mov eax, [eax] |
|---|
| 17 | pop ebx |
|---|
| 18 | ret |
|---|