From owner-freebsd-bugs@freebsd.org Sun Dec 4 02:34:47 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B0E7EC57B45 for ; Sun, 4 Dec 2016 02:34:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9FBA214DD for ; Sun, 4 Dec 2016 02:34:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id uB42YlEx062936 for ; Sun, 4 Dec 2016 02:34:47 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 215037] head -r309179's Clang 3.9.0 for from-amd64 cross built TARGET_ARCH=powerpc64 buildworld uses ATT or Intel inline assembler parsing on powerpc64's lib32 code Date: Sun, 04 Dec 2016 02:34:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: markmi@dsl-only.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2016 02:34:47 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D215037 Bug ID: 215037 Summary: head -r309179's Clang 3.9.0 for from-amd64 cross built TARGET_ARCH=3Dpowerpc64 buildworld uses ATT or Intel inline assembler parsing on powerpc64's lib32 code Product: Base System Version: CURRENT Hardware: powerpc OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: markmi@dsl-only.net [Note: on a powerpc64 head -r309179 self-built buildworld based on its system clang 3.9.0 I had no trouble with building using "WITH_LIB32=3D" ; only cross building WITH_LIB32=3D seems to have the issue of the wrong machine's assembler notation being involved for lib32's build attempt.] Attempting buildworld for powerpc64 (cross built from an amd64 context) usi= ng WITH_LIB32=3D fails with messages such as: (among other assembler notation rejections) /root/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_clang_altbinuti= ls_world-amd64-host-2016-11-27:16:56:44:/usr/src/lib/csu/powerpc/crti.S:35:= 2: error: invalid instruction mnemonic 'mflr' /root/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_clang_altbinuti= ls_world-amd64-host-2016-11-27:16:56:44:/usr/src/lib/csu/powerpc/crti.S:38:= 2: error: invalid instruction mnemonic 'mr' /root/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_clang_altbinuti= ls_world-amd64-host-2016-11-27:16:56:44:/usr/src/lib/csu/powerpc/crti.S:46:= 2: error: invalid instruction mnemonic 'mflr' /root/sys_typescripts/typescript_make_powerpc64vtsc_nodebug_clang_altbinuti= ls_world-amd64-host-2016-11-27:16:56:44:/usr/src/lib/csu/powerpc/crti.S:49:= 2: error: invalid instruction mnemonic 'mr' I tried to find what produced those messages: # find /usr/src/contrib/llvm/ -type f -exec grep "invalid instruction mnemo= nic" {} \; -print | more return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'", return Error(IDLoc, "invalid instruction mnemonic '" + Mnemonic + "'", /usr/src/contrib/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp return Error(IDLoc, "invalid instruction mnemonic"); /usr/src/contrib/llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp (No others.) X86/AsmParser/X86AsmParser.cpp has: bool X86AsmParser::MatchAndEmitATTInstruction(SMLoc IDLoc, unsigned &Opcode, . . . return Error(IDLoc, "invalid instruction mnemonic '" + Base + "'", Ranges, MatchingInlineAsm); . . . bool X86AsmParser::MatchAndEmitIntelInstruction(SMLoc IDLoc, unsigned &Opco= de, . . . return Error(IDLoc, "invalid instruction mnemonic '" + Mnemonic + "'", Ranges, MatchingInlineAsm); . . . (The Sparc code message does not match the output text fully.) I did not find anything else in clang/llvm that would produce the text of the messages output. Either an internal powerpc assembler decoding should be used or an external powerpc assembler should be used during the lib32 build. No ATT or Intel instruction assembly should be involved despite the amd64 host that is involved in this type of cross build. Installing the WITHOUT_LIB32=3D environment on a powerpc64 and booting it allowed then building WITH_LIB32=3D on the powerpc64 itself. And booting with the lib32 build installed allows lib32 use: # ldd32 /usr/lib32/libgcc_s.so.1=20 /usr/lib32/libgcc_s.so.1: libc.so.7 =3D> /usr/lib32/libc.so.7 (0x41841000) # file `which ldd32` /usr/bin/ldd32: ELF 32-bit MSB executable, PowerPC or cisco 4500, version 1 (FreeBSD), dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 12.0 (1200017), FreeBSD-style, stripped So it seems that there is a HOST vs. TARGET_ARCH confusion in what assembler notation ends up being set up for TARGET_ARCH's lib32 build use when it is not matching the HOST's lib32's notation. --=20 You are receiving this mail because: You are the assignee for the bug.=