On Sun, Nov 20, 2016 at 12:22 PM, Andrew Haley <aph@xxxxxxxxxx> wrote: > So do I. Try using -Wl,-Map,mapfile. That should explain what is > happening. I looked at that (see below). I'm a bit out of touch with GCC internals. The last time I did GCC hacking was in the 1.x days (long before it even supported C++). The only odd things I noticed: * It seems to make mention of libc_nonshared.a even though the default (should be) shared. * I see tons of transactional memory stuff. I compiled GCC using --disable-libitm and am hoping I can turn that stuff off. But it still generates code for transactional memory. > Turn some things off. > > -fno-lto That was one of the first things I tried. I also tried turning off 128 bit doubles. I've tried quite a few things. I am also going to try compiling the same toolchain directly on the target. Sadly it's been compiling GCC for 3 days now and seems about 70% done. > It is possible you're looking at linker bugs or the linker has been# > miscompiled. Keep an open mind. I was torn between reporting this to binutils vs. GCC. But my rationale for going here was that it seems to me libstdc++ is mis-compiled. And this is the libstdc++ bundled with GCC. I should also mention: * Compiling C++ code with full on static linking works. * Compiling C code works fine (static or dynamically linked). Any idea how to proceed? Thanks, Mark. Archive member included to satisfy reference by file (symbol) /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o (__libc_csu_init) Discarded input sections .note.GNU-stack 0x0000000000000000 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .gnu_debuglink 0x0000000000000000 0xc /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .note.GNU-stack 0x0000000000000000 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .gnu_debuglink 0x0000000000000000 0xc /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .note.GNU-stack 0x0000000000000000 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .note.GNU-stack 0x0000000000000000 0x0 /tmp/ccSvfKpD.o .note.GNU-stack 0x0000000000000000 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) .note.GNU-stack 0x0000000000000000 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .note.GNU-stack 0x0000000000000000 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o .gnu_debuglink 0x0000000000000000 0xc /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o Memory Configuration Name Origin Length Attributes *default* 0x0000000000000000 0xffffffffffffffff Linker script and memory map LOAD /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o LOAD /emb-root/usr/lib/arm-linux-gnueabihf/crti.o LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o LOAD /tmp/ccSvfKpD.o LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/../../../../arm-linux-gnueabihf/lib/libstdc++.so LOAD /emb-root/usr/lib/arm-linux-gnueabihf/libm.a LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so START GROUP LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/libgcc.a END GROUP LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/libgcc.a LOAD /emb-root/usr/lib/arm-linux-gnueabihf/libc.so START GROUP LOAD /emb-root/lib/arm-linux-gnueabihf/libc.so.6 LOAD /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a LOAD /emb-root/lib/arm-linux-gnueabihf/ld-linux-armhf.so.3 END GROUP LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so START GROUP LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/../../../../arm-linux-gnueabihf/lib/libgcc_s.so.1 LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/libgcc.a END GROUP LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/libgcc.a LOAD /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o LOAD /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o [!provide] PROVIDE (__executable_start, 0x10000) 0x0000000000010134 . = (0x10000 + SIZEOF_HEADERS) .interp 0x0000000000010134 0x19 *(.interp) .interp 0x0000000000010134 0x19 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .note.ABI-tag 0x0000000000010150 0x20 .note.ABI-tag 0x0000000000010150 0x20 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .note.gnu.build-id *(.note.gnu.build-id) .hash 0x0000000000010170 0x38 *(.hash) .hash 0x0000000000010170 0x38 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .gnu.hash *(.gnu.hash) .dynsym 0x00000000000101a8 0x90 *(.dynsym) .dynsym 0x00000000000101a8 0x90 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .dynstr 0x0000000000010238 0xc7 *(.dynstr) .dynstr 0x0000000000010238 0xc7 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .gnu.version 0x0000000000010300 0x12 *(.gnu.version) .gnu.version 0x0000000000010300 0x12 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .gnu.version_d 0x0000000000010314 0x0 *(.gnu.version_d) .gnu.version_d 0x0000000000010314 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .gnu.version_r 0x0000000000010314 0x40 *(.gnu.version_r) .gnu.version_r 0x0000000000010314 0x40 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .rel.dyn 0x0000000000010354 0x8 *(.rel.init) *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) *(.rel.fini) *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) *(.rel.data.rel.ro .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*) *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) *(.rel.ctors) *(.rel.dtors) *(.rel.got) .rel.got 0x0000000000010354 0x8 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) .rel.bss 0x000000000001035c 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o [!provide] PROVIDE (__rel_iplt_start, .) *(.rel.iplt) .rel.iplt 0x000000000001035c 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o [!provide] PROVIDE (__rel_iplt_end, .) .rela.dyn 0x000000000001035c 0x0 *(.rela.init) *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) *(.rela.fini) *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) *(.rela.ctors) *(.rela.dtors) *(.rela.got) *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) [!provide] PROVIDE (__rela_iplt_start, .) *(.rela.iplt) [!provide] PROVIDE (__rela_iplt_end, .) .rel.plt 0x000000000001035c 0x20 *(.rel.plt) .rel.plt 0x000000000001035c 0x20 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .rela.plt *(.rela.plt) .init 0x000000000001037c 0xc *(SORT(.init)) .init 0x000000000001037c 0x8 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o 0x000000000001037c _init .init 0x0000000000010384 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o .plt 0x0000000000010388 0x44 *(.plt) .plt 0x0000000000010388 0x44 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x000000000001039c puts@@GLIBC_2.4 0x00000000000103a8 abort@@GLIBC_2.4 0x00000000000103b4 __libc_start_main@@GLIBC_2.4 .iplt 0x00000000000103cc 0x0 *(.iplt) .iplt 0x00000000000103cc 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .text 0x00000000000103cc 0x1ac *(.text.unlikely .text.*_unlikely .text.unlikely.*) *(.text.exit .text.exit.*) *(.text.startup .text.startup.*) *(.text.hot .text.hot.*) *(.text .stub .text.* .gnu.linkonce.t.*) .text 0x00000000000103cc 0x3c /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x00000000000103cc _start .text 0x0000000000010408 0x24 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .text 0x000000000001042c 0xc8 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .text 0x00000000000104f4 0x20 /tmp/ccSvfKpD.o 0x00000000000104f4 main .text 0x0000000000010514 0x64 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) 0x0000000000010514 __libc_csu_init 0x0000000000010574 __libc_csu_fini .text 0x0000000000010578 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .text 0x0000000000010578 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o *(.gnu.warning) *(.glue_7t) .glue_7t 0x0000000000010578 0x0 linker stubs *(.glue_7) .glue_7 0x0000000000010578 0x0 linker stubs *(.vfp11_veneer) .vfp11_veneer 0x0000000000010578 0x0 linker stubs *(.v4_bx) .v4_bx 0x0000000000010578 0x0 linker stubs .fini 0x0000000000010578 0x8 *(SORT(.fini)) .fini 0x0000000000010578 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o 0x0000000000010578 _fini .fini 0x000000000001057c 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o [!provide] PROVIDE (__etext, .) [!provide] PROVIDE (_etext, .) [!provide] PROVIDE (etext, .) .rodata 0x0000000000010580 0x10 *(.rodata .rodata.* .gnu.linkonce.r.*) .rodata.cst4 0x0000000000010580 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x0000000000010580 _IO_stdin_used .rodata 0x0000000000010584 0xc /tmp/ccSvfKpD.o .rodata1 *(.rodata1) .ARM.extab 0x0000000000010590 0xc *(.ARM.extab* .gnu.linkonce.armextab.*) .ARM.extab 0x0000000000010590 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .ARM.extab 0x0000000000010590 0xc /tmp/ccSvfKpD.o [!provide] PROVIDE (__exidx_start, .) .ARM.exidx 0x000000000001059c 0x18 *(.ARM.exidx* .gnu.linkonce.armexidx.*) .ARM.exidx 0x000000000001059c 0x8 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .ARM.exidx 0x00000000000105a4 0x10 /tmp/ccSvfKpD.o 0x8 (size before relaxing) [!provide] PROVIDE (__exidx_end, .) .eh_frame_hdr *(.eh_frame_hdr) *(.eh_frame_entry .eh_frame_entry.*) .eh_frame 0x00000000000105b4 0x4 *(.eh_frame) .eh_frame 0x00000000000105b4 0x4 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o *(.eh_frame.*) .gcc_except_table *(.gcc_except_table .gcc_except_table.*) .gnu_extab *(.gnu_extab*) .exception_ranges *(.exception_ranges .exception_ranges*) 0x00000000000205b8 . = DATA_SEGMENT_ALIGN (0x10000, 0x1000) .eh_frame *(.eh_frame) *(.eh_frame.*) .gnu_extab *(.gnu_extab) .gcc_except_table *(.gcc_except_table .gcc_except_table.*) .exception_ranges *(.exception_ranges .exception_ranges*) .tdata *(.tdata .tdata.* .gnu.linkonce.td.*) .tbss *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) .preinit_array 0x00000000000205b8 0x0 [!provide] PROVIDE (__preinit_array_start, .) *(.preinit_array) [!provide] PROVIDE (__preinit_array_end, .) .init_array 0x00000000000205b8 0x4 0x00000000000205b8 PROVIDE (__init_array_start, .) *(SORT(.init_array.*) SORT(.ctors.*)) *(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors) .init_array 0x00000000000205b8 0x4 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o 0x00000000000205bc PROVIDE (__init_array_end, .) .fini_array 0x00000000000205bc 0x4 [!provide] PROVIDE (__fini_array_start, .) *(SORT(.fini_array.*) SORT(.dtors.*)) *(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors) .fini_array 0x00000000000205bc 0x4 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o [!provide] PROVIDE (__fini_array_end, .) .ctors *crtbegin.o(.ctors) *crtbegin?.o(.ctors) *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) *(SORT(.ctors.*)) *(.ctors) .dtors *crtbegin.o(.dtors) *crtbegin?.o(.dtors) *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) *(SORT(.dtors.*)) *(.dtors) .jcr 0x00000000000205c0 0x4 *(.jcr) .jcr 0x00000000000205c0 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .jcr 0x00000000000205c0 0x4 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .data.rel.ro *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) .dynamic 0x00000000000205c4 0xf8 *(.dynamic) .dynamic 0x00000000000205c4 0xf8 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x00000000000205c4 _DYNAMIC 0x00000000000206bc . = DATA_SEGMENT_RELRO_END (., 0x0) .got 0x00000000000206bc 0x20 *(.got.plt) .got.plt 0x00000000000206bc 0x1c /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x00000000000206bc _GLOBAL_OFFSET_TABLE_ *(.igot.plt) .igot.plt 0x00000000000206d8 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o *(.got) .got 0x00000000000206d8 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o *(.igot) .data 0x00000000000206dc 0x8 [!provide] PROVIDE (__data_start, .) *(.data .data.* .gnu.linkonce.d.*) .data 0x00000000000206dc 0x4 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o 0x00000000000206dc data_start 0x00000000000206dc __data_start .data 0x00000000000206e0 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .data 0x00000000000206e0 0x4 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o 0x00000000000206e0 __dso_handle .data 0x00000000000206e4 0x0 /tmp/ccSvfKpD.o .data 0x00000000000206e4 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) .data 0x00000000000206e4 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .data 0x00000000000206e4 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o .tm_clone_table 0x00000000000206e4 0x0 .tm_clone_table 0x00000000000206e4 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .tm_clone_table 0x00000000000206e4 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .data1 *(.data1) 0x00000000000206e4 _edata = . [!provide] PROVIDE (edata, .) 0x00000000000206e4 . = . 0x00000000000206e4 __bss_start = . 0x00000000000206e4 __bss_start__ = . .bss 0x00000000000206e4 0x4 *(.dynbss) .dynbss 0x00000000000206e4 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o *(.bss .bss.* .gnu.linkonce.b.*) .bss 0x00000000000206e4 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .bss 0x00000000000206e4 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .bss 0x00000000000206e4 0x1 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .bss 0x00000000000206e5 0x0 /tmp/ccSvfKpD.o .bss 0x00000000000206e5 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) .bss 0x00000000000206e5 0x0 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .bss 0x00000000000206e5 0x0 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o *(COMMON) 0x00000000000206e8 . = ALIGN ((. != 0x0)?0x4:0x1) *fill* 0x00000000000206e5 0x3 0x00000000000206e8 _bss_end__ = . 0x00000000000206e8 __bss_end__ = . 0x00000000000206e8 . = ALIGN (0x4) 0x00000000000206e8 . = SEGMENT_START ("ldata-segment", .) 0x00000000000206e8 . = ALIGN (0x4) 0x00000000000206e8 __end__ = . 0x00000000000206e8 _end = . [!provide] PROVIDE (end, .) 0x00000000000206e8 . = DATA_SEGMENT_END (.) .stab *(.stab) .stabstr *(.stabstr) .stab.excl *(.stab.excl) .stab.exclstr *(.stab.exclstr) .stab.index *(.stab.index) .stab.indexstr *(.stab.indexstr) .comment 0x0000000000000000 0x33 *(.comment) .comment 0x0000000000000000 0x11 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o 0x12 (size before relaxing) .comment 0x0000000000000011 0x12 /tmp/ccSvfKpD.o .comment 0x0000000000000011 0x22 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) 0x23 (size before relaxing) .comment 0x0000000000000033 0x12 /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .ARM.attributes 0x0000000000000000 0x2f .ARM.attributes 0x0000000000000000 0x2f /emb-root/usr/lib/arm-linux-gnueabihf/crt1.o .ARM.attributes 0x000000000000002f 0x31 /emb-root/usr/lib/arm-linux-gnueabihf/crti.o .ARM.attributes 0x0000000000000060 0x2f /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtbegin.o .ARM.attributes 0x000000000000008f 0x2f /tmp/ccSvfKpD.o .ARM.attributes 0x00000000000000be 0x31 /emb-root/usr/lib/arm-linux-gnueabihf/libc_nonshared.a(elf-init.oS) .ARM.attributes 0x00000000000000ef 0x2f /opt/cross/lib/gcc/arm-linux-gnueabihf/6.2.0/crtend.o .ARM.attributes 0x000000000000011e 0x31 /emb-root/usr/lib/arm-linux-gnueabihf/crtn.o .debug *(.debug) .line *(.line) .debug_srcinfo *(.debug_srcinfo) .debug_sfnames *(.debug_sfnames) .debug_aranges *(.debug_aranges) .debug_pubnames *(.debug_pubnames) .debug_info *(.debug_info .gnu.linkonce.wi.*) .debug_abbrev *(.debug_abbrev) .debug_line *(.debug_line .debug_line.* .debug_line_end) .debug_frame *(.debug_frame) .debug_str *(.debug_str) .debug_loc *(.debug_loc) .debug_macinfo *(.debug_macinfo) .debug_weaknames *(.debug_weaknames) .debug_funcnames *(.debug_funcnames) .debug_typenames *(.debug_typenames) .debug_varnames *(.debug_varnames) .debug_pubtypes *(.debug_pubtypes) .debug_ranges *(.debug_ranges) .debug_macro *(.debug_macro) .gnu.attributes *(.gnu.attributes) .note.gnu.arm.ident *(.note.gnu.arm.ident) /DISCARD/ *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) OUTPUT(a.out elf32-littlearm)