Skip to content

Instantly share code, notes, and snippets.

@aycanirican
Created February 22, 2012 21:19
Show Gist options
  • Select an option

  • Save aycanirican/1887363 to your computer and use it in GitHub Desktop.

Select an option

Save aycanirican/1887363 to your computer and use it in GitHub Desktop.
dragonflybsd v.s. linux - errno access.
aycan: ~$ uname -sm
Linux x86_64
aycan: ~$ cat t.c
#include <errno.h>
f() { return errno; }
aycan: ~$ gcc -c t.c -o t.o
aycan: ~$ objdump -r t.o
t.o: file format elf64-x86-64
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000005 R_X86_64_PC32 __errno_location-0x0000000000000004
RELOCATION RECORDS FOR [.eh_frame]:
OFFSET TYPE VALUE
0000000000000020 R_X86_64_PC32 .text
***************************
% uname -sm
DragonFly x86_64
% cat t.c
#include <errno.h>
f() { return errno; }
% gcc -c t.c -o t.o
% objdump -r t.o
t.o: file format elf64-x86-64
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
0000000000000010 R_X86_64_GOTTPOFF errno+0xfffffffffffffffc
RELOCATION RECORDS FOR [.eh_frame]:
OFFSET TYPE VALUE
0000000000000020 R_X86_64_PC32 .text
000000000000003c R_X86_64_PC32 .text+0x000000000000001a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment