티스토리 뷰

Study/Linux

[Linux] hardfloat compile과 softfloat compile시 차이

생각많은 소심남 2016. 5. 31. 16:58

cc=
 - softfloat : arm-linux-gnueabi-gcc (gcc 4.7.1 for arm)
 - hardfloat : arm-linux-gnueabihf-gcc (gcc 4.7.1 for arm)

compile option =
 - softfloat : -msoft-float
 - hardfloat : -mhard-float

용량 차이 : 차이 없음

chanseok.kang@handel:~$ ls -al test* -rwxr-xr-x 1 chanseok.kang platform 8496 May 31 16:34 test -rwxr-xr-x 1 chanseok.kang platform 8496 May 31 16:34 test_hf

readelf -A시 정보 :
 - test

chanseok.kang@handel:~$ arm-linux-gnueabi-readelf test -A
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "7-A"
  Tag_CPU_arch: v7
  Tag_CPU_arch_profile: Application
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-2
  Tag_FP_arch: VFPv3-D16
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_align_preserved: 8-byte, except leaf SP
  Tag_ABI_enum_size: int
  Tag_ABI_HardFP_use: SP and DP
  Tag_CPU_unaligned_access: v6

- test_hf

chanseok.kang@handel:~$ arm-linux-gnueabi-readelf test_hf -A
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "7-A"
  Tag_CPU_arch: v7
  Tag_CPU_arch_profile: Application
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-2
  Tag_FP_arch: VFPv3-D16
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_align_preserved: 8-byte, except leaf SP
  Tag_ABI_enum_size: int
  Tag_ABI_HardFP_use: SP and DP
  Tag_ABI_VFP_args: VFP registers
  Tag_CPU_unaligned_access: v6
  Tag_DIV_use: Not allowed

objdump -d를 통해서 disassemble했을때 결과

- test

chanseok.kang@handel:~$ arm-linux-gnueabi-objdump test -d

test:     file format elf32-littlearm


Disassembly of section .init:

000082e0 <_init>:
    82e0:       b508            push    {r3, lr}
    82e2:       f000 f849       bl      8378 <call_gmon_start>
    82e6:       bf00            nop
    82e8:       bd08            pop     {r3, pc}

Disassembly of section .plt:

