x86-64

Make Error: Undefined symbols for architecture x86_64

試著忘記壹切 提交于 2019-11-28 09:31:56
问题 I'm a pretty novice programmer (as in I only code when I need to), but I mostly work in television. I've been trying to compile a tool I downloaded (bmdtools) for compilation on OSX because we (for whatever reason) are not allowed to use Linux machines. So, after installing all the libraries and linking what I need to, I ran "make" and got the error message: ld: symbol(s) not found for architecture x86_64 I had then read that adding -stdlib=libc++ would fix whatever issue was being reflected.

Does printf require additional stack space on the x86-64? [duplicate]

寵の児 提交于 2019-11-28 09:22:17
问题 This question already has an answer here: Printing floating point numbers from x86-64 seems to require %rbp to be saved 1 answer While I know it is best to use compiler intrinsics, and for that matter, printf_chk , and also to put data in .rodata sections, I'm looking at gaining a deeper understanding of assembly language and am interested in compact code. There is something about printf I don't understand. I know where to put the parameters, and I know how to use %al for varargs, but it

x86_64 : is stack frame pointer almost useless?

£可爱£侵袭症+ 提交于 2019-11-28 09:11:04
Linux x86_64. gcc 5.x I was studying the output of two codes, with -fomit-frame-pointer and without (gcc at "-O3" enables that option by default). pushq %rbp movq %rsp, %rbp ... popq %rbp My question is : If I globally disable that option, even for, at the extreme, compiling an operating system, is there a catch ? I know that interrupts use that information, so is that option good only for user space ? The compilers always generate self consistent code, so disabling the frame pointer is fine as long as you don't use external/hand crafted code that makes some assumption about it (e.g. by

Why does MSVC emit a useless MOVSX before performing this Bit Test?

北城以北 提交于 2019-11-28 09:08:56
Compiling the following code in MSVC 2013, 64-bit release build, /O2 optimization: while (*s == ' ' || *s == ',' || *s == '\r' || *s == '\n') { ++s; } I get the following code - which has a really cool optimization using a 64-bit register as a lookup table with the bt (bit test) instruction. mov rcx, 17596481020928 ; 0000100100002400H npad 5 $LL82@myFunc: movzx eax, BYTE PTR [rsi] cmp al, 44 ; 0000002cH ja SHORT $LN81@myFunc movsx rax, al bt rcx, rax jae SHORT $LN81@myFunc inc rsi jmp SHORT $LL82@myFunc $LN81@myFunc: ; code after loop... But my question is: what is the purpose of the movsx rax

Why do I have to play with “rsp” to call a c++ function?

人走茶凉 提交于 2019-11-28 09:06:18
问题 I just started my assembly journey like recently, so obviously I'm a newbie, I've been writing fairly simple and basic programs and I just noticed something weird (to me). a program giving the count of numbers in a table ending with 111 in binary entry point: #include <iostream> #include <cstdlib> extern "C" auto _start(void *, void *)->void; auto print_msg(char *msg) { std::cout << msg; } auto print_int(uint64_t val) { std::cout << val; } auto main()->int { _start(print_int, print_msg); std:

Long multi-byte NOPs: commonly understood macros or other notation

吃可爱长大的小学妹 提交于 2019-11-28 09:03:11
It's not a big secret that x86 (and x86_64) processors have not only the single-byte NOP instruction, but also various types of multi-byte NOP-like instructions. There's the ones I've managed to find: Recommended by AMD, ref. AMD Software Optimization Guide for AMD Family 15h Processors, document #47414 , section 5.8 "Code Padding with Operand-Size Override and Multibyte NOP", page 94) 90 NOP1_OVERRIDE_NOP 6690 NOP2_OVERRIDE_NOP 0f1f00 NOP3_OVERRIDE_NOP 0f1f4000 NOP4_OVERRIDE_NOP 0f1f440000 NOP5_OVERRIDE_NOP 660f1f440000 NOP6_OVERRIDE_NOP 0f1f8000000000 NOP7_OVERRIDE_NOP 0f1f840000000000 NOP8

How to load address of function or label into register in GNU Assembler

别说谁变了你拦得住时间么 提交于 2019-11-28 08:58:24
问题 I am trying to load the address of 'main' into a register (R10) in the GNU Assembler. I am unable to. Here I what I have and the error message I receive. main: lea main, %r10 I also tried the following syntax (this time using mov) main: movq $main, %r10 With both of the above I get the following error: /usr/bin/ld: /tmp/ccxZ8pWr.o: relocation R_X86_64_32S against symbol `main' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable

More efficient way to output an integer in pure assembly

感情迁移 提交于 2019-11-28 08:54:29
问题 I'm looking to output an integer using pure assembly. I'm using nasm on a 64-bit linux machine. At the moment I'm looking for a way to output integers to debug a compiler, but I want to use the same code for writing an OS, which is also the reason I don't simply use printf() . After much searching and frustration I have come up with this code SECTION .data var: db " ",10,0 SECTION .text global main global _printc global _printi main: mov rax, 90 push rax call _printi xor rbx, rbx mov rax, 1

32 bit ActiveX Control in a 64 bit .NET App

感情迁移 提交于 2019-11-28 08:50:14
问题 I'm creating a C#.Net application which I want to be able to compile for "All CPUs". I also want to include a specific ActiveX control in the UI of this app, but the ActiveX control I'm trying to use does not support 32 bit. Is there some trick or work around I can use to use get this control to work? What about embedding the ActiveX control in a Web-browser control? Would this even work? 回答1: You have to run the ActiveX control in a separate 32-bit process. That's going to be difficult, it

x64 nasm: pushing memory addresses onto the stack & call function

淺唱寂寞╮ 提交于 2019-11-28 08:47:42
I'm pretty new to x64-assembly on the Mac, so I'm getting confused porting some 32-bit code in 64-bit. The program should simply print out a message via the printf function from the C standart library. I've started with this code: section .data msg db 'This is a test', 10, 0 ; something stupid here section .text global _main extern _printf _main: push rbp mov rbp, rsp push msg call _printf mov rsp, rbp pop rbp ret Compiling it with nasm this way: $ nasm -f macho64 main.s Returned following error: main.s:12: error: Mach-O 64-bit format does not support 32-bit absolute addresses I've tried to