Last week when we tried to cross-compile shabal hash library for Windows using i686-w64-mingw32-as on Ubuntu, but we got the following error:
shabal.s: Assembler messages:
shabal.s:56: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:56: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1201: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1201: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1208: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1208: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1245: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1245: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1249: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1249: Error: junk at end of line, first unrecognized character is `i'
shabal.s:1459: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1459: Error: junk at end of line, first unrecognized character is `i'
shabal.s:1463: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1463: Error: junk at end of line, first unrecognized character is `r'
shabal.s:1472: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1472: Error: junk at end of line, first unrecognized character is `r'
shabal.s:1489: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1489: Error: junk at end of line, first unrecognized character is `a'
shabal.s:1509: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1509: Error: junk at end of line, first unrecognized character is `a'
shabal.s:1520: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1520: Error: junk at end of line, first unrecognized character is `a'
shabal.s:1535: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1535: Error: junk at end of line, first unrecognized character is `a'
shabal.s:1543: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1543: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1643: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1643: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1652: Warning: .type pseudo-op used outside of .def/.endef ignored.
shabal.s:1652: Error: junk at end of line, first unrecognized character is `s'
shabal.s:1736: Warning: .size pseudo-op used outside of .def/.endef ignored.
shabal.s:1736: Error: junk at end of line, first unrecognized character is `s'
**** Error: junk at end of line, first unrecognized character is `s'
Makefile:24: recipe for target 'shabal.o' failed
make: *** [shabal.o] Error 1
The error seemed to be obvious. Because the assembler syntaxes of ELF on Linux and PE/COFF on Windows are different.
To see the actual differences, run this command in terminal of Ubuntu Linux first:
echo "void a_function_definition () { }" | gcc -S -x c - -o -
Result of gcc on Ubuntu:
.file ""
.text
.globl a_function_definition
.type a_function_definition, @function
a_function_definition:
.LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
nop
popl %ebp
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size a_function_definition, .-a_function_definition
.ident "GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609"
.section .note.GNU-stack,"",@progbits
Then run the following command for the cross-compiler i686-w64-mingw32-gcc on Ubuntu:
echo "void a_function_definition () { }" | i686-w64-mingw32-gcc -S -x c - -o -
Result of i686-w64-mingw32-gcc on Ubuntu:
.file ""
.text
.globl _a_function_definition
.def _a_function_definition; .scl 2; .type 32; .endef
_a_function_definition:
pushl %ebp
movl %esp, %ebp
nop
popl %ebp
ret
.ident "GCC: (GNU) 5.3.1 20160211"
Finally, run this command of mingw gcc on Windows:
echo "void a_function_definition () { }" | gcc -S -x c - -o -
Result of gcc on Windows:
.file ""
.text
.globl _a_function_definition
.def _a_function_definition; .scl 2; .type 32; .endef
_a_function_definition:
LFB0:
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
nop
popl %ebp
.cfi_restore 5
.cfi_def_cfa 4, 4
ret
.cfi_endproc
LFE0:
.ident "GCC: (i686-posix-dwarf-rev0, Built by MinGW-W64 project) 5.4.0"
So, we applied the fix by changing necessary def in the assembler code directly.
Run make again, and it works as expected.
China Sources is a website with large variety of topics and interests from free Chinese sources (non-profit). Read our Privacy Policy at our group website(s) about China Profits or Saving Money.
Best Viewed Sources (Top 5)
-
Weibo, means micro-blogging in Chinese, has become increasingly popular in mainland China, just like Twitter
-
In our last blog post, we introduced some practical methods to unfreeze Sina Weibo. These methods
-
No matter you are trading with China or not, it is necessary for your organization to realize
-
We hoped we have expressed why socialization is so important to human beings, although weeks ago we already published
-
What Is Physiotherapy? If you have a musculo-skeletal injury or problem, you might be
Subscribe to:
Post Comments (Atom)
Best Viewed Sources (Weekly)
-
Weibo, means micro-blogging in Chinese, has become increasingly popular in mainland China, just like Twitter
-
What Is Physiotherapy? If you have a musculo-skeletal injury or problem, you might be
-
In our last blog post, we introduced some practical methods to unfreeze Sina Weibo. These methods
-
Below is a true story about Christmas. We, China Sources Team, would like o share this special
-
Summer is a wonderful season when students in different countries get to have some time off from
-
Real Vegetarian Food in Thai Asian people have long known that living off the land and eating a vegetarian diet is
-
In our past blog posts, we have looked at some facts about historical development of English within British Isles.
-
Our previous post about socialization mentioned about interaction with other people is so important for human development
-
There are really numerous methods to spend your exciting holiday in Asia region, including China.
-
Summer is the time to get away from schoolwork, relax and have a great
0 comments:
Post a Comment