开发者

Memory section handling error

I'm getting a link time error:

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.

The code causing the error (assembly in C source):

# 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
(开发者_如何学Python
 ".section .ctors" __SECTION_FLAGS "\n"
 ".globl __ctors_begin__\n"
 "__ctors_begin__:\n"
 ".previous\n"
);

Is there any way to fix this? The idea is to put a varaible __ctors_begin__ at the beginning of a certain memory section. This code is a legacy that worked fine using a different build system and older compiler.

Meaning of this assembly code explained in an answer to my previous question.


very long shot but is the section .ctors is defined like you want in the linker script? ld iirc has a verbose option to show the linker script.


A long shot: Perhaps your linker is expecting ELF format (instead of COFF), and for some reason __ELF__ is not defined? Have you checked the preprocessor output for this particular build?


I would dobule check the value of __SECTION_FLAGS just to be sure that it indeed contains ax or aw. I'd also be sure that __COFF__ is not defined and that __ELF__ is. Failing that, it might be time to grab (is possible) a previous or future version of the compiler/linker and see if that fixes your problem. Perhaps you could compile your code as C++ and somehow let the compiler/linker/link scritps do what they are supposed to do? Dunno completely, but this is where I would start.


Sections work fine. So I'll ignore this warning.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