2

I have trouble compiling my assembly code.

gcc returns: func_select.s:5: Error: invalid character (0xe2) in mnemonic func_select.s:7: Error: invalid character (0xe2) in mnemonic

here is the code (lines 5-7):

secondStringLength:     ‫‪.string " second pstring length: %d‬‬\n"
OldChar:                .string "‫‪old char: %c,‬‬"
NewChar:                ‫‪.string " new char: %c,‬‬"

How can I fix this?

Paul R
  • 208,748
  • 37
  • 389
  • 560
Shay Chercavsky
  • 47
  • 2
  • 12

2 Answers2

2

Remove the formatting characters embedded in the text.

$ charinfo 'secondStringLength:‫‪.string " second pstring length: %d‬‬\n"'
U+0073 LATIN SMALL LETTER S [Ll]
U+0065 LATIN SMALL LETTER E [Ll]
 ...
U+0068 LATIN SMALL LETTER H [Ll]
U+003A COLON [Po]
U+202B RIGHT-TO-LEFT EMBEDDING [Cf]
U+202A LEFT-TO-RIGHT EMBEDDING [Cf]
U+002E FULL STOP [Po]
U+0073 LATIN SMALL LETTER S [Ll]
 ...
U+0025 PERCENT SIGN [Po]
U+0064 LATIN SMALL LETTER D [Ll]
U+202C POP DIRECTIONAL FORMATTING [Cf]
U+202C POP DIRECTIONAL FORMATTING [Cf]
U+005C REVERSE SOLIDUS [Po]
U+006E LATIN SMALL LETTER N [Ll]
U+0022 QUOTATION MARK [Po]
Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
2

Igancio Vazquez-Abrams is right. To provide more detail, according to xxd this is your first line:

$ cat b | xxd
00000000: 7365 636f 6e64 5374 7269 6e67 4c65 6e67  secondStringLeng
00000010: 7468 3a20 2020 2020 e280 abe2 80aa 2e73  th:     .......s
00000020: 7472 696e 6720 2220 7365 636f 6e64 2070  tring " second p
00000030: 7374 7269 6e67 206c 656e 6774 683a 2025  string length: %
00000040: 64e2 80ac e280 ac5c 6e22 0a0a            d......\n"..

Note: e2 80 ab and then e2 80 aa. These are the U+202B and U+202A mentioned earlier. Remove them (as well as the next 2 U+202C).

cnicutar
  • 178,505
  • 25
  • 365
  • 392