I'm on an Ubuntu ( 22.04.3 ) x86_64 system. I have this little C program in a file named test.c :
void fx1(){
int b = 20;
b++;
}
int main(){
int a = 10;
a++;
fx1();
}
I've compiled this program with "gcc test.c -o test" and then ran "objdump -d test" and I got this :
0000000000001129 <fx1>:
1129: f3 0f 1e fa endbr64
112d: 55 push %rbp
112e: 48 89 e5 mov %rsp,%rbp
1131: c7 45 fc 14 00 00 00 movl $0x14,-0x4(%rbp)
1138: 83 45 fc 01 addl $0x1,-0x4(%rbp)
113c: 90 nop
113d: 5d pop %rbp
113e: c3 ret
000000000000113f <main>:
113f: f3 0f 1e fa endbr64
1143: 55 push %rbp
1144: 48 89 e5 mov %rsp,%rbp
1147: 48 83 ec 10 sub $0x10,%rsp
114b: c7 45 fc 0a 00 00 00 movl $0xa,-0x4(%rbp)
1152: 83 45 fc 01 addl $0x1,-0x4(%rbp)
1156: b8 00 00 00 00 mov $0x0,%eax
115b: e8 c9 ff ff ff call 1129 <fx1>
1160: b8 00 00 00 00 mov $0x0,%eax
1165: c9 leave
1166: c3 ret
I know that these addresses are not definitive because of ASLR and other stuff. So my question: how can I get the definitive virtual addresses for this program ?