000082ec <.plt>:
    82ec:       e52de004        push    {lr}            ; (str lr, [sp, #-4]!)
    82f0:       e59fe004        ldr     lr, [pc, #4]    ; 82fc <_init+0x1c>
    82f4:       e08fe00e        add     lr, pc, lr
    82f8:       e5bef008        ldr     pc, [lr, #8]!
    82fc:       00008d04        .word   0x00008d04
    8300:       e28fc600        add     ip, pc, #0
    8304:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8308:       e5bcfd04        ldr     pc, [ip, #3332]!        ; 0xd04
    830c:       e28fc600        add     ip, pc, #0
    8310:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8314:       e5bcfcfc        ldr     pc, [ip, #3324]!        ; 0xcfc
    8318:       e28fc600        add     ip, pc, #0
    831c:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8320:       e5bcfcf4        ldr     pc, [ip, #3316]!        ; 0xcf4
    8324:       4778            bx      pc
    8326:       46c0            nop                     ; (mov r8, r8)
    8328:       e28fc600        add     ip, pc, #0
    832c:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8330:       e5bcfce8        ldr     pc, [ip, #3304]!        ; 0xce8
    8334:       e28fc600        add     ip, pc, #0
    8338:       e28cca08        add     ip, ip, #32768  ; 0x8000
    833c:       e5bcfce0        ldr     pc, [ip, #3296]!        ; 0xce0

Disassembly of section .text:

00008340 <_start>:
    8340:       f04f 0b00       mov.w   fp, #0
    8344:       f04f 0e00       mov.w   lr, #0
    8348:       f85d 1b04       ldr.w   r1, [sp], #4
    834c:       466a            mov     r2, sp
    834e:       f84d 2d04       str.w   r2, [sp, #-4]!
    8352:       f84d 0d04       str.w   r0, [sp, #-4]!
    8356:       f8df c014       ldr.w   ip, [pc, #20]   ; 836c <_start+0x2c>
    835a:       f84d cd04       str.w   ip, [sp, #-4]!
    835e:       4804            ldr     r0, [pc, #16]   ; (8370 <_start+0x30>)
    8360:       4b04            ldr     r3, [pc, #16]   ; (8374 <_start+0x34>)
    8362:       f7ff efda       blx     8318 <_init+0x38>
    8366:       f7ff efe6       blx     8334 <_init+0x54>
    836a:       0000            .short  0x0000
    836c:       00008815        .word   0x00008815
    8370:       00008419        .word   0x00008419
    8374:       000087d1        .word   0x000087d1

00008378 <call_gmon_start>:
    8378:       4b03            ldr     r3, [pc, #12]   ; (8388 <call_gmon_start+0x10>)
    837a:       4a04            ldr     r2, [pc, #16]   ; (838c <call_gmon_start+0x14>)
    837c:       447b            add     r3, pc
    837e:       589b            ldr     r3, [r3, r2]
    8380:       b10b            cbz     r3, 8386 <call_gmon_start+0xe>
    8382:       f7ff bfcf       b.w     8324 <_init+0x44>
    8386:       4770            bx      lr
    8388:       00008c80        .word   0x00008c80
    838c:       00000020        .word   0x00000020

00008390 <deregister_tm_clones>:
    8390:       b508            push    {r3, lr}
    8392:       4805            ldr     r0, [pc, #20]   ; (83a8 <deregister_tm_clones+0x18>)
    8394:       4b05            ldr     r3, [pc, #20]   ; (83ac <deregister_tm_clones+0x1c>)
    8396:       1a1b            subs    r3, r3, r0
    8398:       2b06            cmp     r3, #6
    839a:       d800            bhi.n   839e <deregister_tm_clones+0xe>
    839c:       bd08            pop     {r3, pc}
    839e:       4b04            ldr     r3, [pc, #16]   ; (83b0 <deregister_tm_clones+0x20>)
    83a0:       2b00            cmp     r3, #0
    83a2:       d0fb            beq.n   839c <deregister_tm_clones+0xc>
    83a4:       4798            blx     r3
    83a6:       e7f9            b.n     839c <deregister_tm_clones+0xc>
    83a8:       0001102c        .word   0x0001102c
    83ac:       0001102f        .word   0x0001102f
    83b0:       00000000        .word   0x00000000

000083b4 <register_tm_clones>:
    83b4:       b508            push    {r3, lr}
    83b6:       4807            ldr     r0, [pc, #28]   ; (83d4 <register_tm_clones+0x20>)
    83b8:       4b07            ldr     r3, [pc, #28]   ; (83d8 <register_tm_clones+0x24>)
    83ba:       1a1b            subs    r3, r3, r0
    83bc:       109b            asrs    r3, r3, #2
    83be:       eb03 73d3       add.w   r3, r3, r3, lsr #31
    83c2:       1059            asrs    r1, r3, #1
    83c4:       d100            bne.n   83c8 <register_tm_clones+0x14>
    83c6:       bd08            pop     {r3, pc}
    83c8:       4a04            ldr     r2, [pc, #16]   ; (83dc <register_tm_clones+0x28>)
    83ca:       2a00            cmp     r2, #0
    83cc:       d0fb            beq.n   83c6 <register_tm_clones+0x12>
    83ce:       4790            blx     r2
    83d0:       e7f9            b.n     83c6 <register_tm_clones+0x12>
    83d2:       bf00            nop
    83d4:       0001102c        .word   0x0001102c
    83d8:       0001102c        .word   0x0001102c
    83dc:       00000000        .word   0x00000000

000083e0 <__do_global_dtors_aux>:
    83e0:       b510            push    {r4, lr}
    83e2:       4c04            ldr     r4, [pc, #16]   ; (83f4 <__do_global_dtors_aux+0x14>)
    83e4:       7823            ldrb    r3, [r4, #0]
    83e6:       b91b            cbnz    r3, 83f0 <__do_global_dtors_aux+0x10>
    83e8:       f7ff ffd2       bl      8390 <deregister_tm_clones>
    83ec:       2301            movs    r3, #1
    83ee:       7023            strb    r3, [r4, #0]
    83f0:       bd10            pop     {r4, pc}
    83f2:       bf00            nop
    83f4:       0001102c        .word   0x0001102c

000083f8 <frame_dummy>:
    83f8:       4805            ldr     r0, [pc, #20]   ; (8410 <frame_dummy+0x18>)
    83fa:       b508            push    {r3, lr}
    83fc:       6803            ldr     r3, [r0, #0]
    83fe:       b113            cbz     r3, 8406 <frame_dummy+0xe>
    8400:       4b04            ldr     r3, [pc, #16]   ; (8414 <frame_dummy+0x1c>)
    8402:       b103            cbz     r3, 8406 <frame_dummy+0xe>
    8404:       4798            blx     r3
    8406:       e8bd 4008       ldmia.w sp!, {r3, lr}
    840a:       f7ff bfd3       b.w     83b4 <register_tm_clones>
    840e:       bf00            nop
    8410:       00010f14        .word   0x00010f14
    8414:       00000000        .word   0x00000000

00008418 <main>:
    8418:       b580            push    {r7, lr}
    841a:       b082            sub     sp, #8
    841c:       af00            add     r7, sp, #0
    841e:       4b0f            ldr     r3, [pc, #60]   ; (845c <main+0x44>)
    8420:       607b            str     r3, [r7, #4]
    8422:       f648 0024       movw    r0, #34852      ; 0x8824
    8426:       f2c0 0000       movt    r0, #0
    842a:       f7ff ef70       blx     830c <_init+0x2c>
    842e:       f648 0034       movw    r0, #34868      ; 0x8834
    8432:       f2c0 0000       movt    r0, #0
    8436:       f7ff ef6a       blx     830c <_init+0x2c>
    843a:       6878            ldr     r0, [r7, #4]
    843c:       f000 f974       bl      8728 <__aeabi_f2d>
    8440:       4602            mov     r2, r0
    8442:       460b            mov     r3, r1
    8444:       f648 003c       movw    r0, #34876      ; 0x883c
    8448:       f2c0 0000       movt    r0, #0
    844c:       f7ff ef58       blx     8300 <_init+0x20>
    8450:       2300            movs    r3, #0
    8452:       4618            mov     r0, r3
    8454:       f107 0708       add.w   r7, r7, #8
    8458:       46bd            mov     sp, r7
    845a:       bd80            pop     {r7, pc}
    845c:       4048f5c3        .word   0x4048f5c3

00008460 <__aeabi_drsub>:
    8460:       f081 4100       eor.w   r1, r1, #2147483648     ; 0x80000000
    8464:       e002            b.n     846c <__adddf3>
    8466:       bf00            nop

00008468 <__aeabi_dsub>:
    8468:       f083 4300       eor.w   r3, r3, #2147483648     ; 0x80000000

0000846c <__adddf3>:
    846c:       b530            push    {r4, r5, lr}
    846e:       ea4f 0441       mov.w   r4, r1, lsl #1
    8472:       ea4f 0543       mov.w   r5, r3, lsl #1
    8476:       ea94 0f05       teq     r4, r5
    847a:       bf08            it      eq
    847c:       ea90 0f02       teqeq   r0, r2
    8480:       bf1f            itttt   ne
    8482:       ea54 0c00       orrsne.w        ip, r4, r0
    8486:       ea55 0c02       orrsne.w        ip, r5, r2
    848a:       ea7f 5c64       mvnsne.w        ip, r4, asr #21
    848e:       ea7f 5c65       mvnsne.w        ip, r5, asr #21
    8492:       f000 80e2       beq.w   865a <__adddf3+0x1ee>
    8496:       ea4f 5454       mov.w   r4, r4, lsr #21
    849a:       ebd4 5555       rsbs    r5, r4, r5, lsr #21
    849e:       bfb8            it      lt
    84a0:       426d            neglt   r5, r5
    84a2:       dd0c            ble.n   84be <__adddf3+0x52>
    84a4:       442c            add     r4, r5
    84a6:       ea80 0202       eor.w   r2, r0, r2
    84aa:       ea81 0303       eor.w   r3, r1, r3
    84ae:       ea82 0000       eor.w   r0, r2, r0
    84b2:       ea83 0101       eor.w   r1, r3, r1
    84b6:       ea80 0202       eor.w   r2, r0, r2
    84ba:       ea81 0303       eor.w   r3, r1, r3
    84be:       2d36            cmp     r5, #54 ; 0x36
    84c0:       bf88            it      hi
    84c2:       bd30            pophi   {r4, r5, pc}
    84c4:       f011 4f00       tst.w   r1, #2147483648 ; 0x80000000
    84c8:       ea4f 3101       mov.w   r1, r1, lsl #12
    84cc:       f44f 1c80       mov.w   ip, #1048576    ; 0x100000
    84d0:       ea4c 3111       orr.w   r1, ip, r1, lsr #12
    84d4:       d002            beq.n   84dc <__adddf3+0x70>
    84d6:       4240            negs    r0, r0
    84d8:       eb61 0141       sbc.w   r1, r1, r1, lsl #1
    84dc:       f013 4f00       tst.w   r3, #2147483648 ; 0x80000000
    84e0:       ea4f 3303       mov.w   r3, r3, lsl #12
    84e4:       ea4c 3313       orr.w   r3, ip, r3, lsr #12
    84e8:       d002            beq.n   84f0 <__adddf3+0x84>
    84ea:       4252            negs    r2, r2
    84ec:       eb63 0343       sbc.w   r3, r3, r3, lsl #1
    84f0:       ea94 0f05       teq     r4, r5
    84f4:       f000 80a7       beq.w   8646 <__adddf3+0x1da>
    84f8:       f1a4 0401       sub.w   r4, r4, #1
    84fc:       f1d5 0e20       rsbs    lr, r5, #32
    8500:       db0d            blt.n   851e <__adddf3+0xb2>
    8502:       fa02 fc0e       lsl.w   ip, r2, lr
    8506:       fa22 f205       lsr.w   r2, r2, r5
    850a:       1880            adds    r0, r0, r2
    850c:       f141 0100       adc.w   r1, r1, #0
    8510:       fa03 f20e       lsl.w   r2, r3, lr
    8514:       1880            adds    r0, r0, r2
    8516:       fa43 f305       asr.w   r3, r3, r5
    851a:       4159            adcs    r1, r3
    851c:       e00e            b.n     853c <__adddf3+0xd0>
    851e:       f1a5 0520       sub.w   r5, r5, #32
    8522:       f10e 0e20       add.w   lr, lr, #32
    8526:       2a01            cmp     r2, #1
    8528:       fa03 fc0e       lsl.w   ip, r3, lr
    852c:       bf28            it      cs
    852e:       f04c 0c02       orrcs.w ip, ip, #2
    8532:       fa43 f305       asr.w   r3, r3, r5
    8536:       18c0            adds    r0, r0, r3
    8538:       eb51 71e3       adcs.w  r1, r1, r3, asr #31
    853c:       f001 4500       and.w   r5, r1, #2147483648     ; 0x80000000
    8540:       d507            bpl.n   8552 <__adddf3+0xe6>
    8542:       f04f 0e00       mov.w   lr, #0
    8546:       f1dc 0c00       rsbs    ip, ip, #0
    854a:       eb7e 0000       sbcs.w  r0, lr, r0
    854e:       eb6e 0101       sbc.w   r1, lr, r1
    8552:       f5b1 1f80       cmp.w   r1, #1048576    ; 0x100000
    8556:       d31b            bcc.n   8590 <__adddf3+0x124>
    8558:       f5b1 1f00       cmp.w   r1, #2097152    ; 0x200000
    855c:       d30c            bcc.n   8578 <__adddf3+0x10c>
    855e:       0849            lsrs    r1, r1, #1
    8560:       ea5f 0030       movs.w  r0, r0, rrx
    8564:       ea4f 0c3c       mov.w   ip, ip, rrx
    8568:       f104 0401       add.w   r4, r4, #1
    856c:       ea4f 5244       mov.w   r2, r4, lsl #21
    8570:       f512 0f80       cmn.w   r2, #4194304    ; 0x400000
    8574:       f080 809a       bcs.w   86ac <__adddf3+0x240>
    8578:       f1bc 4f00       cmp.w   ip, #2147483648 ; 0x80000000
    857c:       bf08            it      eq
    857e:       ea5f 0c50       movseq.w        ip, r0, lsr #1
    8582:       f150 0000       adcs.w  r0, r0, #0
    8586:       eb41 5104       adc.w   r1, r1, r4, lsl #20
    858a:       ea41 0105       orr.w   r1, r1, r5
    858e:       bd30            pop     {r4, r5, pc}
    8590:       ea5f 0c4c       movs.w  ip, ip, lsl #1
    8594:       4140            adcs    r0, r0
    8596:       eb41 0101       adc.w   r1, r1, r1
    859a:       f411 1f80       tst.w   r1, #1048576    ; 0x100000
    859e:       f1a4 0401       sub.w   r4, r4, #1
    85a2:       d1e9            bne.n   8578 <__adddf3+0x10c>
    85a4:       f091 0f00       teq     r1, #0
    85a8:       bf04            itt     eq
    85aa:       4601            moveq   r1, r0
    85ac:       2000            moveq   r0, #0
    85ae:       fab1 f381       clz     r3, r1
    85b2:       bf08            it      eq
    85b4:       3320            addeq   r3, #32
    85b6:       f1a3 030b       sub.w   r3, r3, #11
    85ba:       f1b3 0220       subs.w  r2, r3, #32
    85be:       da0c            bge.n   85da <__adddf3+0x16e>
    85c0:       320c            adds    r2, #12
    85c2:       dd08            ble.n   85d6 <__adddf3+0x16a>
    85c4:       f102 0c14       add.w   ip, r2, #20
    85c8:       f1c2 020c       rsb     r2, r2, #12
    85cc:       fa01 f00c       lsl.w   r0, r1, ip
    85d0:       fa21 f102       lsr.w   r1, r1, r2
    85d4:       e00c            b.n     85f0 <__adddf3+0x184>
    85d6:       f102 0214       add.w   r2, r2, #20
    85da:       bfd8            it      le
    85dc:       f1c2 0c20       rsble   ip, r2, #32
    85e0:       fa01 f102       lsl.w   r1, r1, r2
    85e4:       fa20 fc0c       lsr.w   ip, r0, ip
    85e8:       bfdc            itt     le
    85ea:       ea41 010c       orrle.w r1, r1, ip
    85ee:       4090            lslle   r0, r2
    85f0:       1ae4            subs    r4, r4, r3
    85f2:       bfa2            ittt    ge
    85f4:       eb01 5104       addge.w r1, r1, r4, lsl #20
    85f8:       4329            orrge   r1, r5
    85fa:       bd30            popge   {r4, r5, pc}
    85fc:       ea6f 0404       mvn.w   r4, r4
    8600:       3c1f            subs    r4, #31
    8602:       da1c            bge.n   863e <__adddf3+0x1d2>
    8604:       340c            adds    r4, #12
    8606:       dc0e            bgt.n   8626 <__adddf3+0x1ba>
    8608:       f104 0414       add.w   r4, r4, #20
    860c:       f1c4 0220       rsb     r2, r4, #32
    8610:       fa20 f004       lsr.w   r0, r0, r4
    8614:       fa01 f302       lsl.w   r3, r1, r2
    8618:       ea40 0003       orr.w   r0, r0, r3
    861c:       fa21 f304       lsr.w   r3, r1, r4
    8620:       ea45 0103       orr.w   r1, r5, r3
    8624:       bd30            pop     {r4, r5, pc}
    8626:       f1c4 040c       rsb     r4, r4, #12
    862a:       f1c4 0220       rsb     r2, r4, #32
    862e:       fa20 f002       lsr.w   r0, r0, r2
    8632:       fa01 f304       lsl.w   r3, r1, r4
    8636:       ea40 0003       orr.w   r0, r0, r3
    863a:       4629            mov     r1, r5
    863c:       bd30            pop     {r4, r5, pc}
    863e:       fa21 f004       lsr.w   r0, r1, r4
    8642:       4629            mov     r1, r5
    8644:       bd30            pop     {r4, r5, pc}
    8646:       f094 0f00       teq     r4, #0
    864a:       f483 1380       eor.w   r3, r3, #1048576        ; 0x100000
    864e:       bf06            itte    eq
    8650:       f481 1180       eoreq.w r1, r1, #1048576        ; 0x100000
    8654:       3401            addeq   r4, #1
    8656:       3d01            subne   r5, #1
    8658:       e74e            b.n     84f8 <__adddf3+0x8c>
    865a:       ea7f 5c64       mvns.w  ip, r4, asr #21
    865e:       bf18            it      ne
    8660:       ea7f 5c65       mvnsne.w        ip, r5, asr #21
    8664:       d029            beq.n   86ba <__adddf3+0x24e>
    8666:       ea94 0f05       teq     r4, r5
    866a:       bf08            it      eq
    866c:       ea90 0f02       teqeq   r0, r2
    8670:       d005            beq.n   867e <__adddf3+0x212>
    8672:       ea54 0c00       orrs.w  ip, r4, r0
    8676:       bf04            itt     eq
    8678:       4619            moveq   r1, r3
    867a:       4610            moveq   r0, r2
    867c:       bd30            pop     {r4, r5, pc}
    867e:       ea91 0f03       teq     r1, r3
    8682:       bf1e            ittt    ne
    8684:       2100            movne   r1, #0
    8686:       2000            movne   r0, #0
    8688:       bd30            popne   {r4, r5, pc}
    868a:       ea5f 5c54       movs.w  ip, r4, lsr #21
    868e:       d105            bne.n   869c <__adddf3+0x230>
    8690:       0040            lsls    r0, r0, #1
    8692:       4149            adcs    r1, r1
    8694:       bf28            it      cs
    8696:       f041 4100       orrcs.w r1, r1, #2147483648     ; 0x80000000
    869a:       bd30            pop     {r4, r5, pc}
    869c:       f514 0480       adds.w  r4, r4, #4194304        ; 0x400000
    86a0:       bf3c            itt     cc
    86a2:       f501 1180       addcc.w r1, r1, #1048576        ; 0x100000
    86a6:       bd30            popcc   {r4, r5, pc}
    86a8:       f001 4500       and.w   r5, r1, #2147483648     ; 0x80000000
    86ac:       f045 41fe       orr.w   r1, r5, #2130706432     ; 0x7f000000
    86b0:       f441 0170       orr.w   r1, r1, #15728640       ; 0xf00000
    86b4:       f04f 0000       mov.w   r0, #0
    86b8:       bd30            pop     {r4, r5, pc}
    86ba:       ea7f 5c64       mvns.w  ip, r4, asr #21
    86be:       bf1a            itte    ne
    86c0:       4619            movne   r1, r3
    86c2:       4610            movne   r0, r2
    86c4:       ea7f 5c65       mvnseq.w        ip, r5, asr #21
    86c8:       bf1c            itt     ne
    86ca:       460b            movne   r3, r1
    86cc:       4602            movne   r2, r0
    86ce:       ea50 3401       orrs.w  r4, r0, r1, lsl #12
    86d2:       bf06            itte    eq
    86d4:       ea52 3503       orrseq.w        r5, r2, r3, lsl #12
    86d8:       ea91 0f03       teqeq   r1, r3
    86dc:       f441 2100       orrne.w r1, r1, #524288 ; 0x80000
    86e0:       bd30            pop     {r4, r5, pc}
    86e2:       bf00            nop

000086e4 <__aeabi_ui2d>:
    86e4:       f090 0f00       teq     r0, #0
    86e8:       bf04            itt     eq
    86ea:       2100            moveq   r1, #0
    86ec:       4770            bxeq    lr
    86ee:       b530            push    {r4, r5, lr}
    86f0:       f44f 6480       mov.w   r4, #1024       ; 0x400
    86f4:       f104 0432       add.w   r4, r4, #50     ; 0x32
    86f8:       f04f 0500       mov.w   r5, #0
    86fc:       f04f 0100       mov.w   r1, #0
    8700:       e750            b.n     85a4 <__adddf3+0x138>
    8702:       bf00            nop

00008704 <__aeabi_i2d>:
    8704:       f090 0f00       teq     r0, #0
    8708:       bf04            itt     eq
    870a:       2100            moveq   r1, #0
    870c:       4770            bxeq    lr
    870e:       b530            push    {r4, r5, lr}
    8710:       f44f 6480       mov.w   r4, #1024       ; 0x400
    8714:       f104 0432       add.w   r4, r4, #50     ; 0x32
    8718:       f010 4500       ands.w  r5, r0, #2147483648     ; 0x80000000
    871c:       bf48            it      mi
    871e:       4240            negmi   r0, r0
    8720:       f04f 0100       mov.w   r1, #0
    8724:       e73e            b.n     85a4 <__adddf3+0x138>
    8726:       bf00            nop

00008728 <__aeabi_f2d>:
    8728:       0042            lsls    r2, r0, #1
    872a:       ea4f 01e2       mov.w   r1, r2, asr #3
    872e:       ea4f 0131       mov.w   r1, r1, rrx
    8732:       ea4f 7002       mov.w   r0, r2, lsl #28
    8736:       bf1f            itttt   ne
    8738:       f012 437f       andsne.w        r3, r2, #4278190080     ; 0xff000000
    873c:       f093 4f7f       teqne   r3, #4278190080 ; 0xff000000
    8740:       f081 5160       eorne.w r1, r1, #939524096      ; 0x38000000
    8744:       4770            bxne    lr
    8746:       f092 0f00       teq     r2, #0
    874a:       bf14            ite     ne
    874c:       f093 4f7f       teqne   r3, #4278190080 ; 0xff000000
    8750:       4770            bxeq    lr
    8752:       b530            push    {r4, r5, lr}
    8754:       f44f 7460       mov.w   r4, #896        ; 0x380
    8758:       f001 4500       and.w   r5, r1, #2147483648     ; 0x80000000
    875c:       f021 4100       bic.w   r1, r1, #2147483648     ; 0x80000000
    8760:       e720            b.n     85a4 <__adddf3+0x138>
    8762:       bf00            nop

00008764 <__aeabi_ul2d>:
    8764:       ea50 0201       orrs.w  r2, r0, r1
    8768:       bf08            it      eq
    876a:       4770            bxeq    lr
    876c:       b530            push    {r4, r5, lr}
    876e:       f04f 0500       mov.w   r5, #0
    8772:       e00a            b.n     878a <__aeabi_l2d+0x16>

00008774 <__aeabi_l2d>:
    8774:       ea50 0201       orrs.w  r2, r0, r1
    8778:       bf08            it      eq
    877a:       4770            bxeq    lr
    877c:       b530            push    {r4, r5, lr}
    877e:       f011 4500       ands.w  r5, r1, #2147483648     ; 0x80000000
    8782:       d502            bpl.n   878a <__aeabi_l2d+0x16>
    8784:       4240            negs    r0, r0
    8786:       eb61 0141       sbc.w   r1, r1, r1, lsl #1
    878a:       f44f 6480       mov.w   r4, #1024       ; 0x400
    878e:       f104 0432       add.w   r4, r4, #50     ; 0x32
    8792:       ea5f 5c91       movs.w  ip, r1, lsr #22
    8796:       f43f aedc       beq.w   8552 <__adddf3+0xe6>
    879a:       f04f 0203       mov.w   r2, #3
    879e:       ea5f 0cdc       movs.w  ip, ip, lsr #3
    87a2:       bf18            it      ne
    87a4:       3203            addne   r2, #3
    87a6:       ea5f 0cdc       movs.w  ip, ip, lsr #3
    87aa:       bf18            it      ne
    87ac:       3203            addne   r2, #3
    87ae:       eb02 02dc       add.w   r2, r2, ip, lsr #3
    87b2:       f1c2 0320       rsb     r3, r2, #32
    87b6:       fa00 fc03       lsl.w   ip, r0, r3
    87ba:       fa20 f002       lsr.w   r0, r0, r2
    87be:       fa01 fe03       lsl.w   lr, r1, r3
    87c2:       ea40 000e       orr.w   r0, r0, lr
    87c6:       fa21 f102       lsr.w   r1, r1, r2
    87ca:       4414            add     r4, r2
    87cc:       e6c1            b.n     8552 <__adddf3+0xe6>
    87ce:       bf00            nop

000087d0 <__libc_csu_init>:
    87d0:       e92d 43f8       stmdb   sp!, {r3, r4, r5, r6, r7, r8, r9, lr}
    87d4:       4606            mov     r6, r0
    87d6:       4d0d            ldr     r5, [pc, #52]   ; (880c <__libc_csu_init+0x3c>)
    87d8:       460f            mov     r7, r1
    87da:       f8df 9034       ldr.w   r9, [pc, #52]   ; 8810 <__libc_csu_init+0x40>
    87de:       4690            mov     r8, r2
    87e0:       447d            add     r5, pc
    87e2:       f7ff fd7d       bl      82e0 <_init>
    87e6:       44f9            add     r9, pc
    87e8:       ebc5 0909       rsb     r9, r5, r9
    87ec:       ea5f 09a9       movs.w  r9, r9, asr #2
    87f0:       d00a            beq.n   8808 <__libc_csu_init+0x38>
    87f2:       3d04            subs    r5, #4
    87f4:       2400            movs    r4, #0
    87f6:       f855 3f04       ldr.w   r3, [r5, #4]!
    87fa:       4630            mov     r0, r6
    87fc:       4639            mov     r1, r7
    87fe:       4642            mov     r2, r8
    8800:       3401            adds    r4, #1
    8802:       4798            blx     r3
    8804:       454c            cmp     r4, r9
    8806:       d1f6            bne.n   87f6 <__libc_csu_init+0x26>
    8808:       e8bd 83f8       ldmia.w sp!, {r3, r4, r5, r6, r7, r8, r9, pc}
    880c:       00008728        .word   0x00008728
    8810:       00008726        .word   0x00008726

00008814 <__libc_csu_fini>:
    8814:       4770            bx      lr
    8816:       bf00            nop

Disassembly of section .fini:

00008818 <_fini>:
    8818:       b508            push    {r3, lr}
    881a:       bf00            nop
    881c:       bd08            pop     {r3, pc}

- test_hf

chanseok.kang@handel:~$ arm-linux-gnueabi-objdump test_hf -d

test_hf:     file format elf32-littlearm


Disassembly of section .init:

000082e8 <_init>:
    82e8:       b508            push    {r3, lr}
    82ea:       f000 f849       bl      8380 <call_gmon_start>
    82ee:       bf00            nop
    82f0:       bd08            pop     {r3, pc}

Disassembly of section .plt:

000082f4 <.plt>:
    82f4:       e52de004        push    {lr}            ; (str lr, [sp, #-4]!)
    82f8:       e59fe004        ldr     lr, [pc, #4]    ; 8304 <_init+0x1c>
    82fc:       e08fe00e        add     lr, pc, lr
    8300:       e5bef008        ldr     pc, [lr, #8]!
    8304:       00008cfc        .word   0x00008cfc
    8308:       e28fc600        add     ip, pc, #0
    830c:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8310:       e5bcfcfc        ldr     pc, [ip, #3324]!        ; 0xcfc
    8314:       e28fc600        add     ip, pc, #0
    8318:       e28cca08        add     ip, ip, #32768  ; 0x8000
    831c:       e5bcfcf4        ldr     pc, [ip, #3316]!        ; 0xcf4
    8320:       e28fc600        add     ip, pc, #0
    8324:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8328:       e5bcfcec        ldr     pc, [ip, #3308]!        ; 0xcec
    832c:       4778            bx      pc
    832e:       46c0            nop                     ; (mov r8, r8)
    8330:       e28fc600        add     ip, pc, #0
    8334:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8338:       e5bcfce0        ldr     pc, [ip, #3296]!        ; 0xce0
    833c:       e28fc600        add     ip, pc, #0
    8340:       e28cca08        add     ip, ip, #32768  ; 0x8000
    8344:       e5bcfcd8        ldr     pc, [ip, #3288]!        ; 0xcd8

Disassembly of section .text:

00008348 <_start>:
    8348:       f04f 0b00       mov.w   fp, #0
    834c:       f04f 0e00       mov.w   lr, #0
    8350:       f85d 1b04       ldr.w   r1, [sp], #4
    8354:       466a            mov     r2, sp
    8356:       f84d 2d04       str.w   r2, [sp, #-4]!
    835a:       f84d 0d04       str.w   r0, [sp, #-4]!
    835e:       f8df c014       ldr.w   ip, [pc, #20]   ; 8374 <_start+0x2c>
    8362:       f84d cd04       str.w   ip, [sp, #-4]!
    8366:       4804            ldr     r0, [pc, #16]   ; (8378 <_start+0x30>)
    8368:       4b04            ldr     r3, [pc, #16]   ; (837c <_start+0x34>)
    836a:       f7ff efda       blx     8320 <_init+0x38>
    836e:       f7ff efe6       blx     833c <_init+0x54>
    8372:       0000            .short  0x0000
    8374:       000084b1        .word   0x000084b1
    8378:       00008421        .word   0x00008421
    837c:       0000846d        .word   0x0000846d

00008380 <call_gmon_start>:
    8380:       4b03            ldr     r3, [pc, #12]   ; (8390 <call_gmon_start+0x10>)
    8382:       4a04            ldr     r2, [pc, #16]   ; (8394 <call_gmon_start+0x14>)
    8384:       447b            add     r3, pc
    8386:       589b            ldr     r3, [r3, r2]
    8388:       b10b            cbz     r3, 838e <call_gmon_start+0xe>
    838a:       f7ff bfcf       b.w     832c <_init+0x44>
    838e:       4770            bx      lr
    8390:       00008c78        .word   0x00008c78
    8394:       00000020        .word   0x00000020

00008398 <deregister_tm_clones>:
    8398:       b508            push    {r3, lr}
    839a:       4805            ldr     r0, [pc, #20]   ; (83b0 <deregister_tm_clones+0x18>)
    839c:       4b05            ldr     r3, [pc, #20]   ; (83b4 <deregister_tm_clones+0x1c>)
    839e:       1a1b            subs    r3, r3, r0
    83a0:       2b06            cmp     r3, #6
    83a2:       d800            bhi.n   83a6 <deregister_tm_clones+0xe>
    83a4:       bd08            pop     {r3, pc}
    83a6:       4b04            ldr     r3, [pc, #16]   ; (83b8 <deregister_tm_clones+0x20>)
    83a8:       2b00            cmp     r3, #0
    83aa:       d0fb            beq.n   83a4 <deregister_tm_clones+0xc>
    83ac:       4798            blx     r3
    83ae:       e7f9            b.n     83a4 <deregister_tm_clones+0xc>
    83b0:       0001102c        .word   0x0001102c
    83b4:       0001102f        .word   0x0001102f
    83b8:       00000000        .word   0x00000000

000083bc <register_tm_clones>:
    83bc:       b508            push    {r3, lr}
    83be:       4807            ldr     r0, [pc, #28]   ; (83dc <register_tm_clones+0x20>)
    83c0:       4b07            ldr     r3, [pc, #28]   ; (83e0 <register_tm_clones+0x24>)
    83c2:       1a1b            subs    r3, r3, r0
    83c4:       109b            asrs    r3, r3, #2
    83c6:       eb03 73d3       add.w   r3, r3, r3, lsr #31
    83ca:       1059            asrs    r1, r3, #1
    83cc:       d100            bne.n   83d0 <register_tm_clones+0x14>
    83ce:       bd08            pop     {r3, pc}
    83d0:       4a04            ldr     r2, [pc, #16]   ; (83e4 <register_tm_clones+0x28>)
    83d2:       2a00            cmp     r2, #0
    83d4:       d0fb            beq.n   83ce <register_tm_clones+0x12>
    83d6:       4790            blx     r2
    83d8:       e7f9            b.n     83ce <register_tm_clones+0x12>
    83da:       bf00            nop
    83dc:       0001102c        .word   0x0001102c
    83e0:       0001102c        .word   0x0001102c
    83e4:       00000000        .word   0x00000000

000083e8 <__do_global_dtors_aux>:
    83e8:       b510            push    {r4, lr}
    83ea:       4c04            ldr     r4, [pc, #16]   ; (83fc <__do_global_dtors_aux+0x14>)
    83ec:       7823            ldrb    r3, [r4, #0]
    83ee:       b91b            cbnz    r3, 83f8 <__do_global_dtors_aux+0x10>
    83f0:       f7ff ffd2       bl      8398 <deregister_tm_clones>
    83f4:       2301            movs    r3, #1
    83f6:       7023            strb    r3, [r4, #0]
    83f8:       bd10            pop     {r4, pc}
    83fa:       bf00            nop
    83fc:       0001102c        .word   0x0001102c

00008400 <frame_dummy>:
    8400:       4805            ldr     r0, [pc, #20]   ; (8418 <frame_dummy+0x18>)
    8402:       b508            push    {r3, lr}
    8404:       6803            ldr     r3, [r0, #0]
    8406:       b113            cbz     r3, 840e <frame_dummy+0xe>
    8408:       4b04            ldr     r3, [pc, #16]   ; (841c <frame_dummy+0x1c>)
    840a:       b103            cbz     r3, 840e <frame_dummy+0xe>
    840c:       4798            blx     r3
    840e:       e8bd 4008       ldmia.w sp!, {r3, lr}
    8412:       f7ff bfd3       b.w     83bc <register_tm_clones>
    8416:       bf00            nop
    8418:       00010f14        .word   0x00010f14
    841c:       00000000        .word   0x00000000

00008420 <main>:
    8420:       b580            push    {r7, lr}
    8422:       b082            sub     sp, #8
    8424:       af00            add     r7, sp, #0
    8426:       4b10            ldr     r3, [pc, #64]   ; (8468 <main+0x48>)
    8428:       607b            str     r3, [r7, #4]
    842a:       f248 40c0       movw    r0, #33984      ; 0x84c0
    842e:       f2c0 0000       movt    r0, #0
    8432:       f7ff ef70       blx     8314 <_init+0x2c>
    8436:       f248 40d0       movw    r0, #34000      ; 0x84d0
    843a:       f2c0 0000       movt    r0, #0
    843e:       f7ff ef6a       blx     8314 <_init+0x2c>
    8442:       edd7 7a01       vldr    s15, [r7, #4]
    8446:       eeb7 7ae7       vcvt.f64.f32    d7, s15
    844a:       f248 40d8       movw    r0, #34008      ; 0x84d8
    844e:       f2c0 0000       movt    r0, #0
    8452:       ec53 2b17       vmov    r2, r3, d7
    8456:       f7ff ef58       blx     8308 <_init+0x20>
    845a:       2300            movs    r3, #0
    845c:       4618            mov     r0, r3
    845e:       f107 0708       add.w   r7, r7, #8
    8462:       46bd            mov     sp, r7
    8464:       bd80            pop     {r7, pc}
    8466:       bf00            nop
    8468:       4048f5c3        .word   0x4048f5c3

0000846c <__libc_csu_init>:
    846c:       e92d 43f8       stmdb   sp!, {r3, r4, r5, r6, r7, r8, r9, lr}
    8470:       4606            mov     r6, r0
    8472:       4d0d            ldr     r5, [pc, #52]   ; (84a8 <__libc_csu_init+0x3c>)
    8474:       460f            mov     r7, r1
    8476:       f8df 9034       ldr.w   r9, [pc, #52]   ; 84ac <__libc_csu_init+0x40>
    847a:       4690            mov     r8, r2
    847c:       447d            add     r5, pc
    847e:       f7ff ff33       bl      82e8 <_init>
    8482:       44f9            add     r9, pc
    8484:       ebc5 0909       rsb     r9, r5, r9
    8488:       ea5f 09a9       movs.w  r9, r9, asr #2
    848c:       d00a            beq.n   84a4 <__libc_csu_init+0x38>
    848e:       3d04            subs    r5, #4
    8490:       2400            movs    r4, #0
    8492:       f855 3f04       ldr.w   r3, [r5, #4]!
    8496:       4630            mov     r0, r6
    8498:       4639            mov     r1, r7
    849a:       4642            mov     r2, r8
    849c:       3401            adds    r4, #1
    849e:       4798            blx     r3
    84a0:       454c            cmp     r4, r9
    84a2:       d1f6            bne.n   8492 <__libc_csu_init+0x26>
    84a4:       e8bd 83f8       ldmia.w sp!, {r3, r4, r5, r6, r7, r8, r9, pc}
    84a8:       00008a8c        .word   0x00008a8c
    84ac:       00008a8a        .word   0x00008a8a

000084b0 <__libc_csu_fini>:
    84b0:       4770            bx      lr
    84b2:       bf00            nop

Disassembly of section .fini:

000084b4 <_fini>:
    84b4:       b508            push    {r3, lr}
    84b6:       bf00            nop
    84b8:       bd08            pop     {r3, pc}

 

결론 :

 - soft-float를 사용하냐 hard-float을 사용하냐는 elf를 직접 까서 보지 않고는 거의 구별이 어렵다.
 - hard-float을 사용하는 경우 arm에서는 architecture 내부에 있는 vfp (vector floating point) register를 사용한다.
 - 보다시피 soft-float를 사용하는 경우는 gcc에서 compile시 연산 lib에 link를 걸고 이를 다룰수 있는 instruction으로 번역하기 때문에 assembly가 길어진다.
 - float 연산을 하는 경우 linux에서는 /lib에 있는 libc.so의 도움을 받는다. 즉, 이게 없으면 libc 내에서 Illegal Instruction이라는 오류를 출력하며 수행되지 않는다.

의문 사항:

 - 왜 readelf를 통해서 파일을 까봐도 soft-float compile 한 파일의 정보가 hard-float compile한 결과와 다르지 않을까... 특히 Tag_FP_arch 는 달라져야 할거 같은데, 실상 해보니까 차이가 없네.. 

댓글