abi

What are the purposes of the ARM ABI and EABI?

天大地大妈咪最大 提交于 2019-11-29 19:44:53
The more I look at this PDF the less I understand what it means. Also I'd like some comments on this others 1 and 2 . An ABI ( Application Binary Interface ) is a standard that defines a mapping between low-level concepts in high-level languages and the abilities of a specific hardware/OS platform's machine code. That includes things like: how C/C++/Fortran/... data types are laid out in memory (data sizes / alignments) how nested function calls work (where and how the information on how to return to a function's caller is stored, where in the CPU registers and/or in memory function arguments

Is it valid to write below ESP?

让人想犯罪 __ 提交于 2019-11-29 13:19:21
For a 32-bit windows application is it valid to use stack memory below ESP for temporary swap space without explicitly decrementing ESP? Consider a function that returns a floating point value in ST(0) . If our value is currently in EAX we would, for example, PUSH EAX FLD [ESP] ADD ESP,4 // or POP EAX, etc // return... Or without modifying the ESP register, we could just : MOV [ESP-4], EAX FLD [ESP-4] // return... In both cases the same thing happens except that in the first case we take care to decrement the stack pointer before using the memory, and then to increment it afterwards. In the

ARM C++ ABI: Constructor/destructor return values

谁说胖子不能爱 提交于 2019-11-29 12:23:27
问题 I've been reading through Clang source code and discovered something interesting about the ARM C++ ABI that I can't seem to understand the justification for. From the an online version of the ARM ABI documentation: This ABI requires C1 and C2 constructors to return this (instead of being void functions) so that a C3 constructor can tail call the C1 constructor and the C1 constructor can tail call C2. (and similarly for non-virtual destructors) I'm not sure what C1 , C2 , and C3 reference here

Why do we need stack allocation when we have a red zone?

限于喜欢 提交于 2019-11-29 10:37:04
I have the following doubts: As we know System V x86-64 ABI gives us about a fixed-size area (128 bytes) in the stack frame, so called redzone. So, as a result we don't need to use, for example, sub rsp, 12 . Just make mov [rsp-12], X and that's all. But I cannot grasp idea of that. Why does it matter? Is it necessary to sub rsp, 12 without redzone? After all, stack size is limited at the beginning so why sub rsp, 12 is important? I know that it makes possible us to follow the top of the stack but let's ignore it at that moment. I know what some instructions use rsp value ( like ret ) but don

How to Compile boost with GCC 5 using old ABI?

主宰稳场 提交于 2019-11-29 10:28:28
问题 I have downloaded a library that was compiled with a gcc 4.8 before the ABI change in GCC. On my laptop (latest kubuntu) I have GCC 5.2. And When I installed boost, it seems that it used the new ABI but then I get the following link errors undefined symbol.....__cxx11.... How can I install boost using old ABI with GCC5 ? 回答1: To my knowledge, there are no prebuilt Boost packages for the old ABI in the official Kubuntu repositories, so you will have to build Boost yourself. The building

C++ on x86-64: when are structs/classes passed and returned in registers?

倖福魔咒の 提交于 2019-11-29 10:08:33
Assuming the x86-64 ABI on Linux, under what conditions in C++ are structs passed to functions in registers vs. on the stack? Under what conditions are they returned in registers? And does the answer change for classes? If it helps simplify the answer, you can assume a single argument/return value and no floating point values. The ABI specification is defined here . A newer version is available here . I assume the reader is accustomed to the terminology of the document and that they can classify the primitive types. If the object size is larger than two eight-bytes, it is passed in memory:

How does adding a private member variable break C++ ABI compatibility?

时光怂恿深爱的人放手 提交于 2019-11-29 07:03:26
问题 The pimpl idiom is commonly used in order to allow changing code in dynamically linked libraries without breaking ABI compatibility and having to recompile all the code that depends on the library. Most of the explanations I see mention that adding a new private member variable changes the offsets of public and private members in the class. That makes sense to me. What I don't understand is how in practice this actually breaks the dependent libraries. I've done a lot of reading on ELF files

How to optimize function return values in C and C++ on x86-64?

一笑奈何 提交于 2019-11-29 06:11:06
The x86-64 ABI specifies two return registers: rax and rdx , both 64-bits (8 bytes) in size. Assuming that x86-64 is the only targeted platform, which of these two functions: uint64_t f(uint64_t * const secondReturnValue) { /* Calculate a and b. */ *secondReturnValue = b; return a; } std::pair<uint64_t, uint64_t> g() { /* Calculate a and b, same as in f() above. */ return { a, b }; } would yield better performance, given the current state of C/C++ compilers targeting x86-64? Are there any pitfalls performance-wise using one or the other version? Are compilers (GCC, Clang) always able to

Difference between armeabi and armeabi-v7a

此生再无相见时 提交于 2019-11-29 02:31:45
问题 As far as I can tell from the docs, the difference between the two supported flavors of ARM architecture in Android NDK is only in the set of supported CPU instructions. Is that really so? Is there no difference in calling conventions, or system call sequence, or something else? I'm wondering what will happen if I compile a module to an ARM object file (with a compiler other than NDK - Free Pascal specifically), specifying ARMv6 as the architecture, and then link it to both armeabi and

ARM to C calling convention, NEON registers to save

吃可爱长大的小学妹 提交于 2019-11-29 01:13:16
问题 There is a similar post that covers regular registers. What about NEON registers. As far as I remember either top half or bottom half of registers have to be preserved across function calls. I can't find that info anywhere, can somebody clarify that? thanks From the AAPCS, §5.1.1 Core registers: r0-r3 are the argument and scratch registers; r0-r1 are also the result registers r4-r8 are callee-save registers r9 might be a callee-save register or not (on some variants of AAPCS it is a special