https://sourceware.org/bugzilla/show_bug.cgi?id=22369
Bug ID: 22369 Summary: Mingw linker crash with no-keep-memory Product: binutils Version: 2.28 Status: UNCONFIRMED Severity: minor Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: martin.koegler at chello dot at Target Milestone: --- I noticed, that a mingw x86_64 ld crashes, if no-keep-memory is used and it gets passed an 64 bit ELF linux object. $ cat t.c ===== #include <math.h> int _main(int argc) { return cosf(argc); } ===== $ 86_64-w64-mingw32-g++ -c t.c $ x86_64-w64-mingw32-ld -o t.exe t.o /usr/lib64/libm.a --no-keep-memory *** Error in `x86_64-w64-mingw32-ld': free(): invalid pointer: 0x0000000001b4d4c0 ======= Backtrace: ========= Valgrind states: ==2710== Invalid free() / delete / delete[] / realloc() ==2710== at 0x4C2A35C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==2710== by 0x45B804: _bfd_coff_free_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x454217: coff_link_add_object_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x454894: coff_link_check_archive_element (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x43D70B: _bfd_generic_link_add_archive_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x4112B7: load_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x411D76: open_input_bfds (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x413FF9: lang_process (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x403FBC: main (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== Address 0x5413010 is 3,264 bytes inside a block of size 4,064 alloc'd ==2710== at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==2710== by 0x4DE65C: objalloc_create (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x440157: _bfd_new_bfd (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x4401F8: _bfd_new_bfd_contained_in (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x434ECF: _bfd_get_elt_at_filepos (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x43D6C1: _bfd_generic_link_add_archive_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x4112B7: load_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x411D76: open_input_bfds (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x413FF9: lang_process (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x403FBC: main (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== ==2710== Invalid free() / delete / delete[] / realloc() ==2710== at 0x4C2A35C: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==2710== by 0x45B7DF: _bfd_coff_free_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x454217: coff_link_add_object_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x454894: coff_link_check_archive_element (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x43D70B: _bfd_generic_link_add_archive_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x4112B7: load_symbols (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x411D76: open_input_bfds (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x413FF9: lang_process (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== by 0x403FBC: main (in /usr/x86_64-w64-mingw32/bin/ld) ==2710== Address 0x200000001 is not stack'd, malloc'd or (recently) free'd -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils