When I switch to armv7 the issue goes away
$ cat Dockerfile.armv7 FROM arm32v7/ubuntu RUN apt-get update && \ apt-get install -y \ gcc make libpcre3-dev libreadline-dev git
RUN cd /home && git clone https://github.com/nginx/njs
RUN cd /home/njs && ./configure --cc-opt='-O0 -static -lm -lrt -pthread -Wl,--whole-archive -lpthread -ltinfo -Wl,--no-whole-archive' && make njs
$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes $ docker build -t njs/armv7 -f Dockerfile.armv7 . $ docker run -v `pwd`:/m -ti njs/armv7 cp /home/njs/build/njs /m/njs-armv7
$ readelf -l ./njs-armv7
Elf file type is EXEC (Executable file) Entry point 0x12fb9 There are 7 program headers, starting at offset 52
Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align EXIDX 0x1be338 0x001ce338 0x001ce338 0x009b8 0x009b8 R 0x4 LOAD 0x000000 0x00010000 0x00010000 0x1becf4 0x1becf4 R E 0x10000 LOAD 0x1bedfc 0x001dedfc 0x001dedfc 0x17674 0x1c2cc RW 0x10000 NOTE 0x000114 0x00010114 0x00010114 0x00044 0x00044 R 0x4 TLS 0x1bedfc 0x001dedfc 0x001dedfc 0x00038 0x00060 R 0x4 GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10 GNU_RELRO 0x1bedfc 0x001dedfc 0x001dedfc 0x0e204 0x0e204 R 0x1
Section to Segment mapping: Segment Sections... 00 .ARM.exidx 01 .note.ABI-tag .note.gnu.build-id .rel.dyn .init .iplt .text __libc_freeres_fn __libc_thread_freeres_fn .fini .rodata .stapsdt.base __libc_subfreeres __libc_IO_vtables __libc_atexit __libc_thread_subfreeres .ARM.extab .ARM.exidx .eh_frame 02 .tdata .init_array .fini_array .data.rel.ro .got .data .bss __libc_freeres_ptrs 03 .note.ABI-tag .note.gnu.build-id 04 .tdata .tbss 05 06 .tdata .init_array .fini_array .data.rel.ro
$ readelf -h ./njs-armv7 ELF Header: Magic: 7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - GNU ABI Version: 0 Type: EXEC (Executable file) Machine: ARM Version: 0x1 Entry point address: 0x12fb9 Start of program headers: 52 (bytes into file) Start of section headers: 5696248 (bytes into file) Flags: 0x5000400, Version5 EABI, hard-float ABI Size of this header: 52 (bytes) Size of program headers: 32 (bytes) Number of program headers: 7 Size of section headers: 40 (bytes) Number of section headers: 42 Section header string table index: 41
$ qemu-arm -g 12345 ./njs-armv7 -c 'console.log("HH")'
$ gdb-multiarch ./njs-armv7 -ex 'source showstack.py' ARGUMENTS --------- argc = 3 arg 0 = ./njs-armv7 arg 1 = -c arg 2 = console.log("HH")
...
AUX VECTOR ---------- AT_PHDR = 10034 AT_PHENT = 20 AT_PHNUM = 7 AT_PAGESZ = 1000 AT_BASE = 0 AT_FLAGS = 0 AT_ENTRY = 12fb9 AT_UID = 3e9 AT_EUID = 3e9 AT_GID = 3e9 AT_EGID = 3e9 AT_HWCAP = 1fb8d7 AT_CLKTCK = 64 AT_RANDOM = -104a0 AT_HWCAP2 = 1f AT_NULL = 0
$ qemu-arm --version qemu-arm version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.28) Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
When I switch to armv7 the issue goes away
$ cat Dockerfile.armv7
FROM arm32v7/ubuntu
RUN apt-get update && \
apt-get install -y \
gcc make libpcre3-dev libreadline-dev git
RUN cd /home && git clone https:/ /github. com/nginx/ njs
RUN cd /home/njs && ./configure --cc-opt='-O0 -static -lm -lrt -pthread -Wl,--whole-archive -lpthread -ltinfo -Wl,--no- whole-archive' && make njs
$ docker run --rm --privileged multiarch/ qemu-user- static --reset -p yes
$ docker build -t njs/armv7 -f Dockerfile.armv7 .
$ docker run -v `pwd`:/m -ti njs/armv7 cp /home/njs/build/njs /m/njs-armv7
$ readelf -l ./njs-armv7
Elf file type is EXEC (Executable file)
Entry point 0x12fb9
There are 7 program headers, starting at offset 52
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
EXIDX 0x1be338 0x001ce338 0x001ce338 0x009b8 0x009b8 R 0x4
LOAD 0x000000 0x00010000 0x00010000 0x1becf4 0x1becf4 R E 0x10000
LOAD 0x1bedfc 0x001dedfc 0x001dedfc 0x17674 0x1c2cc RW 0x10000
NOTE 0x000114 0x00010114 0x00010114 0x00044 0x00044 R 0x4
TLS 0x1bedfc 0x001dedfc 0x001dedfc 0x00038 0x00060 R 0x4
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x10
GNU_RELRO 0x1bedfc 0x001dedfc 0x001dedfc 0x0e204 0x0e204 R 0x1
Section to Segment mapping: thread_ freeres_ fn .fini .rodata .stapsdt.base __libc_subfreeres __libc_IO_vtables __libc_atexit __libc_ thread_ subfreeres .ARM.extab .ARM.exidx .eh_frame
Segment Sections...
00 .ARM.exidx
01 .note.ABI-tag .note.gnu.build-id .rel.dyn .init .iplt .text __libc_freeres_fn __libc_
02 .tdata .init_array .fini_array .data.rel.ro .got .data .bss __libc_freeres_ptrs
03 .note.ABI-tag .note.gnu.build-id
04 .tdata .tbss
05
06 .tdata .init_array .fini_array .data.rel.ro
$ readelf -h ./njs-armv7
ELF Header:
Magic: 7f 45 4c 46 01 01 01 03 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - GNU
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x12fb9
Start of program headers: 52 (bytes into file)
Start of section headers: 5696248 (bytes into file)
Flags: 0x5000400, Version5 EABI, hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 7
Size of section headers: 40 (bytes)
Number of section headers: 42
Section header string table index: 41
$ qemu-arm -g 12345 ./njs-armv7 -c 'console.log("HH")'
$ gdb-multiarch ./njs-armv7 -ex 'source showstack.py'
ARGUMENTS
---------
argc = 3
arg 0 = ./njs-armv7
arg 1 = -c
arg 2 = console.log("HH")
...
AUX VECTOR
----------
AT_PHDR = 10034
AT_PHENT = 20
AT_PHNUM = 7
AT_PAGESZ = 1000
AT_BASE = 0
AT_FLAGS = 0
AT_ENTRY = 12fb9
AT_UID = 3e9
AT_EUID = 3e9
AT_GID = 3e9
AT_EGID = 3e9
AT_HWCAP = 1fb8d7
AT_CLKTCK = 64
AT_RANDOM = -104a0
AT_HWCAP2 = 1f
AT_NULL = 0
$ qemu-arm --version dfsg-1ubuntu7. 28)
qemu-arm version 2.11.1(Debian 1:2.11+
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers