链接 Android C 代码和 ARM 汇编程序 [英] Linking Android C-code and ARM Assembler

查看:38
本文介绍了链接 Android C 代码和 ARM 汇编程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个 Android 应用程序.它使用一个主 C 代码模块和一个链接的 C 代码模块.现在我想用 ARM 汇编器模块替换链接模块.谁有简单的例子?

I have written an Android app. It uses a main C-code module and a linked-in C-code module. Now I want to replace the linked-in module with an ARM assembler module. Anyone have a simple example?

推荐答案

这是一个 Android.mk 文件示例,它将构建包含程序集的源树.要查看完整示例,请查看 NDK 包中分发的 hello-neon 示例.

Here's an example of Android.mk file that will build sourcetree containing assembly. To see a complete example check the hello-neon sample distributed in the NDK package.

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_ARM_MODE := arm  # remove this if you want thumb mode
LOCAL_ARM_NEON := true # remove this if you want armv5 mode

LOCAL_CFLAGS :=  -std=c99 -pedantic -v

LOCAL_SRC_FILES := # list your C, C++ and assembly sources here.
           # assembly source files ends with extension .S
           # add .arm after the extension if you want to compile in armv5 mode (default is thumb)
           # add .arm.neon to compile in armv7 mode

LOCAL_C_INCLUDES := $(LOCAL_PATH)

LOCAL_LDLIBS := -llog

LOCAL_MODULE := #the name of your shared library

include $(BUILD_SHARED_LIBRARY)

这篇关于链接 Android C 代码和 ARM 汇编程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