{"id":854,"date":"2009-01-09T23:54:30","date_gmt":"2009-01-10T07:54:30","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=854"},"modified":"2020-07-25T23:39:57","modified_gmt":"2020-07-26T06:39:57","slug":"adventures-in-mips-tools","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/","title":{"rendered":"Adventures In MIPS Tools"},"content":{"rendered":"<p>I&#8217;m trying to compile a program that will run on <a href=\"http:\/\/multimedia.cx\/eggs\/got-a-cheap-mips-subnotebook\/\">my new MIPS-based subnotebook<\/a>. I finally got a cross-compiling toolchain built and building a super-simple C program. But the program failed to run. When I tried to run my sample program, the shell complained about not knowing what to do with a &#8216;(&#8216; character. Puzzling.<\/p>\n<p>This is the &#8216;file&#8217; type of my compiled program:<\/p>\n<blockquote><p>\nELF 32-bit <strong>MSB<\/strong> executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped<\/p><\/blockquote>\n<p>I finally thought to extract a binary from the MIPS machine and check its file type:<\/p>\n<blockquote><p>ELF 32-bit <strong>LSB<\/strong> executable, MIPS, version 1 (SYSV), dynamically linked (uses shared libs), stripped<\/p><\/blockquote>\n<p>Okay, I think I&#8217;m getting wise to the discrepancy already. It turns out that I want a target called &#8220;mipsel&#8221; rather than just plain &#8220;mips&#8221; as the former specifies little endian (and because a MIPS CPU can be wired to run either endian &#8212; that&#8217;s how simple and reduced this reduced instruction set is).<\/p>\n<p>So I rebuilt the toolchain using the &#8216;mipsel&#8217; target (building the toolchain is surprisingly quick when you know how). Now the test program segfaults when I try to run it. That&#8217;s unfortunate, though I still perceive it to be a step up from the last position. This is the new type reported by &#8216;file&#8217;:<\/p>\n<blockquote><p>\nELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), statically linked, not stripped\n<\/p><\/blockquote>\n<p>It&#8217;s MIPS-I version 1, vs. simply MIPS version 1, which is what the existing binaries are. I wonder if that&#8217;s the problem? I&#8217;m also struggling with a linker warning about the start location. That&#8217;s more likely to be the issue.<\/p>\n<p>BTW, this is the C code I am testing with:<\/p>\n<pre>\r\nint main()\r\n{\r\n  return 77;\r\n}\r\n<\/pre>\n<p>My thinking here is that I should be able to run the program followed by &#8220;echo $?&#8221; to get the last command&#8217;s exit status&#8211; 77 in this case.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trying to get my first MIPS program cross-compiled<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[111,125,126],"class_list":["post-854","post","type-post","status-publish","format-standard","hentry","category-programming","tag-mips","tag-netbook","tag-subnotebook"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Trying to get my first MIPS program cross-compiled\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Multimedia Mike\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta property=\"og:description\" content=\"Trying to get my first MIPS program cross-compiled\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2009-01-10T07:54:30+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-07-26T06:39:57+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Trying to get my first MIPS program cross-compiled\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#article\",\"name\":\"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes\",\"headline\":\"Adventures In MIPS Tools\",\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"},\"datePublished\":\"2009-01-09T23:54:30-08:00\",\"dateModified\":\"2020-07-25T23:39:57-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":8,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#webpage\"},\"articleSection\":\"Programming, mips, netbook, subnotebook\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/programming\\\/#listItem\",\"name\":\"Programming\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/programming\\\/#listItem\",\"position\":2,\"name\":\"Programming\",\"item\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/programming\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#listItem\",\"name\":\"Adventures In MIPS Tools\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#listItem\",\"position\":3,\"name\":\"Adventures In MIPS Tools\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/category\\\/programming\\\/#listItem\",\"name\":\"Programming\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/\",\"name\":\"Multimedia Mike\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Multimedia Mike\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#webpage\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/\",\"name\":\"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes\",\"description\":\"Trying to get my first MIPS program cross-compiled\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/adventures-in-mips-tools\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/author\\\/multimedia-mike\\\/#author\"},\"datePublished\":\"2009-01-09T23:54:30-08:00\",\"dateModified\":\"2020-07-25T23:39:57-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#website\",\"url\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/\",\"name\":\"Breaking Eggs And Making Omelettes\",\"description\":\"Topics On Multimedia Technology and Reverse Engineering\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/multimedia.cx\\\/eggs\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes","description":"Trying to get my first MIPS program cross-compiled","canonical_url":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#article","name":"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes","headline":"Adventures In MIPS Tools","author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"},"datePublished":"2009-01-09T23:54:30-08:00","dateModified":"2020-07-25T23:39:57-07:00","inLanguage":"en-US","commentCount":8,"mainEntityOfPage":{"@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#webpage"},"isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#webpage"},"articleSection":"Programming, mips, netbook, subnotebook"},{"@type":"BreadcrumbList","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","position":1,"name":"Home","item":"https:\/\/multimedia.cx\/eggs","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/programming\/#listItem","name":"Programming"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/programming\/#listItem","position":2,"name":"Programming","item":"https:\/\/multimedia.cx\/eggs\/category\/programming\/","nextItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#listItem","name":"Adventures In MIPS Tools"},"previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#listItem","position":3,"name":"Adventures In MIPS Tools","previousItem":{"@type":"ListItem","@id":"https:\/\/multimedia.cx\/eggs\/category\/programming\/#listItem","name":"Programming"}}]},{"@type":"Organization","@id":"https:\/\/multimedia.cx\/eggs\/#organization","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","url":"https:\/\/multimedia.cx\/eggs\/"},{"@type":"Person","@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author","url":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/","name":"Multimedia Mike","image":{"@type":"ImageObject","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/2eb93f7cada658f7986b5092062849fa255779eada3342c8f6b9a40764b95fdd?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Multimedia Mike"}},{"@type":"WebPage","@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#webpage","url":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/","name":"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes","description":"Trying to get my first MIPS program cross-compiled","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/multimedia.cx\/eggs\/#website"},"breadcrumb":{"@id":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/#breadcrumblist"},"author":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"creator":{"@id":"https:\/\/multimedia.cx\/eggs\/author\/multimedia-mike\/#author"},"datePublished":"2009-01-09T23:54:30-08:00","dateModified":"2020-07-25T23:39:57-07:00"},{"@type":"WebSite","@id":"https:\/\/multimedia.cx\/eggs\/#website","url":"https:\/\/multimedia.cx\/eggs\/","name":"Breaking Eggs And Making Omelettes","description":"Topics On Multimedia Technology and Reverse Engineering","inLanguage":"en-US","publisher":{"@id":"https:\/\/multimedia.cx\/eggs\/#organization"}}]},"og:locale":"en_US","og:site_name":"Breaking Eggs And Making Omelettes | Topics On Multimedia Technology and Reverse Engineering","og:type":"article","og:title":"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes","og:description":"Trying to get my first MIPS program cross-compiled","og:url":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/","article:published_time":"2009-01-10T07:54:30+00:00","article:modified_time":"2020-07-26T06:39:57+00:00","twitter:card":"summary","twitter:title":"Adventures In MIPS Tools | Breaking Eggs And Making Omelettes","twitter:description":"Trying to get my first MIPS program cross-compiled"},"aioseo_meta_data":{"post_id":"854","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-31 22:02:34","updated":"2025-12-31 19:03:20","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/multimedia.cx\/eggs\/category\/programming\/\" title=\"Programming\">Programming<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tAdventures In MIPS Tools\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/multimedia.cx\/eggs"},{"label":"Programming","link":"https:\/\/multimedia.cx\/eggs\/category\/programming\/"},{"label":"Adventures In MIPS Tools","link":"https:\/\/multimedia.cx\/eggs\/adventures-in-mips-tools\/"}],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=854"}],"version-history":[{"count":11,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/854\/revisions"}],"predecessor-version":[{"id":4635,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/854\/revisions\/4635"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}