Difference between x86, x32, and x64 architectures?

Please explain the difference between x86, x32 and x64? Its a bit confusing when it comes to x86 and x32 because most of the time 32-bit programs run on x86… Answer Hans and DarkDust answer covered i386/i686 and amd64/x86_64, so there’s no sense in revisiting them. This answer will focus on X32, and provide some … Read more

What happens if you use the 32-bit int 0x80 Linux ABI in 64-bit code?

int 0x80 on Linux always invokes the 32-bit ABI, regardless of what mode it’s called from: args in ebx, ecx, … and syscall numbers from /usr/include/asm/unistd_32.h. (Or crashes on 64-bit kernels compiled without CONFIG_IA32_EMULATION). 64-bit code should use syscall, with call numbers from /usr/include/asm/unistd_64.h, and args in rdi, rsi, etc. See What are the calling … Read more

Where is the x86-64 System V ABI documented?

The x86-64 System V ABI (used on everything except Windows) used to live at http://x86-64.org/documentation/abi.pdf, but that site has now fallen off the internet. Is there a new authoritative home for the document? Answer The System V x86-64 psABI document is maintained as LaTeX sources on GitLab. Similarly the i386 psABI is a separate GitLab … Read more

How to convert Persian and Arabic digits of a string to English using JavaScript?

How can I convert Persian/Arabic numbers to English numbers with a simple function? arabicNumbers = [“١”, “٢”, “٣”, “٤”, “٥”, “٦”, “٧”, “٨”, “٩”, “٠”] persianNumbers = [“۱”, “۲”, “۳”, “۴”, “۵”, “۶”, “۷”, “۸”, “۹”, “۰”] It is the same schema, but the code pages are different. Answer Use this simple function to convert … Read more

How to support Arabic text in Android?

I am getting Arabic text from server successfully. Retrieved text I want display in code but its showing boxes instead of Arabic text. Assume that t array values are Arabic text from server. string[] t={” “}; Textview tv = (Textview) findviewByid(R.id.text); tv.setText(t[0]); Answer Android 2.1 does not have Arabic font. Android 2.2 has Arabic font … Read more

What’s the difference of section and segment in ELF file format

From wiki Executable and Linkable Format: The segments contain information that is necessary for runtime execution of the file, while sections contain important data for linking and relocation. Any byte in the entire file can be owned by at most one section, and there can be orphan bytes which are not owned by any section. … Read more

What exactly does GCC’s -Wpsabi option do? What are the implications of supressing it?

Background In the last year I was using the nlohmann json library[1] and was cross-compiling on x86_64 using GCC 5.x arm-linux-gnueabi-* with no warnings. When I updated GCC to a newer version, GCC would generate pages of cryptic diagnostic notes. For example, here is one of the notes In file included from /usr/arm-linux-gnueabi/include/c++/7/vector:69:0, from include/json.hpp:58, … Read more