I've build a cross-compiler with gcc-4.6.0 and binutils-2.21 for MMIX. There seems to be a problem with the emulation elf64mmix. To reproduce the problem, use the following c-file: ---- static unsigned int foo = 2; int main(void) { foo++; return 0; } ---- And the following linker-script: ---- OUTPUT_FORMAT("binary") ENTRY(start) SECTIONS { . = 0x8000000000100000; .text : AT(ADDR(.text) - 0x8000000000100000) { *(.text) *(.data) *(.rodata*) *(COMMON*) *(.bss*) } } ---- Compiling the c-file and linking it via: $ mmix-elf-escape-gcc -o test.o -c test.c $ mmix-elf-escape-ld -m elf64mmix -o test test.o -T ld.conf -nostdlib produces: Segmentation fault
After playing around a bit with the linker-script, I've found out, that the only problem seems to be that I would like to have OUTPUT_FORMAT "binary" instead of "elf64-mmix". As soon as I use "elf64-mmix", it works.
Can you please attach test.o, the object file? Thanks. While it's definitely a bug that the linker segfaults, generating a "binary" file is generally better done using objcopy.
Created attachment 5758 [details] Object file, that causes the error
Ok, repeated.
CVSROOT: /cvs/src Module name: src Changes by: hp@sourceware.org 2011-07-25 01:14:20 Modified files: bfd : ChangeLog elf64-mmix.c Log message: PR ld/12815 * elf64-mmix.c (struct _mmix_elf_section_data): New members has_warned_bpo and has_warned_pushj. (mmix_final_link_relocate): Remove PARAMS and PTR macros, converting to ISO C. Add new parameter error_message. All callers changed. (mmix_elf_perform_relocation): Ditto. <case R_MMIX_PUSHJ_STUBBABLE, case R_MMIX_BASE_PLUS_OFFSET>: Handle the case where mmix_elf_check_common_relocs has not been called, missing preparations for relocs of the respective type. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/ChangeLog.diff?cvsroot=src&r1=1.5429&r2=1.5430 http://sourceware.org/cgi-bin/cvsweb.cgi/src/bfd/elf64-mmix.c.diff?cvsroot=src&r1=1.63&r2=1.64
CVSROOT: /cvs/src Module name: src Changes by: hp@sourceware.org 2011-07-25 01:16:05 Modified files: ld/testsuite : ChangeLog Added files: ld/testsuite/ld-mmix: pr12815-1.d pr12815-1.s pr12815-1.ld pr12815-2.d pr12815-2.s Log message: PR ld/12815 * ld-mmix/pr12815-1.d, ld-mmix/pr12815-1.s, ld-mmix/pr12815-1.ld, ld-mmix/pr12815-2.d, ld-mmix/pr12815-2.s: New tests. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1447&r2=1.1448 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-mmix/pr12815-1.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-mmix/pr12815-1.s.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-mmix/pr12815-1.ld.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-mmix/pr12815-2.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/testsuite/ld-mmix/pr12815-2.s.diff?cvsroot=src&r1=NONE&r2=1.1
Will instead error gracefully starting with binutils-2.22. See <http://sourceware.org/ml/binutils/2011-07/msg00199.html>. If the error message isn't helpful enough, please suggest improvements here or on the list. Thanks for the report.