<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:DengXian;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F \5B57\7B26";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:SimSun;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        text-indent:21.0pt;
        font-size:10.5pt;
        font-family:DengXian;}
span.HTML
        {mso-style-name:"HTML \9884\8BBE\683C\5F0F \5B57\7B26";
        mso-style-priority:99;
        mso-style-link:"HTML \9884\8BBE\683C\5F0F";
        font-family:SimSun;}
.MsoChpDefault
        {mso-style-type:export-only;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1315600941;
        mso-list-type:hybrid;
        mso-list-template-ids:-894115010 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:18.0pt;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%2\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:42.0pt;
        text-indent:-21.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:63.0pt;
        text-indent:-21.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:84.0pt;
        text-indent:-21.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%5\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:105.0pt;
        text-indent:-21.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:126.0pt;
        text-indent:-21.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:147.0pt;
        text-indent:-21.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%8\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:168.0pt;
        text-indent:-21.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:189.0pt;
        text-indent:-21.0pt;}
@list l1
        {mso-list-id:1490906754;
        mso-list-type:hybrid;
        mso-list-template-ids:-1943116764 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:18.0pt;
        text-indent:-18.0pt;
        color:windowtext;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%2\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:42.0pt;
        text-indent:-21.0pt;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:63.0pt;
        text-indent:-21.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:84.0pt;
        text-indent:-21.0pt;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%5\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:105.0pt;
        text-indent:-21.0pt;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:126.0pt;
        text-indent:-21.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:147.0pt;
        text-indent:-21.0pt;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%8\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:168.0pt;
        text-indent:-21.0pt;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:189.0pt;
        text-indent:-21.0pt;}
@list l2
        {mso-list-id:1955743137;
        mso-list-type:hybrid;
        mso-list-template-ids:-368902200 -1 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:18.0pt;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.5pt;
        font-family:"Times New Roman",serif;
        mso-ascii-font-family:DengXian;
        mso-fareast-font-family:DengXian;
        mso-hansi-font-family:DengXian;
        mso-bidi-font-family:"Times New Roman";}
@list l2:level2
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%2\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:42.0pt;
        text-indent:-21.0pt;}
@list l2:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:63.0pt;
        text-indent:-21.0pt;}
@list l2:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:84.0pt;
        text-indent:-21.0pt;}
@list l2:level5
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%5\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:105.0pt;
        text-indent:-21.0pt;}
@list l2:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:126.0pt;
        text-indent:-21.0pt;}
@list l2:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:147.0pt;
        text-indent:-21.0pt;}
@list l2:level8
        {mso-level-number-format:alpha-lower;
        mso-level-text:"%8\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:168.0pt;
        text-indent:-21.0pt;}
