我得到一个链接时错误:内存部分处理错误
WARNING: /home/gulevich/development/camac-fedorov/camac/linux/k0607-lsi6/camac-k0607-lsi6.o (.ctors): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.
(在C源组件)导致错误代码:
# if defined(__ELF__)
# define __SECTION_FLAGS ", \"aw\" , @progbits"
/* writable flag needed for ld ".[cd]tors" sections bug workaround) */
# elif defined(__COFF__)
# define __SECTION_FLAGS ", \"dr\""
/* untested, may be writable flag needed */
# endif
asm
(
".section .ctors" __SECTION_FLAGS "\n"
".globl __ctors_begin__\n"
"__ctors_begin__:\n"
".previous\n"
);
有什么办法解决这一问题?这个想法是在某个存储器部分的开始处放置一个可变的__ctors_begin__
。这段代码是一个可以使用不同的编译系统和较老的编译器的遗产。
此装配代码的含义解释于an answer to my previous question。
您使用的是哪种C编译器? – bdonlan 2010-04-18 06:11:33
作为补充说明,您发布的确切代码在64位ubuntu上在GCC 4.4.1中编译得很好 – bdonlan 2010-04-18 06:13:06
这是链接时间错误,而不是编译时间错误。 以下是版本信息: 链接器:GNU ld(适用于Debian的GNU Binutils)2.20.1-system.20100303; 编译器:gcc(Debian 4.4.2-9)4.4.3 20100108(预发布)。 – Basilevs 2010-04-18 08:15:40