{"id":57,"date":"2010-07-12T14:15:56","date_gmt":"2010-07-12T14:15:56","guid":{"rendered":"https:\/\/blogs.scummvm.org\/toneman\/?p=57"},"modified":"2022-05-21T21:58:17","modified_gmt":"2022-05-21T21:58:17","slug":"a-size-able-problem-with-plugins","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/toneman\/2010\/07\/12\/a-size-able-problem-with-plugins\/","title":{"rendered":"a size-able problem with plugins"},"content":{"rendered":"<p><span class=\"Apple-style-span\">While working on changing how the loader opens and reads plugin files on the DS this weekend, I noticed that the &#8220;.plg&#8221; files produced in my builds were significantly smaller than expected (as in under a hundred kilobytes).<\/span><\/p>\n<div><span class=\"Apple-style-span\">\u00a0<\/span><\/div>\n<p><span class=\"Apple-style-span\">So I looked through verbose build output to investigate what the problem could be. The plugin linking output included all the necessary object files, so I knew the problem wasn&#8217;t there and decided to look closer at the plugin flags.<\/span><\/p>\n<div><span class=\"Apple-style-span\">\u00a0<\/span><\/div>\n<div><span class=\"Apple-style-span\">Last week when I added the PLUGIN_LDFLAGS into the ds\/arm9\/makefile, I copied over the regular LD_FLAGS to make sure all the special DS optimizations that occur when linking the main executable would be used for the plugin files as well (stuff like &#8220;-mthumb-interwork&#8221;). One of these flags was &#8220;&#8211;gc-sections&#8221; which I believe is meant to garbage collect sections full of unused functions and\/or data. Since both the main executable and the plugin files were using this flag (but plugins aren&#8217;t truly linked in to the main executable until run-time), functions and data in the main executable and the plugins that point to each other and nowhere else were mistakenly garbage-collected. After removing the &#8220;&#8211;gc-sections&#8221; flag from LDFLAGS and PLUGIN_LDFLAGS, plugins are a much more reasonable size. Unfortunately, this means the main executable is a bit more bloated than before, which runs counter to the goal of using as little memory as possible on the RAM-starved DS&#8230;<\/span><\/div>\n<div><span class=\"Apple-style-span\">\u00a0<\/span><\/div>\n<div><span class=\"Apple-style-span\">But for now, I&#8217;ll be moving on to reworking the loader to use &#8220;<\/span><span class=\"Apple-style-span\">Common::SeekableReadStream&#8221; to read plugin files.<\/span><\/div>\n<div><span class=\"Apple-style-span\">\u00a0<\/span><\/div>\n<div><span class=\"Apple-style-span\">~Tony<\/span><\/div>\n","protected":false},"excerpt":{"rendered":"<p>While working on changing how the loader opens and reads plugin files on the DS this weekend, I noticed that the &#8220;.plg&#8221; files produced in my builds were significantly smaller than expected (as in under a hundred kilobytes). \u00a0 So I looked through verbose build output to investigate what the problem could be. The plugin [&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-57","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/57","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/comments?post=57"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/57\/revisions"}],"predecessor-version":[{"id":58,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/posts\/57\/revisions\/58"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/media?parent=57"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/categories?post=57"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/toneman\/wp-json\/wp\/v2\/tags?post=57"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}