Tuesday, 15 May 2012

linker - GCC: Section names containing the / character -



linker - GCC: Section names containing the / character -

the reply question:

gcc/ld: allow code placement , removal of unused functions

seems one. however, trying utilize it, see section name gets truncated slash (/) character encountered.

__file__ contains path file, , / character. linker drops next / character when creating section name, eg.:

#define sec_text __attribute__((section(".mytext.bl/ah.c"))) unsigned char sec_text poll(void)

i end section name:

[ 8] .mytext.bl progbits 00000000 000120 00003d 00 0 0 1

if utilize answer, using __line__ , __file__:

#define __s(s) #s #define _s(s) __s(s) #define section __file__ "." _s(__line__) #define sec_mytext __attribute__((section(".mytext." section))) unsigned char sec_mytext poll(void)

i this:

[ 8] .mytext. progbits 00000000 000120 00003d 00 0 0 1

but can see preprocessor output should give me section name file , line:

unsigned char __attribute__((section(".mytext." "/path/to/mycode/poll.c" "." "250"))) poll

any way of getting around issue ?

hmm, it's free mentor graphics intel (x86) compiler shows behaviour, both 4.6.3 , 4.7.2. gcc 4.8.2 ubuntu 14.04 ok handling slashes in section names. mentor arm compiler 4.6.3.

gcc linker ld sections

No comments:

Post a Comment