Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 04 Dec 2016 02:34:47 +0000
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
Message-ID:  <bug-215037-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-215037-8>