How do I resolve a “section type conflict” compile error and best practices for using section attribute with gcc
问题 I am using Android NDKr8 and by extension gcc to compile some library code that is shared across multiple platforms including some embedded ones. This code uses segments to put a bunch of elements into a contiguous memory space. The compile is generating a "error: variable_name causes a section type conflict". We use a macro to declare the segment attribute: # define DB_SEGMENT __attribute__ ((__section__ ("DBSegment"))) The above variable_name is declared as follows: dbStruct const variable