@list l2:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        margin-left:189.0pt;
        text-indent:-21.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style></head><body lang=ZH-CN link=blue vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hello list</span></p><p class=MsoNormal><span lang=EN-US>I have some problems when using x86 cross-compile the arm progress.</span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>First I know a way to get aarch64 binary in x86 with llvm/clang.</span></p><p class=MsoNormal><span lang=EN-US>There need two things prepared for cross-compile.</span></p><div><pre style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo3'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>1.<span style='font:7.0pt "Times New Roman"'>  </span></span></span><![endif]><span lang=EN-US>GUN ARM toolchain </span><span lang=EN-US style='font-family:Wingdings'>à</span><span lang=EN-US>  apt-get install <span style='color:black'>gcc-arm-linux-gnueabi<o:p></o:p></span></span></pre><div><pre style='margin-left:18.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo3'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>2.<span style='font:7.0pt "Times New Roman"'>  </span></span></span><![endif]><span lang=EN-US style='color:black'>Clang/llvm compile </span><span lang=EN-US style='font-family:Wingdings;color:black'>à</span><span lang=EN-US style='color:black'> <a href="http://clang.llvm.org/get_started.html">http://clang.llvm.org/get_started.html</a><o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>clang -emit-llvm -target aarch64 helloworld.c -I /usr/aarch64-linux-gnu/include -c  <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>(can get helloworld.bc)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>llc helloworld.bc -o helloworld.s<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>aarch64-linux-gnu-gcc helloworld.s -o helloworld<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>From the cmd above, I can get the aarch64 binary which is function well in aarch64 machine.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>But, Is there other way that I can get aarch64 without gcc.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>When I try to use below:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>clang -v -target arm-linux-gnueabi --sysroot=/usr/arm-linux-gnueabi/ helloworld.c -o hello <o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>I get:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Obfuscator-LLVM clang version 3.6.1 (tags/RELEASE_361/final) (based on Obfuscator-LLVM 3.6.1)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Target: arm--linux-gnueabi<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Thread model: posix<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> "/usr/local/bin/clang-3.6" -cc1 -triple armv4t--linux-gnueabi -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name arm.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu arm7tdmi -target-feature +soft-float-abi -target-abi aapcs-linux -mfloat-abi soft -v -dwarf-column-info -resource-dir /usr/local/bin/../lib/clang/3.6.1 -isysroot /usr/arm-linux-gnueabi/ -internal-isystem /usr/arm-linux-gnueabi//usr/local/include -internal-isystem /usr/local/bin/../lib/clang/3.6.1/include -internal-externc-isystem /usr/arm-linux-gnueabi//include -internal-externc-isystem /usr/arm-linux-gnueabi//usr/include -fdebug-compilation-dir /home/zyj/Desktop -ferror-limit 19 -fmessage-length 80 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/helloworld-6b36a6.o -x c helloworld.c<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>clang -cc1 version 3.6.1 based upon Obfuscator-LLVM 3.6.1 default target i386-pc-linux-gnu<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>ignoring nonexistent directory "/usr/arm-linux-gnueabi//usr/local/include"<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>ignoring nonexistent directory "/usr/arm-linux-gnueabi//usr/include"<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>#include "..." search starts here:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>#include <...> search starts here:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> /usr/local/bin/../lib/clang/3.6.1/include<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> /usr/arm-linux-gnueabi//include<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>End of search list.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> "/usr/local/bin/ld" --sysroot=/usr/arm-linux-gnueabi/ -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux.so.3 -o hello /usr/arm-linux-gnueabi//lib/../lib/crt1.o /usr/arm-linux-gnueabi//lib/../lib/crti.o crtbegin.o -L/usr/arm-linux-gnueabi//lib/../lib -L/usr/arm-linux-gnueabi//lib /tmp/helloworld-6b36a6.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /usr/arm-linux-gnueabi//lib/../lib/crtn.o<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: unrecognised emulation mode: armelf_linux_eabi<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Supported emulations: elf_i386 i386linux elf32_x86_64 elf_x86_64 elf_l1om elf_k1om i386pep i386pe<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>clang-3.6: error: linker command failed with exit code 1 (use -v to see invocation)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>This seems that linker is wrong, so I change the ld point to /usr/arm-linux-gnueabi/bin/ld<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>(using: ln -s /usr/arm-linux-gnueabi/bin/ld ld)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>But I get anther question<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>Obfuscator-LLVM clang version 3.6.1 (tags/RELEASE_361/final) (based on Obfuscator-LLVM 3.6.1)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Target: arm--linux-gnueabi<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Thread model: posix<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> "/usr/local/bin/clang-3.6" -cc1 -triple armv4t--linux-gnueabi -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name arm.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu arm7tdmi -target-feature +soft-float-abi -target-abi aapcs-linux -mfloat-abi soft -v -dwarf-column-info -resource-dir /usr/local/bin/../lib/clang/3.6.1 -isysroot /usr/arm-linux-gnueabi/ -internal-isystem /usr/arm-linux-gnueabi//usr/local/include -internal-isystem /usr/local/bin/../lib/clang/3.6.1/include -internal-externc-isystem /usr/arm-linux-gnueabi//include -internal-externc-isystem /usr/arm-linux-gnueabi//usr/include -fdebug-compilation-dir /home/zyj/Desktop -ferror-limit 19 -fmessage-length 80 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/helloworld-fa5b7f.o -x c helloworld.c<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>clang -cc1 version 3.6.1 based upon Obfuscator-LLVM 3.6.1 default target i386-pc-linux-gnu<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>ignoring nonexistent directory "/usr/arm-linux-gnueabi//usr/local/include"<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>ignoring nonexistent directory "/usr/arm-linux-gnueabi//usr/include"<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>#include "..." search starts here:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>#include <...> search starts here:<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> /usr/local/bin/../lib/clang/3.6.1/include<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> /usr/arm-linux-gnueabi//include<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>End of search list.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'> "/usr/local/bin/ld" --sysroot=/usr/arm-linux-gnueabi/ -z relro -X --hash-style=gnu --build-id --eh-frame-hdr -m armelf_linux_eabi -dynamic-linker /lib/ld-linux.so.3 -o hello /usr/arm-linux-gnueabi//lib/../lib/crt1.o /usr/arm-linux-gnueabi//lib/../lib/crti.o crtbegin.o -L/usr/arm-linux-gnueabi//lib/../lib -L/usr/arm-linux-gnueabi//lib /tmp/helloworld-fa5b7f.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed crtend.o /usr/arm-linux-gnueabi//lib/../lib/crtn.o<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find crtbegin.o: No such file or directory<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find -lgcc<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find -lgcc_s<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/libc.so.6 inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/libc_nonshared.a inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/ld-linux.so.3 inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>clang-3.6: error: linker command failed with exit code 1 (use -v to see invocation)<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>From above message I am confused about the:<o:p></o:p></span></pre></div></div><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find crtbegin.o: No such file or directory<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find -lgcc<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find -lgcc_s<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/libc.so.6 inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/libc_nonshared.a inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>/usr/local/bin/ld: cannot find /usr/arm-linux-gnueabi/lib/ld-linux.so.3 inside /usr/arm-linux-gnueabi/<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'><o:p> </o:p></span></pre><pre><span lang=EN-US style='color:black'>While all these lib is at the right location, why error says ld cannot find them.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>If you need more imformation from me, please let me know.<o:p></o:p></span></pre><pre><span lang=EN-US style='color:black'>Thanks<o:p></o:p></span></pre></div></body></html>