{"id":837,"date":"2022-08-30T15:08:00","date_gmt":"2022-08-30T15:08:00","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/building-arm-assembler-vorbis-decoder-lib-tremolo-for-iphone-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:08:00","modified_gmt":"2022-08-30T15:08:00","slug":"building-arm-assembler-vorbis-decoder-lib-tremolo-for-iphone-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/building-arm-assembler-vorbis-decoder-lib-tremolo-for-iphone-collection-of-common-programming-errors\/","title":{"rendered":"Building ARM assembler vorbis decoder lib &#39;Tremolo&#39; for iPhone-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to compile Tremolo for iPhone. I&#8217;ve pulled in the files bitwise.c bitwiseARM.s codebook.c dpen.s dsp.c floor0.c floor1.c floor1ARM.s floor_lookup.c framing.c info.c mapping0.c mdct.c mdctARM.s misc.c res012.c into a new target, added the following custom settings:<\/p>\n<pre><code>GCC_PREPROCESSOR_DEFINITIONS = _ARM_ASSEM_\nGCC_C_LANGUAGE_STANDARD = gnu99\nGCC_THUMB_SUPPORT = YES\n<\/code><\/pre>\n<p>&#8230; but as soon as xcode reaches the first assembler file, bitwiseARM.s, I get errors like these:<\/p>\n<pre><code>\/tremolo\/bitwiseARM.s:3:Unknown pseudo-op: .global\n\/tremolo\/bitwiseARM.s:3:Rest of line ignored. 1st junk character valued 111 (o).\n\/tremolo\/bitwiseARM.s:4:Unknown pseudo-op: .global\n\/tremolo\/bitwiseARM.s:4:Rest of line ignored. 1st junk character valued 111 (o).\n\/tremolo\/bitwiseARM.s:5:Unknown pseudo-op: .global\n\/tremolo\/bitwiseARM.s:5:Rest of line ignored. 1st junk character valued 111 (o).\n\/tremolo\/bitwiseARM.s:6:Unknown pseudo-op: .global\n\/tremolo\/bitwiseARM.s:6:Rest of line ignored. 1st junk character valued 111 (o).\n\/tremolo\/bitwiseARM.s:11:bad instruction `STMFD r13!,{r10,r11,r14}'\n\/tremolo\/bitwiseARM.s:12:bad instruction `LDMIA r0,{r2,r3,r12}'\n\/tremolo\/bitwiseARM.s:16:bad instruction `SUBS r2,r2,r1'\n\/tremolo\/bitwiseARM.s:17:bad instruction `BLT look_slow'\n\/tremolo\/bitwiseARM.s:19:bad instruction `LDR r10,[r3]'\n<\/code><\/pre>\n<p>The first error I could google, and changing .global to .globl fixed the first errors, but I still get the bad instructions, and I don&#8217;t get why. Googling for the ARM instruction set, the above instructions look valid to me. I&#8217;ve tried toggling thumb support, and building for just armv7 instead of armv6, but neither helped.<\/p>\n<ol>\n<li>\n<p>As Igor says, Apple&#8217;s fork of gas is ancient and wants:<\/p>\n<ul>\n<li>.global replaced by .globl<\/li>\n<li>all instructions in lowercase<\/li>\n<li>replace &#8216;;&#8217; comment separator with &#8216;@&#8217;<\/li>\n<li>stub labels for address imports<\/li>\n<\/ul>\n<p>I&#8217;ve written a pre-processor awk script for the Tremolo .s files to make them acceptable to Xcode, which I&#8217;ll contribute back via Robin.<\/p>\n<p>Alternatively, you could try this.<\/p>\n<\/li>\n<li>\n<p>It seems like it&#8217;s trying to compile bitwiseARM.s in Thumb mode (e.g. Thumb uses <code>PUSH<\/code> instead of <code>STMFD SP!,<\/code>). I&#8217;m not sure what directives Apple&#8217;s gas supports (it&#8217;s based on some really ancient fork), but try adding <code>.arm<\/code> or <code>.code32<\/code> at the start of the file.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:48:20. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to compile Tremolo for iPhone. I&#8217;ve pulled in the files bitwise.c bitwiseARM.s codebook.c dpen.s dsp.c floor0.c floor1.c floor1ARM.s floor_lookup.c framing.c info.c mapping0.c mdct.c mdctARM.s misc.c res012.c into a new target, added the following custom settings: GCC_PREPROCESSOR_DEFINITIONS = _ARM_ASSEM_ GCC_C_LANGUAGE_STANDARD = gnu99 GCC_THUMB_SUPPORT = YES &#8230; but as soon as xcode reaches the first [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-837","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=837"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/837\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}