定义一个汇编(.s)源Android.mk文件中的符号? [英] Define a symbol for an assembly (.s) source file in Android.mk?

查看:831
本文介绍了定义一个汇编(.s)源Android.mk文件中的符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种简单的方法来定义从Android NDK工具链的汇编程序 Android.mk 文件?

Is there a simple way to define a symbol for the Android NDK toolchain's assembler from the Android.mk file?

我的目标是能够建立几个.c和.s的由本机库(汇编)文件编制和调整为ARMv6的两种或ARMV7A EABIS,与所有需要的条件编译通过简单地修改APP_ABI价值驱动在Application.mk文件。

My objective is to be able to build a native library made up from several .C and .s (assembler) files compiled and tuned for either ARMV6 or ARMV7A EABIS, with all the required conditional compilation driven by simply modifying the APP_ABI value on the Application.mk file.

首先,我已成功使用了 IFEQ() Android.mk 可用指令来查询的价值APP_ABI值,然后conditionaly执行构建脚本的不同部分。

First I have succesfully used the ifeq() directives available in Android.mk to query the value of the APP_ABI value and then conditionaly execute different parts of the build script.

然后我试图以有条件注入一个符号(通过-D)要使用此功能,如:

Then I tried to use this functionality in order to conditionally inject a symbol (via -D), like this:

# Compilation Flags
ifeq ($(TARGET_ARCH_ABI),armeabi)
   LOCAL_CFLAGS += -DTARGET_ARMEABI -marm  -mtune='arm1136jf-s' -ffast-math -O3 -march=armv6 -fvisibility=hidden 
else
   #armeabi-v7a
   LOCAL_CFLAGS += -marm -ffast-math -O3 -march=armv7-a -fvisibility=hidden
endif

C源程序code文件找到TARGET_ARMEABI符号正确定义,但是汇编文件没有。(我属性根据架构要求这一点是为了确定合适的EABI)。这是我如何试图有条件地定义EABI在汇编语言文件属性的例子:

The C source code files find the TARGET_ARMEABI symbol properly defined, however the assembler files don't. (I require this in order to define proper EABI attributes according the architecture). This is an example of how I attempt to conditionally define EABI attributes in the assembly language files:

.ifdef TARGET_ARMEABI
    .arch armv6
    .fpu softvfp
    .eabi_attribute 23, 1
    .eabi_attribute 24, 1
    .eabi_attribute 25, 1
    .eabi_attribute 26, 2
    .eabi_attribute 30, 2
    .eabi_attribute 18, 4
.else
    .arch armv7-a
    .eabi_attribute 27, 3
    .fpu vfp
    .eabi_attribute 23, 1
    .eabi_attribute 24, 1
    .eabi_attribute 25, 1
    .eabi_attribute 26, 2
    .eabi_attribute 30, 2
    .eabi_attribute 18, 4
.endif

任何指针或建议,大大AP preciated。

Any pointers or suggestions are greatly appreciated.

推荐答案

大会文件需要与大写的S结束( .S .sx来)是由 GCC pprocessed $ p $。请参见 GCC文档,3.2选项控制有关输出的种类。

Assembly files needs to end with capital S (.S or .sx) to be preprocessed by gcc. See GCC doc, 3.2 Options Controlling the Kind of Output about that.

我相信你可以从仿生骗来源的,例如从的的libc /弓臂/仿生/ memcpy.S 的。

I believe you can cheat from Bionic sources, for example from libc/arch-arm/bionic/memcpy.S.

这篇关于定义一个汇编(.s)源Android.mk文件中的符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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