Linking in .rodata and .debug_frame using arm-none-eabi-gcc

2

I am trying to link my .o files to generate the ELF to be run on an ARM M0+ bare metal. I am using arm-none-eabi-gcc. If I just have my C file (s) written it links fine and I can run it no problem. (For this I am providing the -lnosys -lc -lm flags to GCC)

However for my purpose I need to 'overwrite' one of the library functions, namely __aeabi_fmul. To do this, I took the disassembly of this function and created a custom file aeabi_fmul.S which I compile separately. Now I need to link this aeabi_fmul.o file with my C source code (so that the final binary will use my implementation of fmul instead of the library's)

It seems to be linking this file in fine (the listing shows that the binary content is identical here), however, if I do an objdump -D there doesn't seem to be any .rodata or ˚ sections in my 'modified' ELF.

This is causing my program to 'randomly' hang while executing a branch instruction, which I'm guessing is linked to these missing sections (because everything else matches 1:1 with the 'working' version)

  1. Is there something else I need to do to get these two sections to be linked?
  2. Could the fact that I am linking in my own __aeabi_fmul be causing these sections to not get linked?

EDIT:

Dissassembly of working code.

main.elf: file format elf32-littlearm

Disassembly of section .text:

00000000 <hang-0x50>:
   0:   40800000    addmi   r0, r0, r0
   4:   00000053    andeq   r0, r0, r3, asr r0
   8:   00000051    andeq   r0, r0, r1, asr r0
   c:   00000051    andeq   r0, r0, r1, asr r0
  10:   00000051    andeq   r0, r0, r1, asr r0
  14:   00000051    andeq   r0, r0, r1, asr r0
  18:   00000051    andeq   r0, r0, r1, asr r0
  1c:   00000051    andeq   r0, r0, r1, asr r0
  20:   00000051    andeq   r0, r0, r1, asr r0
  24:   00000051    andeq   r0, r0, r1, asr r0
  28:   00000051    andeq   r0, r0, r1, asr r0
  2c:   00000051    andeq   r0, r0, r1, asr r0
  30:   00000051    andeq   r0, r0, r1, asr r0
  34:   00000051    andeq   r0, r0, r1, asr r0
  38:   00000051    andeq   r0, r0, r1, asr r0
  3c:   00000051    andeq   r0, r0, r1, asr r0
  40:   00000051    andeq   r0, r0, r1, asr r0
  44:   00000051    andeq   r0, r0, r1, asr r0
  48:   00000051    andeq   r0, r0, r1, asr r0
  4c:   00000051    andeq   r0, r0, r1, asr r0

00000050 <hang>:
  50:   e7fe        b.n 50 <hang>

00000052 <_start>:
  52:   f000 f89b   bl  18c <main>

00000056 <exit>:
  56:   df01        svc 1
  58:   e7fe        b.n 58 <exit+0x2>

0000005a <putchar>:
  5a:   b580        push    {r7, lr}
  5c:   af00        add r7, sp, #0
  5e:   22e0        movs    r2, #224    ; 0xe0
  60:   0612        lsls    r2, r2, #24
  62:   6010        str r0, [r2, #0]
  64:   46bd        mov sp, r7
  66:   bd80        pop {r7, pc}

00000068 <PUT32>:
  68:   6001        str r1, [r0, #0]
  6a:   4770        bx  lr

0000006c <GET32>:
  6c:   6800        ldr r0, [r0, #0]
  6e:   4770        bx  lr

00000070 <PUTGETCLR>:
  70:   6802        ldr r2, [r0, #0]
  72:   438a        bics    r2, r1
  74:   6002        str r2, [r0, #0]
  76:   4770        bx  lr

00000078 <atest>:
  78:   1842        adds    r2, r0, r1
  7a:   2000        movs    r0, #0
  7c:   d701        bvc.n   82 <atest1>
  7e:   2301        movs    r3, #1
  80:   4318        orrs    r0, r3

00000082 <atest1>:
  82:   d301        bcc.n   88 <atest2>
  84:   2302        movs    r3, #2
  86:   4318        orrs    r0, r3

00000088 <atest2>:
  88:   4770        bx  lr

0000008a <stest>:
  8a:   1a42        subs    r2, r0, r1
  8c:   2000        movs    r0, #0
  8e:   d701        bvc.n   94 <stest1>
  90:   2301        movs    r3, #1
  92:   4318        orrs    r0, r3

00000094 <stest1>:
  94:   d301        bcc.n   9a <stest2>
  96:   2302        movs    r3, #2
  98:   4318        orrs    r0, r3

0000009a <stest2>:
  9a:   4770        bx  lr

0000009c <returnvcflags>:
  9c:   d703        bvc.n   a6 <returnvcflags+0xa>
  9e:   d306        bcc.n   ae <returnvcflags+0x12>
  a0:   2003        movs    r0, #3
  a2:   0700        lsls    r0, r0, #28
  a4:   4770        bx  lr
  a6:   d305        bcc.n   b4 <returnvcflags+0x18>
  a8:   2002        movs    r0, #2
  aa:   0700        lsls    r0, r0, #28
  ac:   4770        bx  lr
  ae:   2001        movs    r0, #1
  b0:   0700        lsls    r0, r0, #28
  b2:   4770        bx  lr
  b4:   2000        movs    r0, #0
  b6:   0700        lsls    r0, r0, #28
  b8:   4770        bx  lr

000000ba <testfun1>:
  ba:   2200        movs    r2, #0
  bc:   41d2        rors    r2, r2
  be:   4148        adcs    r0, r1
  c0:   e7ec        b.n 9c <returnvcflags>

000000c2 <testfun2>:
  c2:   2201        movs    r2, #1
  c4:   41d2        rors    r2, r2
  c6:   4148        adcs    r0, r1
  c8:   e7e8        b.n 9c <returnvcflags>

000000ca <testfun3>:
  ca:   2200        movs    r2, #0
  cc:   41d2        rors    r2, r2
  ce:   4188        sbcs    r0, r1
  d0:   e7e4        b.n 9c <returnvcflags>

000000d2 <testfun4>:
  d2:   2201        movs    r2, #1
  d4:   41d2        rors    r2, r2
  d6:   4188        sbcs    r0, r1
  d8:   e7e0        b.n 9c <returnvcflags>

000000da <PUTGETSET>:
  da:   6802        ldr r2, [r0, #0]
  dc:   430a        orrs    r2, r1
  de:   6002        str r2, [r0, #0]
  e0:   4770        bx  lr
    ...

000000e4 <_fini>:
  e4:   46c0        nop         ; (mov r8, r8)
  e6:   4770        bx  lr

000000e8 <__exidx_start>:
  e8:   46c0        nop         ; (mov r8, r8)
  ea:   4770        bx  lr

000000ec <__exidx_end>:
  ec:   46c0        nop         ; (mov r8, r8)
  ee:   4770        bx  lr

000000f0 <__errno>:
  f0:   46c0        nop         ; (mov r8, r8)
  f2:   4770        bx  lr

000000f4 <_isatty>:
  f4:   2300        movs    r3, #0
  f6:   0018        movs    r0, r3
  f8:   4770        bx  lr
  fa:   46c0        nop         ; (mov r8, r8)

000000fc <_fstat>:
  fc:   2300        movs    r3, #0
  fe:   0018        movs    r0, r3
 100:   4770        bx  lr
 102:   46c0        nop         ; (mov r8, r8)

00000104 <puts>:
 104:   b500        push    {lr}
 106:   b085        sub sp, #20
 108:   9001        str r0, [sp, #4]
 10a:   2300        movs    r3, #0
 10c:   9303        str r3, [sp, #12]
 10e:   e009        b.n 124 <puts+0x20>
 110:   9b03        ldr r3, [sp, #12]
 112:   9a01        ldr r2, [sp, #4]
 114:   18d3        adds    r3, r2, r3
 116:   781b        ldrb    r3, [r3, #0]
 118:   0018        movs    r0, r3
 11a:   f7ff ff9e   bl  5a <putchar>
 11e:   9b03        ldr r3, [sp, #12]
 120:   3301        adds    r3, #1
 122:   9303        str r3, [sp, #12]
 124:   9b03        ldr r3, [sp, #12]
 126:   9a01        ldr r2, [sp, #4]
 128:   18d3        adds    r3, r2, r3
 12a:   781b        ldrb    r3, [r3, #0]
 12c:   2b00        cmp r3, #0
 12e:   d1ef        bne.n   110 <puts+0xc>
 130:   46c0        nop         ; (mov r8, r8)
 132:   b005        add sp, #20
 134:   bd00        pop {pc}
 136:   46c0        nop         ; (mov r8, r8)

00000138 <rand>:
 138:   2307        movs    r3, #7
 13a:   0018        movs    r0, r3
 13c:   4770        bx  lr
 13e:   46c0        nop         ; (mov r8, r8)

00000140 <srand>:
 140:   230b        movs    r3, #11
 142:   0018        movs    r0, r3
 144:   4770        bx  lr
 146:   46c0        nop         ; (mov r8, r8)

00000148 <_write>:
 148:   b500        push    {lr}
 14a:   b087        sub sp, #28
 14c:   9003        str r0, [sp, #12]
 14e:   9102        str r1, [sp, #8]
 150:   9201        str r2, [sp, #4]
 152:   2300        movs    r3, #0
 154:   9305        str r3, [sp, #20]
 156:   e00a        b.n 16e <_write+0x26>
 158:   9b02        ldr r3, [sp, #8]
 15a:   781b        ldrb    r3, [r3, #0]
 15c:   0018        movs    r0, r3
 15e:   f7ff ff7c   bl  5a <putchar>
 162:   9b02        ldr r3, [sp, #8]
 164:   3301        adds    r3, #1
 166:   9302        str r3, [sp, #8]
 168:   9b05        ldr r3, [sp, #20]
 16a:   3301        adds    r3, #1
 16c:   9305        str r3, [sp, #20]
 16e:   9a05        ldr r2, [sp, #20]
 170:   9b01        ldr r3, [sp, #4]
 172:   429a        cmp r2, r3
 174:   dbf0        blt.n   158 <_write+0x10>
 176:   9b05        ldr r3, [sp, #20]
 178:   0018        movs    r0, r3
 17a:   b007        add sp, #28
 17c:   bd00        pop {pc}
 17e:   46c0        nop         ; (mov r8, r8)

00000180 <_close>:
 180:   46c0        nop         ; (mov r8, r8)
 182:   4770        bx  lr

00000184 <_read>:
 184:   46c0        nop         ; (mov r8, r8)
 186:   4770        bx  lr

00000188 <_lseek>:
 188:   46c0        nop         ; (mov r8, r8)
 18a:   4770        bx  lr

0000018c <main>:
 18c:   b500        push    {lr}
 18e:   b085        sub sp, #20
 190:   4b06        ldr r3, [pc, #24]   ; (1ac <main+0x20>)
 192:   9303        str r3, [sp, #12]
 194:   4b06        ldr r3, [pc, #24]   ; (1b0 <main+0x24>)
 196:   9302        str r3, [sp, #8]
 198:   9902        ldr r1, [sp, #8]
 19a:   9803        ldr r0, [sp, #12]
 19c:   f000 f80a   bl  1b4 <__aeabi_fmul>
 1a0:   1c03        adds    r3, r0, #0
 1a2:   9301        str r3, [sp, #4]
 1a4:   2300        movs    r3, #0
 1a6:   0018        movs    r0, r3
 1a8:   b005        add sp, #20
 1aa:   bd00        pop {pc}
 1ac:   3fcccccd    svccc   0x00cccccd
 1b0:   400ccccd    andmi   ip, ip, sp, asr #25

000001b4 <__aeabi_fmul>:
 1b4:   b5f0        push    {r4, r5, r6, r7, lr}
 1b6:   4657        mov r7, sl
 1b8:   464e        mov r6, r9
 1ba:   4645        mov r5, r8
 1bc:   0043        lsls    r3, r0, #1
 1be:   b4e0        push    {r5, r6, r7}
 1c0:   0246        lsls    r6, r0, #9
 1c2:   4688        mov r8, r1
 1c4:   0a76        lsrs    r6, r6, #9
 1c6:   0e1f        lsrs    r7, r3, #24
 1c8:   0fc4        lsrs    r4, r0, #31
 1ca:   2f00        cmp r7, #0
 1cc:   d047        beq.n   25e <__aeabi_fmul+0xaa>
 1ce:   2fff        cmp r7, #255    ; 0xff
 1d0:   d025        beq.n   21e <__aeabi_fmul+0x6a>
 1d2:   2300        movs    r3, #0
 1d4:   2580        movs    r5, #128    ; 0x80
 1d6:   469a        mov sl, r3
 1d8:   4699        mov r9, r3
 1da:   00f6        lsls    r6, r6, #3
 1dc:   04ed        lsls    r5, r5, #19
 1de:   432e        orrs    r6, r5
 1e0:   3f7f        subs    r7, #127    ; 0x7f
 1e2:   4643        mov r3, r8
 1e4:   4642        mov r2, r8
 1e6:   025d        lsls    r5, r3, #9
 1e8:   0fd2        lsrs    r2, r2, #31
 1ea:   005b        lsls    r3, r3, #1
 1ec:   0a6d        lsrs    r5, r5, #9
 1ee:   0e1b        lsrs    r3, r3, #24
 1f0:   4690        mov r8, r2
 1f2:   d040        beq.n   276 <__aeabi_fmul+0xc2>
 1f4:   2bff        cmp r3, #255    ; 0xff
 1f6:   d039        beq.n   26c <__aeabi_fmul+0xb8>
 1f8:   2280        movs    r2, #128    ; 0x80
 1fa:   2000        movs    r0, #0
 1fc:   00ed        lsls    r5, r5, #3
 1fe:   04d2        lsls    r2, r2, #19
 200:   4315        orrs    r5, r2
 202:   3b7f        subs    r3, #127    ; 0x7f
 204:   18fb        adds    r3, r7, r3
 206:   4642        mov r2, r8
 208:   4657        mov r7, sl
 20a:   1c59        adds    r1, r3, #1
 20c:   4062        eors    r2, r4
 20e:   468c        mov ip, r1
 210:   4307        orrs    r7, r0
 212:   2f0f        cmp r7, #15
 214:   d85c        bhi.n   2d0 <__aeabi_fmul+0x11c>
 216:   496f        ldr r1, [pc, #444]  ; (3d4 <__aeabi_fmul+0x220>)
 218:   00bf        lsls    r7, r7, #2
 21a:   59c9        ldr r1, [r1, r7]
 21c:   468f        mov pc, r1
 21e:   2e00        cmp r6, #0
 220:   d145        bne.n   2ae <__aeabi_fmul+0xfa>
 222:   2308        movs    r3, #8
 224:   469a        mov sl, r3
 226:   3b06        subs    r3, #6
 228:   4699        mov r9, r3
 22a:   e7da        b.n 1e2 <__aeabi_fmul+0x2e>
 22c:   4642        mov r2, r8
 22e:   2802        cmp r0, #2
 230:   d02d        beq.n   28e <__aeabi_fmul+0xda>
 232:   2803        cmp r0, #3
 234:   d100        bne.n   238 <__aeabi_fmul+0x84>
 236:   e0c3        b.n 3c0 <__aeabi_fmul+0x20c>
 238:   2801        cmp r0, #1
 23a:   d000        beq.n   23e <__aeabi_fmul+0x8a>
 23c:   e0a2        b.n 384 <__aeabi_fmul+0x1d0>
 23e:   2500        movs    r5, #0
 240:   2600        movs    r6, #0
 242:   4002        ands    r2, r0
 244:   b2d4        uxtb    r4, r2
 246:   0276        lsls    r6, r6, #9
 248:   05ed        lsls    r5, r5, #23
 24a:   0a76        lsrs    r6, r6, #9
 24c:   432e        orrs    r6, r5
 24e:   07e4        lsls    r4, r4, #31
 250:   4326        orrs    r6, r4
 252:   0030        movs    r0, r6
 254:   bc1c        pop {r2, r3, r4}
 256:   4690        mov r8, r2
 258:   4699        mov r9, r3
 25a:   46a2        mov sl, r4
 25c:   bdf0        pop {r4, r5, r6, r7, pc}
 25e:   2e00        cmp r6, #0
 260:   d11a        bne.n   298 <__aeabi_fmul+0xe4>
 262:   2304        movs    r3, #4
 264:   469a        mov sl, r3
 266:   3b03        subs    r3, #3
 268:   4699        mov r9, r3
 26a:   e7ba        b.n 1e2 <__aeabi_fmul+0x2e>
 26c:   002a        movs    r2, r5
 26e:   1e51        subs    r1, r2, #1
 270:   418a        sbcs    r2, r1
 272:   1c90        adds    r0, r2, #2
 274:   e7c6        b.n 204 <__aeabi_fmul+0x50>
 276:   2001        movs    r0, #1
 278:   2d00        cmp r5, #0
 27a:   d0c3        beq.n   204 <__aeabi_fmul+0x50>
 27c:   0028        movs    r0, r5
 27e:   f000 f8ad   bl  3dc <__clzsi2>
 282:   1f43        subs    r3, r0, #5
 284:   3076        adds    r0, #118    ; 0x76
 286:   409d        lsls    r5, r3
 288:   4243        negs    r3, r0
 28a:   2000        movs    r0, #0
 28c:   e7ba        b.n 204 <__aeabi_fmul+0x50>
 28e:   2401        movs    r4, #1
 290:   25ff        movs    r5, #255    ; 0xff
 292:   4014        ands    r4, r2
 294:   2600        movs    r6, #0
 296:   e7d6        b.n 246 <__aeabi_fmul+0x92>
 298:   0030        movs    r0, r6
 29a:   f000 f89f   bl  3dc <__clzsi2>
 29e:   1f43        subs    r3, r0, #5
 2a0:   409e        lsls    r6, r3
 2a2:   2300        movs    r3, #0
 2a4:   3076        adds    r0, #118    ; 0x76
 2a6:   4247        negs    r7, r0
 2a8:   469a        mov sl, r3
 2aa:   4699        mov r9, r3
 2ac:   e799        b.n 1e2 <__aeabi_fmul+0x2e>
 2ae:   230c        movs    r3, #12
 2b0:   469a        mov sl, r3
 2b2:   3b09        subs    r3, #9
 2b4:   4699        mov r9, r3
 2b6:   e794        b.n 1e2 <__aeabi_fmul+0x2e>
 2b8:   2680        movs    r6, #128    ; 0x80
 2ba:   2400        movs    r4, #0
 2bc:   03f6        lsls    r6, r6, #15
 2be:   25ff        movs    r5, #255    ; 0xff
 2c0:   e7c1        b.n 246 <__aeabi_fmul+0x92>
 2c2:   0035        movs    r5, r6
 2c4:   4648        mov r0, r9
 2c6:   e7b2        b.n 22e <__aeabi_fmul+0x7a>
 2c8:   0035        movs    r5, r6
 2ca:   0022        movs    r2, r4
 2cc:   4648        mov r0, r9
 2ce:   e7ae        b.n 22e <__aeabi_fmul+0x7a>
 2d0:   0429        lsls    r1, r5, #16
 2d2:   0c09        lsrs    r1, r1, #16
 2d4:   0008        movs    r0, r1
 2d6:   0c37        lsrs    r7, r6, #16
 2d8:   0436        lsls    r6, r6, #16
 2da:   0c36        lsrs    r6, r6, #16
 2dc:   0c2c        lsrs    r4, r5, #16
 2de:   4379        muls    r1, r7
 2e0:   4370        muls    r0, r6
 2e2:   4367        muls    r7, r4
 2e4:   4374        muls    r4, r6
 2e6:   0c06        lsrs    r6, r0, #16
 2e8:   1864        adds    r4, r4, r1
 2ea:   1936        adds    r6, r6, r4
 2ec:   42b1        cmp r1, r6
 2ee:   d903        bls.n   2f8 <__aeabi_fmul+0x144>
 2f0:   2180        movs    r1, #128    ; 0x80
 2f2:   0249        lsls    r1, r1, #9
 2f4:   4688        mov r8, r1
 2f6:   4447        add r7, r8
 2f8:   0400        lsls    r0, r0, #16
 2fa:   0c00        lsrs    r0, r0, #16
 2fc:   0431        lsls    r1, r6, #16
 2fe:   1809        adds    r1, r1, r0
 300:   018d        lsls    r5, r1, #6
 302:   1e68        subs    r0, r5, #1
 304:   4185        sbcs    r5, r0
 306:   0e89        lsrs    r1, r1, #26
 308:   4329        orrs    r1, r5
 30a:   0c35        lsrs    r5, r6, #16
 30c:   19ed        adds    r5, r5, r7
 30e:   01ad        lsls    r5, r5, #6
 310:   430d        orrs    r5, r1
 312:   0129        lsls    r1, r5, #4
 314:   d504        bpl.n   320 <__aeabi_fmul+0x16c>
 316:   2301        movs    r3, #1
 318:   0869        lsrs    r1, r5, #1
 31a:   401d        ands    r5, r3
 31c:   4663        mov r3, ip
 31e:   430d        orrs    r5, r1
 320:   0019        movs    r1, r3
 322:   317f        adds    r1, #127    ; 0x7f
 324:   2900        cmp r1, #0
 326:   dd25        ble.n   374 <__aeabi_fmul+0x1c0>
 328:   0768        lsls    r0, r5, #29
 32a:   d004        beq.n   336 <__aeabi_fmul+0x182>
 32c:   200f        movs    r0, #15
 32e:   4028        ands    r0, r5
 330:   2804        cmp r0, #4
 332:   d000        beq.n   336 <__aeabi_fmul+0x182>
 334:   3504        adds    r5, #4
 336:   0128        lsls    r0, r5, #4
 338:   d503        bpl.n   342 <__aeabi_fmul+0x18e>
 33a:   4927        ldr r1, [pc, #156]  ; (3d8 <__aeabi_fmul+0x224>)
 33c:   3380        adds    r3, #128    ; 0x80
 33e:   400d        ands    r5, r1
 340:   0019        movs    r1, r3
 342:   29fe        cmp r1, #254    ; 0xfe
 344:   dca3        bgt.n   28e <__aeabi_fmul+0xda>
 346:   2401        movs    r4, #1
 348:   01ad        lsls    r5, r5, #6
 34a:   0a6e        lsrs    r6, r5, #9
 34c:   4014        ands    r4, r2
 34e:   b2cd        uxtb    r5, r1
 350:   e779        b.n 246 <__aeabi_fmul+0x92>
 352:   2080        movs    r0, #128    ; 0x80
 354:   03c0        lsls    r0, r0, #15
 356:   4206        tst r6, r0
 358:   d007        beq.n   36a <__aeabi_fmul+0x1b6>
 35a:   4205        tst r5, r0
 35c:   d105        bne.n   36a <__aeabi_fmul+0x1b6>
 35e:   4328        orrs    r0, r5
 360:   0246        lsls    r6, r0, #9
 362:   0a76        lsrs    r6, r6, #9
 364:   4644        mov r4, r8
 366:   25ff        movs    r5, #255    ; 0xff
 368:   e76d        b.n 246 <__aeabi_fmul+0x92>
 36a:   4306        orrs    r6, r0
 36c:   0276        lsls    r6, r6, #9
 36e:   0a76        lsrs    r6, r6, #9
 370:   25ff        movs    r5, #255    ; 0xff
 372:   e768        b.n 246 <__aeabi_fmul+0x92>
 374:   2401        movs    r4, #1
 376:   1a61        subs    r1, r4, r1
 378:   291b        cmp r1, #27
 37a:   dd05        ble.n   388 <__aeabi_fmul+0x1d4>
 37c:   4014        ands    r4, r2
 37e:   2500        movs    r5, #0
 380:   2600        movs    r6, #0
 382:   e760        b.n 246 <__aeabi_fmul+0x92>
 384:   4663        mov r3, ip
 386:   e7cb        b.n 320 <__aeabi_fmul+0x16c>
 388:   002e        movs    r6, r5
 38a:   2320        movs    r3, #32
 38c:   40ce        lsrs    r6, r1
 38e:   1a59        subs    r1, r3, r1
 390:   408d        lsls    r5, r1
 392:   1e6b        subs    r3, r5, #1
 394:   419d        sbcs    r5, r3
 396:   432e        orrs    r6, r5
 398:   0773        lsls    r3, r6, #29
 39a:   d004        beq.n   3a6 <__aeabi_fmul+0x1f2>
 39c:   230f        movs    r3, #15
 39e:   4033        ands    r3, r6
 3a0:   2b04        cmp r3, #4
 3a2:   d000        beq.n   3a6 <__aeabi_fmul+0x1f2>
 3a4:   3604        adds    r6, #4
 3a6:   0173        lsls    r3, r6, #5
 3a8:   d504        bpl.n   3b4 <__aeabi_fmul+0x200>
 3aa:   2401        movs    r4, #1
 3ac:   2501        movs    r5, #1
 3ae:   4014        ands    r4, r2
 3b0:   2600        movs    r6, #0
 3b2:   e748        b.n 246 <__aeabi_fmul+0x92>
 3b4:   2401        movs    r4, #1
 3b6:   01b6        lsls    r6, r6, #6
 3b8:   0a76        lsrs    r6, r6, #9
 3ba:   4014        ands    r4, r2
 3bc:   2500        movs    r5, #0
 3be:   e742        b.n 246 <__aeabi_fmul+0x92>
 3c0:   2680        movs    r6, #128    ; 0x80
 3c2:   2401        movs    r4, #1
 3c4:   03f6        lsls    r6, r6, #15
 3c6:   432e        orrs    r6, r5
 3c8:   0276        lsls    r6, r6, #9
 3ca:   0a76        lsrs    r6, r6, #9
 3cc:   4014        ands    r4, r2
 3ce:   25ff        movs    r5, #255    ; 0xff
 3d0:   e739        b.n 246 <__aeabi_fmul+0x92>
 3d2:   46c0        nop         ; (mov r8, r8)
 3d4:   00000418    andeq   r0, r0, r8, lsl r4
 3d8:   f7ffffff            ; <UNDEFINED> instruction: 0xf7ffffff

000003dc <__clzsi2>:
 3dc:   211c        movs    r1, #28
 3de:   2301        movs    r3, #1
 3e0:   041b        lsls    r3, r3, #16
 3e2:   4298        cmp r0, r3
 3e4:   d301        bcc.n   3ea <__clzsi2+0xe>
 3e6:   0c00        lsrs    r0, r0, #16
 3e8:   3910        subs    r1, #16
 3ea:   0a1b        lsrs    r3, r3, #8
 3ec:   4298        cmp r0, r3
 3ee:   d301        bcc.n   3f4 <__clzsi2+0x18>
 3f0:   0a00        lsrs    r0, r0, #8
 3f2:   3908        subs    r1, #8
 3f4:   091b        lsrs    r3, r3, #4
 3f6:   4298        cmp r0, r3
 3f8:   d301        bcc.n   3fe <__clzsi2+0x22>
 3fa:   0900        lsrs    r0, r0, #4
 3fc:   3904        subs    r1, #4
 3fe:   a202        add r2, pc, #8  ; (adr r2, 408 <__clzsi2+0x2c>)
 400:   5c10        ldrb    r0, [r2, r0]
 402:   1840        adds    r0, r0, r1
 404:   4770        bx  lr
 406:   46c0        nop         ; (mov r8, r8)
 408:   02020304    andeq   r0, r2, #4, 6   ; 0x10000000
 40c:   01010101    tsteq   r1, r1, lsl #2
    ...

Disassembly of section .rodata:

00000418 <.rodata>:
 418:   000002d0    ldrdeq  r0, [r0], -r0   ; <UNPREDICTABLE>
 41c:   0000022e    andeq   r0, r0, lr, lsr #4
 420:   0000022e    andeq   r0, r0, lr, lsr #4
 424:   0000022c    andeq   r0, r0, ip, lsr #4
 428:   000002c2    andeq   r0, r0, r2, asr #5
 42c:   000002c2    andeq   r0, r0, r2, asr #5
 430:   000002b8            ; <UNDEFINED> instruction: 0x000002b8
 434:   0000022c    andeq   r0, r0, ip, lsr #4
 438:   000002c2    andeq   r0, r0, r2, asr #5
 43c:   000002b8            ; <UNDEFINED> instruction: 0x000002b8
 440:   000002c2    andeq   r0, r0, r2, asr #5
 444:   0000022c    andeq   r0, r0, ip, lsr #4
 448:   000002c8    andeq   r0, r0, r8, asr #5
 44c:   000002c8    andeq   r0, r0, r8, asr #5
 450:   000002c8    andeq   r0, r0, r8, asr #5
 454:   00000352    andeq   r0, r0, r2, asr r3

Disassembly of section .data:

00000458 <heapCurrent>:
 458:   40000000    andmi   r0, r0, r0

Disassembly of section .ARM.attributes:

00000000 <.ARM.attributes>:
   0:   00002d41    andeq   r2, r0, r1, asr #26
   4:   61656100    cmnvs   r5, r0, lsl #2
   8:   01006962    tsteq   r0, r2, ror #18
   c:   00000023    andeq   r0, r0, r3, lsr #32
  10:   726f4305    rsbvc   r4, pc, #335544320  ; 0x14000000
  14:   2d786574    cfldr64cs   mvdx6, [r8, #-464]! ; 0xfffffe30
  18:   002b304d    eoreq   r3, fp, sp, asr #32
  1c:   4d070c06    stcmi   12, cr0, [r7, #-24] ; 0xffffffe8
  20:   04120109    ldreq   r0, [r2], #-265 ; 0xfffffef7
  24:   01150114    tsteq   r5, r4, lsl r1
  28:   01180317    tsteq   r8, r7, lsl r3
  2c:   Address 0x0000002c is out of bounds.


Disassembly of section .comment:

00000000 <.comment>:
   0:   3a434347    bcc 10d0d24 <heapCurrent+0x10d08cc>
   4:   4e472820    cdpmi   8, 4, cr2, cr7, cr0, {1}
   8:   6f542055    svcvs   0x00542055
   c:   20736c6f    rsbscs  r6, r3, pc, ror #24
  10:   20726f66    rsbscs  r6, r2, r6, ror #30
  14:   204d5241    subcs   r5, sp, r1, asr #4
  18:   65626d45    strbvs  r6, [r2, #-3397]!   ; 0xfffff2bb
  1c:   64656464    strbtvs r6, [r5], #-1124    ; 0xfffffb9c
  20:   6f725020    svcvs   0x00725020
  24:   73736563    cmnvc   r3, #415236096  ; 0x18c00000
  28:   2973726f    ldmdbcs r3!, {r0, r1, r2, r3, r5, r6, r9, ip, sp, lr}^
  2c:   322e3520    eorcc   r3, lr, #32, 10 ; 0x8000000
  30:   3220312e    eorcc   r3, r0, #-2147483637    ; 0x8000000b
  34:   31353130    teqcc   r5, r0, lsr r1
  38:   20323032    eorscs  r3, r2, r2, lsr r0
  3c:   6c657228    sfmvs   f7, 2, [r5], #-160  ; 0xffffff60
  40:   65736165    ldrbvs  r6, [r3, #-357]!    ; 0xfffffe9b
  44:   415b2029    cmpmi   fp, r9, lsr #32
  48:   652f4d52    strvs   r4, [pc, #-3410]!   ; fffff2fe <_stacktop+0xbf7ff2fe>
  4c:   6465626d    strbtvs r6, [r5], #-621 ; 0xfffffd93
  50:   2d646564    cfstr64cs   mvdx6, [r4, #-400]! ; 0xfffffe70
  54:   72622d35    rsbvc   r2, r2, #3392   ; 0xd40
  58:   68636e61    stmdavs r3!, {r0, r5, r6, r9, sl, fp, sp, lr}^
  5c:   76657220    strbtvc r7, [r5], -r0, lsr #4
  60:   6f697369    svcvs   0x00697369
  64:   3332206e    teqcc   r2, #110    ; 0x6e
  68:   38343831    ldmdacc r4!, {r0, r4, r5, fp, ip, sp}
  6c:   Address 0x0000006c is out of bounds.


Disassembly of section .debug_frame:

00000000 <.debug_frame>:
   0:   0000000c    andeq   r0, r0, ip
   4:   ffffffff            ; <UNDEFINED> instruction: 0xffffffff
   8:   7c020001    stcvc   0, cr0, [r2], {1}
   c:   000d0c0e    andeq   r0, sp, lr, lsl #24
  10:   00000024    andeq   r0, r0, r4, lsr #32
  14:   00000000    andeq   r0, r0, r0
  18:   000001b4            ; <UNDEFINED> instruction: 0x000001b4
  1c:   00000228    andeq   r0, r0, r8, lsr #4
  20:   84140e41    ldrhi   r0, [r4], #-3649    ; 0xfffff1bf
  24:   86048505    strhi   r8, [r4], -r5, lsl #10
  28:   8e028703    cdphi   7, 0, cr8, cr2, cr3, {0}
  2c:   200e4501    andcs   r4, lr, r1, lsl #10
  30:   07890888    streq   r0, [r9, r8, lsl #17]
  34:   0000068a    andeq   r0, r0, sl, lsl #13

Disassembly of non-working code:

test.elf:     file format elf32-littlearm


Disassembly of section .text:

... (all the code from 0x0 to 0x40C are identical. I just created explicit labels within the last two functions to help me with what im trying to do!)

000003fe <twentynine>:
 3fe:   a202        add r2, pc, #8  ; (adr r2, 408 <twentynine+0xa>)
 400:   5c10        ldrb    r0, [r2, r0]
 402:   1840        adds    r0, r0, r1
 404:   4770        bx  lr
 406:   46c0        nop         ; (mov r8, r8)
 408:   02020304    andeq   r0, r2, #4, 6   ; 0x10000000
 40c:   01010101    tsteq   r1, r1, lsl #2

Disassembly of section .data:

00000410 <heapCurrent>:
 410:   40000000    andmi   r0, r0, r0

Disassembly of section .ARM.attributes:

00000000 <.ARM.attributes>:
   0:   00002d41    andeq   r2, r0, r1, asr #26
   4:   61656100    cmnvs   r5, r0, lsl #2
   8:   01006962    tsteq   r0, r2, ror #18
   c:   00000023    andeq   r0, r0, r3, lsr #32
  10:   726f4305    rsbvc   r4, pc, #335544320  ; 0x14000000
  14:   2d786574    cfldr64cs   mvdx6, [r8, #-464]! ; 0xfffffe30
  18:   002b304d    eoreq   r3, fp, sp, asr #32
  1c:   4d070c06    stcmi   12, cr0, [r7, #-24] ; 0xffffffe8
  20:   04120109    ldreq   r0, [r2], #-265 ; 0xfffffef7
  24:   01150114    tsteq   r5, r4, lsl r1
  28:   01180317    tsteq   r8, r7, lsl r3
  2c:   Address 0x0000002c is out of bounds.


Disassembly of section .comment:

00000000 <.comment>:
   0:   3a434347    bcc 10d0d24 <heapCurrent+0x10d0914>
   4:   4e472820    cdpmi   8, 4, cr2, cr7, cr0, {1}
   8:   6f542055    svcvs   0x00542055
   c:   20736c6f    rsbscs  r6, r3, pc, ror #24
  10:   20726f66    rsbscs  r6, r2, r6, ror #30
  14:   204d5241    subcs   r5, sp, r1, asr #4
  18:   65626d45    strbvs  r6, [r2, #-3397]!   ; 0xfffff2bb
  1c:   64656464    strbtvs r6, [r5], #-1124    ; 0xfffffb9c
  20:   6f725020    svcvs   0x00725020
  24:   73736563    cmnvc   r3, #415236096  ; 0x18c00000
  28:   2973726f    ldmdbcs r3!, {r0, r1, r2, r3, r5, r6, r9, ip, sp, lr}^
  2c:   322e3520    eorcc   r3, lr, #32, 10 ; 0x8000000
  30:   3220312e    eorcc   r3, r0, #-2147483637    ; 0x8000000b
  34:   31353130    teqcc   r5, r0, lsr r1
  38:   20323032    eorscs  r3, r2, r2, lsr r0
  3c:   6c657228    sfmvs   f7, 2, [r5], #-160  ; 0xffffff60
  40:   65736165    ldrbvs  r6, [r3, #-357]!    ; 0xfffffe9b
  44:   415b2029    cmpmi   fp, r9, lsr #32
  48:   652f4d52    strvs   r4, [pc, #-3410]!   ; fffff2fe <_stacktop+0xbf7ff2fe>
  4c:   6465626d    strbtvs r6, [r5], #-621 ; 0xfffffd93
  50:   2d646564    cfstr64cs   mvdx6, [r4, #-400]! ; 0xfffffe70
  54:   72622d35    rsbvc   r2, r2, #3392   ; 0xd40
  58:   68636e61    stmdavs r3!, {r0, r5, r6, r9, sl, fp, sp, lr}^
  5c:   76657220    strbtvc r7, [r5], -r0, lsr #4
  60:   6f697369    svcvs   0x00697369
  64:   3332206e    teqcc   r2, #110    ; 0x6e
  68:   38343831    ldmdacc r4!, {r0, r4, r5, fp, ip, sp}
  6c:   Address 0x0000006c is out of bounds.
c
arm
bare-metal
asked on Stack Overflow Jul 20, 2017 by user3397008 • edited Jul 24, 2017 by user3397008

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0