编译linux 0.0.1 =>错误:'asm'操作数有不可能的约束__asm __(“cld \ n”

时间:2017-05-10 17:18:03

标签: c linux compilation

我正在尝试从我的64位intel机器上的源代码编译linux内核0.0.1。 只有填写启动和主要我必须修改所有的makefile以获得32位编译。

所以,这是make的输出:

library(tidyr)
# Sub out the parentheses
df$Location.1 <- gsub("[()]", "", df$Location.1)

separate(df, col = Location.1, into = c("lat","long"), sep = ",")
#  CC.Number       Date Time Accident.Type       lat        long
#1 12T008826 07/01/2012 1630            PD  39.26699  -76.560642
#2 12L005385 07/02/2012 1229            PD 39.000549  -76.399312
#3 12L005388 07/02/2012 1229            PD  39.00058  -76.399267
#4 12T008851 07/02/2012  445            PI  39.26367   -76.56648
#5 12T008858 07/02/2012  802            PD 39.240862  -76.599017
#6 12T008860 07/02/2012  832            PD  39.27022   -76.63926

string.h的代码部分如下:

In file included from traps.c:7:0:
../include/string.h:128:22: warning: conflicting types for built-in function ‘strchr’
 extern inline char * strchr(const char * s,char c)
                      ^
../include/string.h:145:22: warning: conflicting types for built-in function ‘strrchr’
 extern inline char * strrchr(const char * s,char c)
                      ^
../include/string.h:379:22: warning: conflicting types for built-in function ‘memchr’
 extern inline void * memchr(const void * cs,char c,int count)
                      ^
../include/string.h:395:22: warning: conflicting types for built-in function ‘memset’
 extern inline void * memset(void * s,char c,int count)
                      ^
In file included from traps.c:11:0:
../include/linux/kernel.h:5:1: warning: function return types not compatible due to ‘volatile’
 volatile void panic(const char * str);
 ^
../include/linux/kernel.h:5:1: warning: function return types not compatible due to ‘volatile’
../include/linux/kernel.h:5:1: warning: function return types not compatible due to ‘volatile’
In file included from traps.c:7:0:
../include/string.h: In function ‘strcpy’:
../include/string.h:29:1: error: ‘asm’ operand has impossible constraints
 __asm__("cld\n"
 ^
Makefile:24: set di istruzioni per l'obiettivo "traps.o" non riuscito

我不知道为什么原始代码无法编译。 到目前为止我成功编译了:boot和init subdir。

非常感谢

1 个答案:

答案 0 :(得分:0)

我认为问题在于寄存器clobber列表与输入重叠。

也就是说,"S"代表注册esi,而"D"代表注册edi;但是,clobber列表包含"si""di",它们是这些寄存器的低16位片段。也许旧的GCC版本忽略了这一点,但较新的版本不允许重叠。

来自docs here

  

Clobber描述可能与输入或输出操作数无任何重叠。

解决方案,只需从列表中删除它们:

...
::"S" (src),"D" (dest) :"ax", "cc");

BTW,我还将clobber添加到"cc",因为该程序集修改了e标志。