Advertisement
Guest User

GOT with cross-gcc

a guest
Aug 2nd, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.22 KB | None | 0 0
  1. # arm-linux-gnu-gcc -c -mcpu=cortex-a5 -ffreestanding -Wall -Wextra -std=c++11 -fno-exceptions -fPIC test.cpp -o test.o
  2. # arm-linux-gnu-objdump -r test.o
  3.  
  4. test.o:     file format elf32-littlearm
  5.  
  6. RELOCATION RECORDS FOR [.text]:
  7. OFFSET   TYPE              VALUE
  8. 00000030 R_ARM_GOTPC       _GLOBAL_OFFSET_TABLE_
  9. 00000034 R_ARM_GOT32       kernel_info
  10.  
  11.  
  12. RELOCATION RECORDS FOR [.data.rel.local]:
  13. OFFSET   TYPE              VALUE
  14. 00000000 R_ARM_ABS32       .rodata
  15. 00000004 R_ARM_ABS32       .rodata
  16. 00000008 R_ARM_ABS32       .rodata
  17.  
  18.  
  19. # arm-linux-gnu-objdump -S test.o
  20.  
  21. test.o:     file format elf32-littlearm
  22.  
  23.  
  24. Disassembly of section .text:
  25.  
  26. 00000000 <_start>:
  27.    0:   e52db004        push    {fp}            ; (str fp, [sp, #-4]!)
  28.    4:   e28db000        add     fp, sp, #0
  29.    8:   e59f2020        ldr     r2, [pc, #32]   ; 30 <_start+0x30>
  30.    c:   e08f2002        add     r2, pc, r2
  31.   10:   e59f301c        ldr     r3, [pc, #28]   ; 34 <_start+0x34>
  32.   14:   e7923003        ldr     r3, [r2, r3]
  33.   18:   e5933000        ldr     r3, [r3]
  34.   1c:   e5d33000        ldrb    r3, [r3]
  35.   20:   e1a00003        mov     r0, r3
  36.   24:   e24bd000        sub     sp, fp, #0
  37.   28:   e49db004        pop     {fp}            ; (ldr fp, [sp], #4)
  38.   2c:   e12fff1e        bx      lr
  39.   30:   0000001c        .word   0x0000001c
  40.   34:   00000000        .word   0x00000000
  41. # arm-linux-gnu-ld -nostdlib -L/usr/lib/gcc/arm-linux-gnueabi/4.8.5 -lgcc test.o -o test
  42. # arm-linux-gnu-objdump -r test
  43.  
  44. test:     file format elf32-littlearm
  45.  
  46. # arm-linux-gnu-objdump -S test
  47.  
  48. test:     file format elf32-littlearm
  49.  
  50.  
  51. Disassembly of section .text:
  52.  
  53. 00010094 <_start>:
  54.    10094:       e52db004        push    {fp}            ; (str fp, [sp, #-4]!)
  55.    10098:       e28db000        add     fp, sp, #0
  56.    1009c:       e59f2020        ldr     r2, [pc, #32]   ; 100c4 <_start+0x30>
  57.    100a0:       e08f2002        add     r2, pc, r2
  58.    100a4:       e59f301c        ldr     r3, [pc, #28]   ; 100c8 <_start+0x34>
  59.    100a8:       e7923003        ldr     r3, [r2, r3]
  60.    100ac:       e5933000        ldr     r3, [r3]
  61.    100b0:       e5d33000        ldrb    r3, [r3]
  62.    100b4:       e1a00003        mov     r0, r3
  63.    100b8:       e24bd000        sub     sp, fp, #0
  64.    100bc:       e49db004        pop     {fp}            ; (ldr fp, [sp], #4)
  65.    100c0:       e12fff1e        bx      lr
  66.    100c4:       00010034        .word   0x00010034
  67.    100c8:       0000000c        .word   0x0000000c
  68. # arm-linux-gnu-objdump -s -j.got test
  69.  
  70. test:     file format elf32-littlearm
  71.  
  72. Contents of section .got:
  73.  200dc 00000000 00000000 00000000 ec000200  ................
  74. # arm-linux-gnu-objdump -t test
  75.  
  76. test:     file format elf32-littlearm
  77.  
  78. SYMBOL TABLE:
  79. 00010094 l    d  .text  00000000 .text
  80. 000100cc l    d  .rodata        00000000 .rodata
  81. 000200dc l    d  .got   00000000 .got
  82. 000200ec l    d  .data  00000000 .data
  83. 00000000 l    d  .comment       00000000 .comment
  84. 00000000 l    d  .ARM.attributes        00000000 .ARM.attributes
  85. 00000000 l    df *ABS*  00000000 test.cpp
  86. 00000000 l    df *ABS*  00000000
  87. 000200dc l     O .got   00000000 _GLOBAL_OFFSET_TABLE_
  88. 000200f8 g       .data  00000000 _bss_end__
  89. 000200f8 g       .data  00000000 __bss_start__
  90. 000200f8 g       .data  00000000 __bss_end__
  91. 00010094 g     F .text  00000038 _start
  92. 000200f8 g       .data  00000000 __bss_start
  93. 000200ec g     O .data  0000000c kernel_info
  94. 000200f8 g       .data  00000000 __end__
  95. 000200f8 g       .data  00000000 _edata
  96. 000200f8 g       .data  00000000 _end
  97.  
  98.  
  99. # arm-linux-gnu-gcc -v
  100. Using built-in specs.
  101. COLLECT_GCC=arm-linux-gnu-gcc
  102. COLLECT_LTO_WRAPPER=/usr/libexec/gcc/arm-linux-gnueabi/4.8.5/lto-wrapper
  103. Target: arm-linux-gnueabi
  104. Configured with: ../gcc-4.8.5-20150702/configure --bindir=/usr/bin --build=x86_64-redhat-linux-gnu --datadir=/usr/share --disable-decimal-float --disable-dependency-tracking --disable-gold --disable-libgomp --disable-libmudflap --disable-libquadmath --disable-libssp --disable-nls --disable-plugin --disable-shared --disable-silent-rules --disable-sjlj-exceptions --disable-threads --enable-checking= --enable-gnu-unique-object --enable-initfini-array --enable-languages=c,c++ --enable-linker-build-id --enable-nls --enable-obsolete --enable-targets=all --exec-prefix=/usr --host=x86_64-redhat-linux-gnu --includedir=/usr/include --infodir=/usr/share/info --libexecdir=/usr/libexec --localstatedir=/var --mandir=/usr/share/man --prefix=/usr --program-prefix=arm-linux-gnu- --sbindir=/usr/sbin --sharedstatedir=/var/lib --sysconfdir=/etc --target=arm-linux-gnueabi --with-bugurl=http://bugzilla.redhat.com/bugzilla/ --with-linker-hash-style=gnu --with-newlib --with-sysroot=/usr/arm-linux-gnu/sys-root --with-system-libunwind --with-system-zlib --without-headers --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/cloog-install
  105. Thread model: single
  106. gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
  107. # arm-linux-gnu-objdump -v
  108. GNU objdump version 2.27-9.el7.1
  109. Copyright (C) 2016 Free Software Foundation, Inc.
  110. This program is free software; you may redistribute it under the terms of
  111. the GNU General Public License version 3 or (at your option) any later version.
  112. This program has absolutely no warranty.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement