{"id":3588,"date":"2015-01-06T02:50:53","date_gmt":"2015-01-05T17:50:53","guid":{"rendered":"http:\/\/kako.com\/blog\/?p=3588"},"modified":"2015-01-10T17:46:09","modified_gmt":"2015-01-10T08:46:09","slug":"android-ndk%e3%81%a8nexus9%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a664bit-arm%e3%81%ae%e3%82%a2%e3%82%bb%e3%83%b3%e3%83%96%e3%83%a9%e3%82%92%e8%a9%a6%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"http:\/\/kako.com\/blog\/?p=3588","title":{"rendered":"Android NDK\u3068Nexus9\u3092\u4f7f\u3063\u306664bit ARM\u306e\u30a2\u30bb\u30f3\u30d6\u30e9\u3092\u8a66\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p><a href=\"http:\/\/kako.com\/blog\/?p=3554\">Android NDK\u3068Nexus9\u3092\u4f7f\u3063\u306664bit ARM\u306e\u30d0\u30a4\u30ca\u30ea\u3092\u8a66\u3057\u3066\u307f\u305f\u8a71<\/a>\u306e\u7d9a\u304d\u3002<\/p>\n<p>\u4e00\u6628\u65e5\u66f8\u3044\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3067\u3001\u30a4\u30f3\u30e9\u30a4\u30f3\u30a2\u30bb\u30f3\u30d6\u30e9\u3067\u8a18\u8ff0\u3057\u305f2\u3064\u306e\u6574\u6570\u3092\u52a0\u7b97\u3059\u308b\u90e8\u5206\u3092\u30a2\u30bb\u30f3\u30d6\u30e9\u3067\u66f8\u304d\u76f4\u3057\u3066\u307f\u305f\u3002<\/p>\n<p>\u30a2\u30bb\u30f3\u30d6\u30e9\u90e8\u5206\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9add.s (c:\\work\\jni\\add.s)\u306f\u3053\u306e\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\t.global addvalues\r\n\t.text\r\n\t.align 4\r\naddvalues:\r\n\tADD x0,x0,x1;\r\n\tret;\r\n<\/pre>\n<p><!--more--><\/p>\n<p>C\u8a00\u8a9e\u306e\u30bd\u30fc\u30b9\u90e8\u5206(c:\\work\\jni\\addvalue.c)\u306f\u3001\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n#include &lt;stdio.h&gt;\r\n\r\nextern long int addvalues(long int, long int);\r\n\r\nint main(int argc, char **argv, char **envp)\r\n{\r\n  long int val=addvalues(1234567890123456789L,1L);\r\n  printf(&quot;addvalues = %ld\\n&quot;,val);\r\n  return 0;\r\n}\r\n<\/pre>\n<p>\u30a2\u30bb\u30f3\u30d6\u30e9\u3067\u66f8\u3044\u305faddvalues\u3068\u3044\u3046\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>Android.mk\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u3053\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u305f\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nLOCAL_PATH := $(call my-dir)\r\ninclude $(CLEAR_VARS)\r\nLOCAL_MODULE := addvalue\r\nLOCAL_SRC_FILES := addvalue.c\r\nLOCAL_SRC_FILES += add.s\r\nLOCAL_CFLAGS += -pie -fPIE\r\nLOCAL_LDFLAGS += -pie -fPIE\r\ninclude $(BUILD_EXECUTABLE)\r\n<\/pre>\n<p>-pie\u3068-fPIE\u306e\u30b3\u30f3\u30d1\u30a4\u30eb\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u8ffd\u52a0\u306f\u3001\u3057\u306a\u304f\u3066\u308264bit ARM\u306e\u30d0\u30a4\u30ca\u30ea\u751f\u6210\u3057\u305f\u3082\u306e\u306f\u5b9f\u6a5f\u3067\u52d5\u4f5c\u3057\u305f\u306e\u3060\u3051\u3069\u3001\u4e00\u5fdc\u5ff5\u306e\u305f\u3081\u306b\u8ffd\u52a0\u3057\u3066\u304a\u3044\u305f\u3002<\/p>\n<p>\u30d3\u30eb\u30c9\u624b\u9806\u3092\u8a18\u8ff0\u3057\u305f\u30d0\u30c3\u30c1\u30d5\u30a1\u30a4\u30eb\u306ebuild.bat (c:\\work\\build.bat) \u306e\u5185\u5bb9\u306f\u524d\u3068\u4e00\u7dd2\u3067\u4ee5\u4e0b\u306e\u901a\u308a\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nrem =========== environment setting ==========\r\nset PATH=%PATH%;c:\\android-ndk-r10d\\\r\nset ANDROID_NDK_ROOT=c:\\android-ndk-r10d\\\r\nset NDK_PROJECT_PATH=.\r\n \r\necho =========== 64bit build ============\r\ncall ndk-build -B V=1 APP_ABI=arm64-v8a\r\n \r\npause\r\n<\/pre>\n<p>\u3053\u306e\u30d0\u30c3\u30c1\u30d5\u30a1\u30a4\u30eb\u3092\u5b9f\u884c\u3059\u308c\u3070\u3001\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u304c\u30d3\u30eb\u30c9\u3055\u308c\u308b\u3002<\/p>\n<p>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306eadd.s\u306b\u3064\u3044\u3066\u306f\u300132bit ARM\u7528\u306e\u3082\u306e\u309264bit ARM\u7528\u306b\u66f8\u304d\u76f4\u3057\u3066\u4f5c\u6210\u3057\u305f\u3002<br \/>\n\u52a0\u7b97\u306e\u90e8\u5206\u306b\u3064\u3044\u3066<br \/>\n32bit ARM\u7528\u3060\u3068<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\tADD r0,r0,r1;\r\n<\/pre>\n<p>\u3068\u66f8\u304f\u3068\u3053\u308d\u3092\u300164bit\u7528\u306b\u66f8\u304d\u76f4\u3059\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306bx\u30ec\u30b8\u30b9\u30bf\u3092\u4f7f\u3046\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\tADD x0,x0,x1;\r\n<\/pre>\n<p>\u307e\u305f\u3001\u95a2\u6570\u304b\u3089\u306e\u30ea\u30bf\u30fc\u30f3\u547d\u4ee4\u3092\u66f8\u304d\u76f4\u3059\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\tbx lr;\r\n<\/pre>\n<p>\u3068\u66f8\u304f\u3068\u3053\u308d\u3092\u300164bit\u7528\u306b\u66f8\u304d\u76f4\u3059\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306bret\u3060\u3051\u66f8\u3051\u3070\u826f\u3044\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\tret;\r\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306b\u66f8\u304d\u76f4\u3057\u3066\u3001\u30d3\u30eb\u30c9\u3057\u305f\u3082\u306e\u304c\u7121\u4e8b\u306b\u5b9f\u6a5f(Nexus9)\u3067\u52d5\u4f5c\u78ba\u8a8d\u3067\u304d\u305f\u3002<\/p>\n<p><a href=\"http:\/\/kako.com\/blog\/?p=3598\">[\u7d9a\u304f]<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Android NDK\u3068Nexus9\u3092\u4f7f\u3063\u306664bit ARM\u306e\u30d0\u30a4\u30ca\u30ea\u3092\u8a66\u3057\u3066\u307f\u305f\u8a71\u306e\u7d9a\u304d\u3002 \u4e00\u6628\u65e5\u66f8\u3044\u305f\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3067\u3001\u30a4\u30f3\u30e9\u30a4\u30f3\u30a2\u30bb\u30f3\u30d6\u30e9\u3067\u8a18\u8ff0\u3057\u305f2\u3064\u306e\u6574\u6570\u3092\u52a0\u7b97\u3059\u308b\u90e8\u5206\u3092\u30a2\u30bb\u30f3\u30d6\u30e9\u3067\u66f8\u304d\u76f4\u3057\u3066\u307f\u305f\u3002 \u30a2\u30bb\u30f3\u30d6\u30e9 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2,14],"tags":[],"_links":{"self":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3588"}],"collection":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3588"}],"version-history":[{"count":7,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3588\/revisions"}],"predecessor-version":[{"id":3637,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3588\/revisions\/3637"}],"wp:attachment":[{"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3588"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kako.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}