Questions tagged [abi]
The (Application Binary Interface) specifies the low level interface between the programs, libraries and the operating system. E.g. which registers are used to pass function parameters.
910
questions
0
votes
0
answers
73
views
Duplicate symbol in Clang (but not GCC) when overriding __cxa_throw
I'm trying to get a bit more information in __cxa_throw. Regardless of the wisdom of this, the following code works perfectly with gcc and from the limited information I can find about this, it should ...
1
vote
0
answers
30
views
Does the internal keyword play role in compilation avoidance in Kotlin
There is a new approach to incremental compilation in Kotlin, which improved compilation avoidance for ABI-compatible changes.
https://blog.jetbrains.com/kotlin/2022/07/a-new-approach-to-incremental-...
1
vote
0
answers
19
views
How to load abi inline in a generic way with abigen?
I want to create a util function to instantiate a contract with an ABI in a generic way rather than copy pasting code around. And I cannot find a way for the compiler to accept it.
fn ...
1
vote
0
answers
22
views
g++11 for unordered_map is not compatible with versions earlier than gcc-11
Introduction
I recently upgraded the gcc version of a project from 7.5 to 11.4. After the upgrade, I found some exceptions at runtime.
After tracing, it was found that an exception occurred when ...
0
votes
1
answer
73
views
Differences between System V ABI and C++ Itanium ABI
Can anyone help me clarify the differences between System V ABI and C++ Itanium ABI?
As far as I understand, System V ABI sets up conventions how to make syscalls and interact with hardware, and C++ ...
0
votes
0
answers
50
views
Ethereum Solidity ABI Decoder Error: "value exceeds width (20 bits)"
ethers.js v4 have deocding method for transaction encode it works though but for the upgraded versions v5 & v6 it didn't work & i couldn't find a clear solution about decoding this transaction ...
0
votes
1
answer
44
views
node.js native module SSL
on node documentation it is written (link) this:
Native Node.js modules are supported by Electron, but since Electron has a different application binary interface (ABI) from a given Node.js binary (...
0
votes
2
answers
76
views
How to pack a Rust enum into its minimal size?
I have a Rust enum with some data. I want to pack it into as few bytes as possible. I tried using repr like this:
#[repr(u8)]
enum MyEnum {
OptionA(u32),
OptionB(u32),
Nothing,
}
fn main()...
1
vote
1
answer
223
views
C++ header files changes program break
I can't understand why this code prints different program breaks
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#...
1
vote
0
answers
47
views
What are the abi rules for return struct in the rust language [duplicate]
I want to Understand the rules of rust when processing struct return values in x86_64. By observing the following examples, I still cannot find the Abi rule of rust.
example1:
// 12Bytes
pub struct ...
1
vote
1
answer
136
views
What ABI does Rust use for passing structs
On x86_64 system, when the return value is less than or equal to 16 bytes, it is passed through the register RAX and RDX, and when the return value is greater than 16 bytes, it is passed through the ...
0
votes
0
answers
76
views
Linking issues with C++ ABI changes introduced in C++11
I have a static library and its corresponding headers. It was built in our build-system and one of the functions it provides has a signature like this
// said_header.h
#ifndef ...
#define ...
...
3
votes
1
answer
86
views
What information is necessary to successfully integrate a pre-compiled static library into an executable?
Assume that I have C++ static library that I would like to distribute in compiled form, i.e. I ship headers and a *.a-file.
What information do I need to provide to the other party to be able to ...
0
votes
0
answers
66
views
how call a function and arguments with inline asm (win32)
I'm trying to call a function that takes an int and returns an int, but when I push the argument to the stack the program crashes:
#include <stdio.h>
#include <windows.h>
...
3
votes
1
answer
181
views
Crash running app build on macOS 13.6 (clang 15), when running on macOS 11 (dynamic_cast)
Have an issue that started when I upgraded xcode to 15 on a build server.
Apps that are linking against binaries build "some time ago" (tm) - now crash when run on macOS11 or earlier. The ...
3
votes
1
answer
429
views
How can I generate the ABI of my smart contract locally with foundry/forge?
I have a project with multiple smart contracts locally and I want to generate the ABI of my sc.sol smart contract. I do wish to perform this locally using forge or foundry.
I know it is possible to do ...
0
votes
1
answer
64
views
Which C specifiers may cause ABI incompatibility between the caller and callee?
Suppose there is a file with a declaration of a function which differs from the actual definition in another file i.e.
FileA.c
short foo();
int main(){
foo();
}
FileB.c
int foo(){
//Some code
}...
1
vote
0
answers
96
views
Why does GCC (and Clang) not omit the frame pointer in AArch64?
In this Compiler Explorer example you can see that for this piece of C code:
void unknown_function(void);
int non_leaf_function(int x)
{
unknown_function();
return x + 1;
}
int leaf_function(...
0
votes
0
answers
42
views
'QtCore' was built against ABI v12 but this module is being built against ABI v13
I'm trying to create Python bindings for a C++ Library project (labelex) that uses Qt on Windows 10. I created a C++ qmake project and build my library without problems (MSVC2019 64bit). But when I ...
22
votes
2
answers
2k
views
Why is changing a property from "init" to "set" a binary breaking change?
I am coming back to C# after a long time and was trying to catch up using the book C# 10 in a Nutshell.
The author there mentions that changing a property's accessor from init to set or vice versa is ...
0
votes
1
answer
42
views
What's the oldest SDK i can target on Android?
I currently have this in my build.gradle:
android {
defaultConfig {
minSdkVersion 19
targetSdkVersion 21
which translates into <uses-sdk android:minSdkVersion="19" ...
1
vote
1
answer
65
views
how to trigger capslock from code in gnuforth on linux host
how to trigger caps lock from code in gnu-forth ?
currently as a temporary solution I use
: caps s" xdotool key Caps_Lock" system ;
I'm looking for either a full gforth code solution ...
3
votes
0
answers
73
views
Customised ABI in Linux Kernel 2.6.11 boot code [duplicate]
Recently I have tried to read the code of Linux Kernel 2.6.11. In the path arch/x86/boot/ I found some codes about jumping to protected mode. I did not understand what ABI did they use and where did ...
0
votes
0
answers
70
views
Order of arguments important for call optimization?
I was researching an implementation of std::function analog from EASTL and came across this comment: github.com/EASTL/function_detail.h#L348. As I understand it, the main idea of this "implicit&...
3
votes
1
answer
122
views
Does the red zone still exist even if we use the -mno-red-zone flag in gcc?
My system: Ubuntu 22.04.3 running on x86_64. GCC version 11.4.0
I've read that the System V ABI mandates the red zone. From the GCC manual:
The red zone is mandated by the x86-64 ABI, it is a 128-...
1
vote
1
answer
71
views
Does the System V ABI on Ubuntu place the return address within the caller function's frame or the callee function's frame?
My system : Ubuntu 22.04.3 running on x86_64. GCC version 11.4.0
I'm asking this because it seems like there are two different representations of the return address as far as the frame it is within ( ...
2
votes
1
answer
88
views
Why is it that the rsp register is not decremented in a leaf function as it is at the beginning of any other functions? [duplicate]
Here's some information about my system:
Ubuntu 22.04.3 running on Intel x86_64;
ggc version 11.4.0;
I've noticed that the rsp register is not decremented in leaf functions as it is in non leaf ...
0
votes
2
answers
43
views
Changing the callback function name causes ABI break in C?
I want to check this issue.
Here is a callback definition in a library for application (e.g. Platfrom version 1.0)
typedef void (*module_change_callback)(int state);
Later,
I want to change the name ...
4
votes
1
answer
94
views
Why is it possible to link against C++ Dynamic Libraries when C++ does not have a stable ABI?
Taking Boost as an example, why am I able to link against boost::filesystem from my C++ program, when C++ does not have a stable ABI.
I have Boost installed in my system, and a toy program is able to ...
0
votes
0
answers
40
views
How to know the details of arm-linux-gnueabihf-gcc's implementation of aapcs
I've read the parts "6 The Base Procedure Call Standard" and "7 The Standard Variants" of Procedure Call Standard for the Arm® Architecture aapcs32 - Github
The Base Procedure ...
2
votes
0
answers
28
views
x64 assembly code: Can I expect a value not allocated in the stack to remain without alteration? [duplicate]
Suppose that I have these two consecutive x64 instructions (running under Windows platform):
ADD RSP, 8
MOV RAX, QWORD PTR [RSP - 8]
As you see it's the equivalent to POP RAX. The location of [RSP - ...
1
vote
0
answers
55
views
Returning std::unique_ptr<> in a register. Can it be done? [duplicate]
In the ARM procedure call standard for the 32-bit architecture, it is possible to return a struct with a single data member in a register, rather than on the stack.
The size of a C++ unique_ptr is ...
1
vote
1
answer
41
views
In Go, how do you handle multiple ABI's from Abigen?
The Abigen tutorials I've seen all show setting pkg=main, and this way you don't have to explicitly import packages from other go files. But that means when you execute "go run" you have to ...
1
vote
1
answer
39
views
Passing unions of POD types between binary modules
I'm implementing a shared library, and its logic implies using variant like types.
Of course I'm pretty aware that std::variant/boost::variant would be a better choice but, obviously, it's not an ...
0
votes
0
answers
48
views
How do I correctly implement Tokenize for, for example, a slot0 query to the UniswapV3 Pool contract?
I am trying to retrieve the slot0 data from a UniswapV3 liquidity pool. This is pretty straightforward on Golang, but giving me major problems in Rust. Like Swapping tokens is problematic for me in ...
0
votes
0
answers
184
views
CPP function in IDA PRO
Trying to solve a crackme written in C++ for Windows on x86-64. https://www.crackmes.one/crackme/649a2ced33c5d43938913c6c
There are function calls that look like this in the IDA:
call ...
0
votes
0
answers
54
views
matlab c++ engine API: segmentation fault
I built an c++ API engine using a minimal example as shown here
https://de.mathworks.com/help/matlab/matlab_external/test-your-build-environment.html
which works fine.
My real exexutable is however ...
0
votes
2
answers
37
views
How to find which symbols are available/removed in which version of the glic and link to them specifically?
I have an executable compiled on a latest operating system. The executable is just a few lines of math code.
Problem is, it's crashing when it's running on a different system.
ImportError: /lib64/libm....
0
votes
0
answers
44
views
Setup function with no stack frame in C++Builder?
I have a small __msfastcall function with nothing but inline __asm { } code. How do I tell c++builder to not generated a stack frame for the function when generating it for both x86 and x64 ...
0
votes
1
answer
124
views
Cannot copy encoded ABI Remix to verify
i deployed a smart contract that had 7 constructor arguments, but i left 2 empty on purpose. Only now i cannot copy the encoded ABI because i left 2 fields empty on Remix IDE. I tried getting the ...
5
votes
1
answer
109
views
Calculation of relative offset in small code model
I am trying to understand the RIP relative offset used in small-code model. Perhaps the only approachable resource on the internet on this topic is: https://eli.thegreenplace.net/2012/01/03/...
1
vote
0
answers
117
views
Are there platforms where sizeof(int) >= 128 bits
C standard says that int must be at least 16 bit, but doesn't say the upper bound (only ... <= sizeof(short) <= sizeof(int) <= sizeof(long) <= ....
Also, according to popular (that were/...
0
votes
0
answers
287
views
C++ as a FFI language
I know of many people who initially wrote their programs in C++ instead of C, then decided to package the program's functionality as a library so rewrote it as a library in C so that it may be called ...
0
votes
0
answers
186
views
ether js decoding error while fetching struct array data
I'm trying to create messenger dapp. Everything is fine until I tried to invoke messages of metamask logged in user.
Here is the messenger.sol file
// SPDX-License-Identifier: MIT
pragma solidity >=...
4
votes
3
answers
320
views
Why does the x86-64 Linux ABI pass structs by value smaller than 16 bytes in registers, instead of 8?
At the C level, the recommendation is typically to pass anything bigger than word size (8 bytes on x86-64) by pointer, and anything smaller by value (implying by register). The argument is supposed to ...
1
vote
0
answers
29
views
Encoding Struct directly gives different output than encoding variables of struct in spread out manner
The output of both of these functions are different why?
How to make them equal. I am trying to use this in EIP712 signature checking. But the returned address doesn't match. It seems like encoding ...
5
votes
1
answer
152
views
Why does the act of introducing a destructor result in worse codegen? (Passed by reference instead of by value in a register)
Take this simple example:
struct has_destruct_t {
int a;
~has_destruct_t() {}
};
struct no_destruct_t {
int a;
};
int bar_no_destruct(no_destruct_t);
int foo_no_destruct(void) {
...
0
votes
1
answer
77
views
Why does Clang produce multiple loads in the ARM ip register upon entering a procedure?
I was plying with some C code to inspect how my compiler (main-git Clang, in this case) handles function parameters wrt to the stack in ARM ABI. I discovered that this function:
int test(int a, int b, ...
0
votes
1
answer
177
views
Field ... for tuple not found in the given struct Golang Abi Package
I want to send tuple as parameters to contract by using Abi Package
type SingleSwap struct {
poolId []byte
kind *big.Int
assetIn common.Address
assetOut common.Address
...
0
votes
0
answers
132
views
Are System V ABI and Itanium C++ ABI related?
I have basic understanding of what ABIs are While reading I found these statements
System V ABI is used by most Unix-like systems in use today
and
The GNU C++ compiler uses an industry-standard C++ ...