{"id":147,"date":"2008-03-08T14:47:12","date_gmt":"2008-03-08T22:47:12","guid":{"rendered":"http:\/\/www.outflux.net\/blog\/archives\/2008\/03\/08\/instaelf-via-gnu-as\/"},"modified":"2008-03-08T14:47:12","modified_gmt":"2008-03-08T22:47:12","slug":"instaelf-via-gnu-as","status":"publish","type":"post","link":"https:\/\/outflux.net\/blog\/archives\/2008\/03\/08\/instaelf-via-gnu-as\/","title":{"rendered":"instaELF via GNU as"},"content":{"rendered":"<p>Today I needed to generate a fake ELF file with specific section contents (I was testing &#8220;modinfo&#8221;, which expects to read the &#8220;.modinfo&#8221; ELF section).  For future reference, here&#8217;s how to create an empty .ko file that claims to have a GPL license:<\/p>\n<pre>\r\n$ cat &lt;&lt;EOM | as - -o \/tmp\/fake.ko\r\n> .section .modinfo\r\n> .string \"license=GPL\"\r\n> EOM\r\n<\/pre>\n<pre>\r\n$ modinfo \/tmp\/fake.ko\r\nfilename:       \/tmp\/fake.ko\r\nlicense:        GPL\r\n<\/pre>\n<p style='text-align:left'>&copy; 2008, <a href=\"https:\/\/outflux.net\/blog\/\">Kees Cook<\/a>. This work is licensed under a <a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\">Creative Commons Attribution-ShareAlike 4.0 License<\/a>.<br \/><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><img decoding=\"async\" alt=\"CC BY-SA 4.0\" style=\"border-width:0\" src=\"https:\/\/i.creativecommons.org\/l\/by-sa\/4.0\/88x31.png\" \/><\/a> <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I needed to generate a fake ELF file with specific section contents (I was testing &#8220;modinfo&#8221;, which expects to read the &#8220;.modinfo&#8221; ELF section). For future reference, here&#8217;s how to create an empty .ko file that claims to have a GPL license: $ cat &lt;&lt;EOM | as &#8211; -o \/tmp\/fake.ko > .section .modinfo > [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"_links":{"self":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/147"}],"collection":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/comments?post=147"}],"version-history":[{"count":0,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/posts\/147\/revisions"}],"wp:attachment":[{"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/media?parent=147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/categories?post=147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/outflux.net\/blog\/wp-json\/wp\/v2\/tags?post=147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}