If you compile newlib in x86-64 host and want to have 64-bits newlib, you have to add “–disable-multilib“, otherwise you will get the following error:
x86_64-peter-elf-cc -B/root/workspace2/newlib-1.<wbr />19.0build/x86_64-peter-elf/32/<wbr />newlib/ -isystem /root/workspace2/newlib-1.19.<wbr />0build/x86_64-peter-elf/32/<wbr />newlib/targ-include -isystem /root/workspace2/newlib-1.19.<wbr />0/newlib/libc/include -B/root/workspace2/newlib-1.<wbr />19.0build/x86_64-peter-elf/32/<wbr />libgloss/x86_64 -L/root/workspace2/newlib-1.<wbr />19.0build/x86_64-peter-elf/32/<wbr />libgloss/libnosys -L/root/workspace2/newlib-1.<wbr />19.0/libgloss/x86_64 -m32 -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.19.0\" -DPACKAGE_STRING=\"newlib\ 1.19.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../../newlib-<wbr />1.19.0/newlib/libc/machine/<wbr />x86_64 -DMISSING_SYSCALL_NAMES -fno-builtin -DMISSING_SYSCALL_NAMES -fno-builtin -O2 -g -m32 -c -o lib_a-setjmp.o `test -f 'setjmp.S' || echo '../../../../../../../newlib-<wbr />1.19.0/newlib/libc/machine/<wbr />x86_64/'`setjmp.S ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S: Assembler messages: ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:25: Error: bad register name `%rbx' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:26: Error: bad register name `%rbp' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:27: Error: bad register name `%r12' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:28: Error: bad register name `%r13' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:29: Error: bad register name `%r14' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:30: Error: bad register name `%r15' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:31: Error: bad register name `%rsp)' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:32: Error: bad register name `%rax' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:33: Error: bad register name `%rsp)' ../../../../../../../newlib-1.<wbr />19.0/newlib/libc/machine/x86_<wbr />64/setjmp.S:34: Error: bad register name `%rax'