ADS转RVDS invalid call from '~PRES8' function to 'REQ8' function
2013-05-28 14:55
375 查看
把ADS的文件放到RVDS2.2的工程里,make时出现invalid call from '~PRES8' function to 'REQ8'...
google加ARM网站,找到一段解释:
This RVDS/RVCT linker error is given where a stack alignment conflict is detected in object code. The "ABI for the ARM Architecture" demands that code maintains 8-byte stack alignment
at its interfaces. This allows efficient use of LDRD and STRD instructions (in ARM Architecture 5TE and later) to access 8-byte-aligned "double" and "long
long" data types.
Symbols like '~PRES8' and 'REQ8' are "Build Attributes" of the objects.
PRES8 means the object PREServes 8-byte alignment of the stack.
~PRES8 means the object does NOT preserve 8-byte alignment of the stack (~ meaning NOT).
REQ8 means the object REQuires 8-byte alignment of the stack.
This link error typically occurs in two cases:
where assembler code (that does not preserve 8-byte stack alignment) calls compiled C/C++ code (that requires 8-byte stack alignment), and
when attempting to link legacy SDT/ADS objects with RVCT 2.x objects. Legacy SDT/ADS objects that do not have these attributes are treated as '~PRES8', even if they do actually
happen to preserve 8-byte alignment.
For example:
Error: L6238E: foo.o(.text) contains invalid call from '~PRES8' function to 'REQ8' function foobar
This means that there is a function in the object foo.o (in the section named .text) that does not preserve 8-byte stack
alignment, but which is trying to call function foobar that requires 8-byte stack alignment.
A similar warning that may be encountered, where the address of an external symbol is being referred to, is:
Warning: L6306W: '~PRES8' section foo.o(.text) should not use the address of 'REQ8' function foobar
Solutions
There are two possible approaches to dealing with this issue:
1) If you have access to all your source code and are allowed to rebuild it
In this case you should rebuild all your objects/libraries using the latest version of the compilation tools. Note that if you have any assembler files, you will need to:
i) check that all instructions preserve 8-byte stack alignment, and if necessary, correct them.
e.g. change:
to:
and:
ii) add the PRESERVE8 directive to the top of each assembler file.
e.g. change:
to:
(the PRES8 attribute applies to the whole object, not just the code section).
2) If you cannot rebuild all of your source code
If you have any legacy objects/libraries that cannot be rebuilt, either because you do not have the source code, or because the old objects must not be rebuilt (e.g. for qualification/certification reasons), then you must inspect the legacy objects to check
whether they preserve 8-byte alignment or not. Use "fromelf -c" to disassemble the object code. C/C++ code compiled with ADS 1.1 or later will normally preserve 8-byte alignment, but assembled code will not.
If your objects do indeed preserve 8-byte alignment, then the linker error L6238E can be suppressed with the use of "--diag_suppress
6238" on the linker command line. By using this, you are effectively saying "I guarantee that these objects are PRES8". The linker warning L6306W is suppressible with "--diag_suppress
6306".
If you are linking with legacy objects/libraries then you should also read the information on the option "--apcs /adsabi" in the FAQ entry "Are
legacy ADS objects/libraries compatible with RVCT 2.0 ?".
我对这个问题的解决如下:
在我的文件中加入了
to:
google加ARM网站,找到一段解释:
This RVDS/RVCT linker error is given where a stack alignment conflict is detected in object code. The "ABI for the ARM Architecture" demands that code maintains 8-byte stack alignment
at its interfaces. This allows efficient use of LDRD and STRD instructions (in ARM Architecture 5TE and later) to access 8-byte-aligned "double" and "long
long" data types.
Symbols like '~PRES8' and 'REQ8' are "Build Attributes" of the objects.
PRES8 means the object PREServes 8-byte alignment of the stack.
~PRES8 means the object does NOT preserve 8-byte alignment of the stack (~ meaning NOT).
REQ8 means the object REQuires 8-byte alignment of the stack.
This link error typically occurs in two cases:
where assembler code (that does not preserve 8-byte stack alignment) calls compiled C/C++ code (that requires 8-byte stack alignment), and
when attempting to link legacy SDT/ADS objects with RVCT 2.x objects. Legacy SDT/ADS objects that do not have these attributes are treated as '~PRES8', even if they do actually
happen to preserve 8-byte alignment.
For example:
Error: L6238E: foo.o(.text) contains invalid call from '~PRES8' function to 'REQ8' function foobar
This means that there is a function in the object foo.o (in the section named .text) that does not preserve 8-byte stack
alignment, but which is trying to call function foobar that requires 8-byte stack alignment.
A similar warning that may be encountered, where the address of an external symbol is being referred to, is:
Warning: L6306W: '~PRES8' section foo.o(.text) should not use the address of 'REQ8' function foobar
Solutions
There are two possible approaches to dealing with this issue:
1) If you have access to all your source code and are allowed to rebuild it
In this case you should rebuild all your objects/libraries using the latest version of the compilation tools. Note that if you have any assembler files, you will need to:
i) check that all instructions preserve 8-byte stack alignment, and if necessary, correct them.
e.g. change:
STMFD sp!, {r0-r3, lr} ; push an odd number of registers
to:
STMFD sp!, {r0-r3, r12, lr} ; push an even number of registers
and:
ii) add the PRESERVE8 directive to the top of each assembler file.
e.g. change:
AREA Init, CODE, READONLY
to:
PRESERVE8 AREA Init, CODE, READONLY
(the PRES8 attribute applies to the whole object, not just the code section).
2) If you cannot rebuild all of your source code
If you have any legacy objects/libraries that cannot be rebuilt, either because you do not have the source code, or because the old objects must not be rebuilt (e.g. for qualification/certification reasons), then you must inspect the legacy objects to check
whether they preserve 8-byte alignment or not. Use "fromelf -c" to disassemble the object code. C/C++ code compiled with ADS 1.1 or later will normally preserve 8-byte alignment, but assembled code will not.
If your objects do indeed preserve 8-byte alignment, then the linker error L6238E can be suppressed with the use of "--diag_suppress
6238" on the linker command line. By using this, you are effectively saying "I guarantee that these objects are PRES8". The linker warning L6306W is suppressible with "--diag_suppress
6306".
If you are linking with legacy objects/libraries then you should also read the information on the option "--apcs /adsabi" in the FAQ entry "Are
legacy ADS objects/libraries compatible with RVCT 2.0 ?".
我对这个问题的解决如下:
在我的文件中加入了
PRESERVE8
e.g. change:AREA Init, CODE, READONLY
to:
PRESERVE8 AREA Init, CODE, READONLY
相关文章推荐
- ADS 转Keil, ADS升级至MDK常见错误 invalid call from '~PRES8' function to 'REQ8' 解决方法
- Error armlink L6238 Startup.o(Start) contains invalid call from '~PRES8' function to 'REQ8' functio
- RVDS2.2的invalid call from '~PRE8' 解决方法
- 错误代码: 1582 Incorrect parameter count in the call to native function 'str_to_date'
- error C2556: 'void __thiscall......overloaded function differs only by return type from 'int __thiscall
- ADS转RVDS invalid call from '~PRES8' function to 'REQ8' function
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- rapidxml 在mac下的编译error: call to function 'print_pi_node' that is neither visible in the template def
- cannot convert from 'overloaded-function' to 'AFX_THREADPROC'
- error: no matching function for call to 'std::basic_ifstream<char>::open(std::string&)
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESUL
- Xcode6环境下AQGridView编译错误:'too many arguments to function call, expected 0, have 4'
- error: no matching function for call to 'MainWindow::connect(*&, ...)
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESUL
- gcc编译错误(invalid conversion from 'int' to enum)
- invalid conversion from 'const char*' to char*
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CChatDlg::* )(WPARAM,LPARAM)' to
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESUL
- error: no matching function for call to 'std::basic_ifstream<char>::open(std::string&)
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESU