abi

What does it mean that “registers are preserved across function calls”?

自闭症网瘾萝莉.ら 提交于 2021-02-05 09:03:38
问题 From this question, What registers are preserved through a linux x86-64 function call, it says that the following registers are saved across function calls: r12, r13, r14, r15, rbx, rsp, rbp So, I went ahead and did a test with the following: .globl _start _start: mov $5, %r12 mov $5, %r13 mov $5, %r14 mov $5, %r15 call get_array_size mov $60, %eax syscall get_array_size: mov $0, %r12 mov $0, %r13 mov $0, %r14 mov $0, %r15 ret And, I was thinking that after the call get_array_size that my

Understanding stack alignment enforcement

北城余情 提交于 2021-02-04 13:57:34
问题 Consider the following C code: #include <stdint.h> void func(void) { uint32_t var = 0; return; } The unoptimized (i.e.: -O0 option) assembly code generated by GCC 4.7.2 for the code above is: func: pushl %ebp movl %esp, %ebp subl $16, %esp movl $0, -4(%ebp) nop leave ret According to the stack alignment requirements of the System V ABI , the stack must be aligned by 16 bytes before every call instruction (the stack boundary is 16 bytes by default when not changed with the option -mpreferred

Undocumented ABI changes of std::function between GCC-4 and GCC-5/6/7/8/9, how to make a .so working with devtoolset-4/6/7/8/9?

社会主义新天地 提交于 2021-01-29 19:51:08
问题 with _GLIBCXX_USE_CXX11_ABI=0 std::function of GCC-4 is different of GCC-5 and follwing versions. The following code show you the fact: ==> lib.cc <== #include <functional> std::function<int(const void*p)> holder; int run_holder(const void *p) { return holder(p); } ==> main.cc <== #include <stdio.h> #include <functional> extern int run_holder(const void*p); extern std::function<int(const void*p)> holder; int foo(const void* p) { printf("p=%p\n", p); return 0; } int main() { holder = foo; foo(

C++ + gcc: tail padding reuse and PODs

元气小坏坏 提交于 2021-01-27 17:44:34
问题 Related question: Standard-layout and tail padding Snippet: #include <iostream> #include <type_traits> struct A0 { int a; char c; }; struct B0 : A0 { char d; }; struct A1 { int a; private: char c; }; struct B1 : A1 { char d; }; struct A2 { private: int a; char c; }; struct B2 : A2 { char d; }; int main() { std::cout << std::is_pod<A0>::value << ' ' << sizeof(B0) << std::endl; // 1 12 std::cout << std::is_pod<A1>::value << ' ' << sizeof(B1) << std::endl; // 0 8 std::cout << std::is_pod<A2>:

Uncaught Error: Returned values aren't valid, did it run Out of Gas?

家住魔仙堡 提交于 2021-01-27 05:54:49
问题 I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error: Uncaught Error: Returned values aren't valid, did it run Out of Gas? at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:227) at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeLog (index.js:277) Web3 version: 1.0.0-beta36 Metamask version: 4.16.0 How to fix it? 回答1: Try the

Uncaught Error: Returned values aren't valid, did it run Out of Gas?

让人想犯罪 __ 提交于 2021-01-27 05:54:10
问题 I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error: Uncaught Error: Returned values aren't valid, did it run Out of Gas? at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:227) at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeLog (index.js:277) Web3 version: 1.0.0-beta36 Metamask version: 4.16.0 How to fix it? 回答1: Try the

Android Studio : Missing Strip Tool

左心房为你撑大大i 提交于 2020-12-27 08:27:18
问题 I am constantly getting this warning while building my android studio code using terminal command gradle clean assembleRelease : Unable to strip library 'lib.so' due to missing strip tool for ABI 'ARMEABI'. Packaging it as is. Please help me on how to get this warning resolved. Note: I know this won't affect the behaviour of my app, but my APK is too bulky and this will surely help me reduce APK size. So I need this resolved. 回答1: The default installed NDK doesn't seem to have the tools

Why does eax contain the number of vector parameters?

时光怂恿深爱的人放手 提交于 2020-12-23 11:15:52
问题 Why does al contain the number of vector parameters in assembly? Why are vector parameters any different from normal parameters for the callee? 回答1: The value is used for optimization as stated in the ABI document The prologue should use %al to avoid unnecessarily saving XMM registers. This is especially important for integer only programs to prevent the initialization of the XMM unit. 3.5.7 Variable Argument Lists - The Register Save Area. System V Application Binary Interface version 1.0

Why does eax contain the number of vector parameters?

假装没事ソ 提交于 2020-12-23 11:14:26
问题 Why does al contain the number of vector parameters in assembly? Why are vector parameters any different from normal parameters for the callee? 回答1: The value is used for optimization as stated in the ABI document The prologue should use %al to avoid unnecessarily saving XMM registers. This is especially important for integer only programs to prevent the initialization of the XMM unit. 3.5.7 Variable Argument Lists - The Register Save Area. System V Application Binary Interface version 1.0

Why does eax contain the number of vector parameters?

余生长醉 提交于 2020-12-23 11:13:42
问题 Why does al contain the number of vector parameters in assembly? Why are vector parameters any different from normal parameters for the callee? 回答1: The value is used for optimization as stated in the ABI document The prologue should use %al to avoid unnecessarily saving XMM registers. This is especially important for integer only programs to prevent the initialization of the XMM unit. 3.5.7 Variable Argument Lists - The Register Save Area. System V Application Binary Interface version 1.0