x86-64

Use ld on 64-bit platform to generate 32-bit executable

拈花ヽ惹草 提交于 2019-12-17 19:46:40
问题 I wrote an assembly that is assemble with: $as --32 -o hello.o hello.s Then I tried to generate an executable with: $ld -o hello hello.o It gives me an error: ld: i386 architecture of input file `ConditionalBranching.o' is incompatible with i386:x86-64 output I tried using flag -m32 or --32, but ld dont take them. I cannot find a solution by reading the man page of ld. How can I generate a 32-bit binary from my 32-bit shared object? 回答1: Your linker is attempting to create a 64-bit binary,

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

独自空忆成欢 提交于 2019-12-17 18:52:05
问题 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

Debian Squeeze AMD64安装Oracle 10g x86_64 10.2.0....

試著忘記壹切 提交于 2019-12-17 17:59:47
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 服务器操作系统为Debian Squeeze AMD64,没有安装X,通过ssh远程访问。客户端为debian testing,安装有gnome桌面环境。 先安装10.2.0.1,然后安装升级包10.2.0.4,比安装10g r2客户端多了一些操作,具体安装过程如下: 一、安装10.2.0.1 1、下载oracle 10g r2 下载回来的文件为10201_database_linux_x86_64.cpio.gz $gunzip 10201_database_linux_x86_64.cpio.gz $cpio -idmv < 10201_database_linux_x86_64.cpio 解压缩后所有的安装文件位于database目录下。 2、检查硬件是否达到要求 物理RAM必须大于512M,现在的机器内存都没问题。超过8GB RAM时,swap应该在物理RAM的0.75倍以上。Enterprise Edition安装类型大约使用2G硬盘空间。 通过以下命令检查,如果不满足需要做相应的调整 $grep MemTotal /proc/meminfo //检查物理内存大小 $grep SwapTotal /proc/meminfo //检查swap大小 $df -h //检查可用硬件空间大小 3

RedHat EL5 x86-64上命令行安装Oracle 10g笔记

大兔子大兔子 提交于 2019-12-17 17:53:47
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> RedHat EL5 x86-64 上命令行安装 Oracle 10g 笔记 声明:本文中所描述的系 统 命令,未 经 特殊 标 示,均 为 “#” 代表 root 权 限, “$” 代表 oracle 权 限。 安装前的准备 准备工作要用登录为 root 用户来进行。 选择安装环境的语言 Oracle 安装时可以通过环境变量 LANG 指定安装语言,如果 Linux 命令行不能显示中文,就要将语言环境设置为英语。 例如 : export LANG=en_US.UTF-8 修改 gennttab Oracle 10g 在一些 Linux 系统下安装可能会被中断,在安装日志文件 $ORACLE_HOME/install/make.log 里可以看见以下错误信息: /bin/sed: -e expression #1, char 7: unterminated `s' command 要解决这个问题就必须编辑文件 gennttab 。 先解压 Oracle 安装目录下的 stage/Components/oracle.network.rsf/10.2.0.1.0/1/DataFiles/filegroup6.jar ,可以用以下方法之一进行解压 用 jar 解压: $jar -xf filegroup6.jar

external assembly file in visual studio

守給你的承諾、 提交于 2019-12-17 17:38:45
问题 I searched and found I can not use __asm in x64 in visual studio. Instead I have to use an external assembly file. How can I add external assembly file to my win32 console project? How can compile them? Can you explain step by step. 回答1: How to build a mixed-source x64-project with a x64 assembly file in Visual Studio : 1) Start Visual Studio (Community) 2015 and choose FILE - New - Project . 2) In the next window choose Win 32 Console Application . 3) You get a confirmation. Click on Next >

Memory alignment : how to use alignof / alignas?

荒凉一梦 提交于 2019-12-17 17:25:55
问题 I work with shared memory right now. I can't understand alignof and alignas . cppreference is unclear : alignof returns "alignment" but what is "alignment" ? number of bytes to add for the next block to be aligned ? padded size ? Stack overflow / blogs entries are unclear too. Can someone explain clearly alignof and alignas ? 回答1: Alignment is a restriction on which memory positions a value's first byte can be stored. (It is needed to improve performance on processors and to permit use of

Why does this MOVSS instruction use RIP-relative addressing? [duplicate]

岁酱吖の 提交于 2019-12-17 17:07:40
问题 This question already has an answer here : Why is the address of static variables relative to the Instruction Pointer? (1 answer) Closed last year . I found the following assembly code in disassembler (floating point logic c++). 842: movss 0x21a(%rip),%xmm0 I understand that when process rip will allways be 842 and this 0x21a(%rip) will be const. It seems a little odd to use this register. I want to know is there any advantage of using rip relative address, instead other addressing. 回答1: RIP

Why is there no “sub rsp” instruction in this function prologue and why are function parameters stored at negative rbp offsets?

狂风中的少年 提交于 2019-12-17 17:04:17
问题 That's what I understood by reading some memory segmentation documents: when a function is called, there are a few instructions (called function prologue) that save the frame pointer on the stack, copy the value of the stack pointer into the base pointer and save some memory for local variables. Here's a trivial code I am trying to debug using GDB: void test_function(int a, int b, int c, int d) { int flag; char buffer[10]; flag = 31337; buffer[0] = 'A'; } int main() { test_function(1, 2, 3, 4

std::pow produce different result in 32 bit and 64 bit application

橙三吉。 提交于 2019-12-17 17:02:59
问题 I have found the mismatch in the result of some complex calculations. When i thoroughly observed the intermediate results, its the std::pow function which creates that mismatch. Below are the inputs/output. long double dvalue = 2.7182818284589998; long double dexp = -0.21074699576017999; long double result = std::powl( dvalue, dexp); 64bit -> result = 0.80997896907296496 and 32bit -> result = 0.80997896907296507 I am using VS2008. I have tried with other variation of pow function which takes

Why does this code crash with address randomization on?

岁酱吖の 提交于 2019-12-17 16:57:19
问题 I am learning amd64 assembler, and trying to implement a simple Unix filter. For an unknown reason, even simplified to the bare minimum version (code below), it crashes at random. I tried to debug this program in GNU Debugger (gdb). In the default configuration of gdb, the program runs fine, but if I enable address randomization ( set disable-randomization off ), the program starts crashing (SIGSEGV). The problematic instruction is marked in the listing: format ELF64 executable sys_read = 0