NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-arm/49337: __popcountsi2() triggers illegal instruction

The following reply was made to PR port-arm/49337; it has been noted by GNATS.

From: Martin Husemann <>
Subject: Re: port-arm/49337: __popcountsi2() triggers illegal instruction
Date: Sun, 2 Nov 2014 10:41:39 +0100

 To reproduce you can use the cross tools and check objdump output; for
 simplicity, here is a "how to reproduce" with native tools:
 [/tmp/demo] martin@space-truckin > cat hello.c 
 #include <stdio.h>
 int main(int argc, char **argv)
         printf("hello world\n");
         return 0;
 [/tmp/demo] martin@space-truckin > cc -Wall -O2 -static -c hello.c
 [/tmp/demo] martin@space-truckin > cc -static -o first hello.o
 [/tmp/demo] martin@space-truckin > ./first 
 hello world
 [/tmp/demo] martin@space-truckin > ld -x -r hello.o -o ldx_hello.o
 [/tmp/demo] martin@space-truckin > cc -static -o second ldx_hello.o
 [/tmp/demo] martin@space-truckin > ./second 
 Illegal instruction (core dumped)
 [/tmp/demo] martin@space-truckin > objdump -D first | sed '1,/<main>:/d' | head -9
    2da40:       e1a0c00d        mov     ip, sp
    2da44:       e30d0e8c        movw    r0, #56972      ; 0xde8c
    2da48:       e92dd800        push    {fp, ip, lr, pc}
    2da4c:       e3400002        movt    r0, #2
    2da50:       e24cb004        sub     fp, ip, #4
    2da54:       ebffa6b6        bl      17534 <puts>
    2da58:       e3a00000        mov     r0, #0
    2da5c:       e89da800        ldm     sp, {fp, sp, pc}
 [/tmp/demo] martin@space-truckin > objdump -D second | sed '1,/<main>:/d' | head -9
    2da40:       e1a0c00d        stcleq  0, cr10, [r0, #900]     ; 0x384
    2da44:       e30d0e8c        stchi   13, cr0, [lr], {227}    ; 0xe3
    2da48:       e92dd800        sbcseq  r2, r8, r9, ror #27
    2da4c:       e3400002        andeq   r4, r0, #227    ; 0xe3
    2da50:       e24cb004        ldrteq  r4, [r0], #3298 ; 0xce2
    2da54:       ebffa6b6        strtlt  pc, [r6], fp, ror #31
    2da58:       e3a00000        andeq   sl, r0, r3, ror #1
    2da5c:       e89da800        adceq   r9, r8, r8, ror #27
 Note the identical hex opcode output here - this is part of the confusion
 hiding the original problem.

Home | Main Index | Thread Index | Old Index