BREW AMR 编译错误 L6248E
来源:互联网 发布:软件著作权补贴 编辑:程序博客网 时间:2024/05/18 03:59
主要是由于使用全局变量造成的, 如果要使用全局数组,如 int a[ ] = {1,2,3 };
请在前面加上const , 如下const static int a[ ] = {1,2,3 }; 请勿使用全局指针.
This linker error can occur when trying to build "Position Independent" code. Consider a small example like:
#include <stdio.h>
char *str = "test";
int main(void)
{
printf ("%s",str);
}
when compiled and linked with:
armcc -c -apcs /ropi pi.c
armlink -ropi pi.o
the linker will report a message of the form:
Error: L6248E: pi.o(.data) in ABSOLUTE region 'ER_RW' cannot have address/offset type
relocation to .constdata in PI region 'ER_RO'.
For the code above, the compiler generates a global pointer "str" to the char string "test". The global pointer "str" will need to be initialized to the address of the char string "test" in the .constdata section. However, absolute addresses cannot be used in a PI system, so the link step fails, because of the ABS32 relocations to (position independent) .constdata.
To resolve this, you must re-write the code to avoid the explicit pointer. Two possible ways are shown below:
1) Use a global array instead of a global pointer:
#include <stdio.h>
const char str[] = "test";
int main(void)
{
printf ("%s",str);
}
2) Use a local pointer instead of a global pointer:
#include <stdio.h>
int main(void)
{
char *str = "test";
printf ("%s",str);
}
Please note that if you are using a list with multiple elements, such as:
char * list[] = {"zero", "one", "two"};
You will get a separate link error for each element in the array. In this case, the recommended solution is:
char list[3][5] = {"zero", "one", "two"};
with the print instruction being (for example):
printf("%s", list[1]);
Note that you will need to declare a two dimensional array for the list, with the first dimension as the number of elements in the array, and the second dimension as the maximum size for an element in the array.
- BREW AMR 编译错误 L6248E
- BREW编译错误 Error: L6265E Error: L6248E
- BREW动态编译:L6265E和L6248E错误
- Brew ---- ARM 链接出错 Error: L6248E
- BREW开发ARM编译连接错误
- XCode6 编译opencore-amr
- amr 编译脚本
- [mac]brew install nginx,出现编译错误怎么办?
- 编译opencore-amr for iOS
- 编译opencore-amr for iOS
- iOS交叉编译opencore-amr
- 编译opencore-amr源码小记
- ios9设置bitcode AMR编译
- Windows 下编译opencore-amr
- Brew常见错误整理
- Brew常见错误整理
- Brew常见错误整理
- brew link conf 错误
- Windows下访问ext3分区
- VC基础知识
- erter
- C++资料下载
- 使用数据库引擎优化Tuning Advistor和dta
- BREW AMR 编译错误 L6248E
- http状态码列表
- Imagine Cup参赛日志
- 线程中的同步(synchronized)的解释和例子
- 哈哈,我的博客频道开通了!
- 200年10月12日
- 难过的一天
- 第一天底层学习的感受
- 一个人吃饭