Memory section handling error

Posted by Basilevs on Stack Overflow See other posts from Stack Overflow or by Basilevs
Published on 2010-04-16T05:45:09Z Indexed on 2010/04/16 5:53 UTC
Read the original article Hit count: 269

Filed under:
|
|
|

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
(
 ".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.

© Stack Overflow or respective owner

Related posts about section

Related posts about assembly