This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: section type conflict in gcc xtensa
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "Hari Narasimhan H.N" <hari dot narasimhanhn at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 22 Feb 2016 10:41:57 +0100
- Subject: Re: section type conflict in gcc xtensa
- Authentication-results: sourceware.org; auth=none
- References: <CAKuw2ErpXhMgkzFmtP8sB6Ojx5qZfRF0V0RmH-C6ysZOq1N+Ug at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Feb 22, 2016 at 02:57:43PM +0530, Hari Narasimhan H.N wrote:
> Dear Sir,
>
> We are getting the following error "section type conflict" with xtensa
> gcc when a const and non const global variable is placed in the same
> section?
>
> I am using a bare metal cross gcc toolchain for Xtensa architecture
> built as per instructions in
> http://wiki.linux-xtensa.org/index.php/Crosstool-NG. We are using a
> custom Xtensa processor in our firmware.
>
> For example consider the code below
>
> __attribute__((section(".dram0.data"))) int x;
> __attribute__((section(".dram0.data"))) const int y = 10;
This is user error. You really shouldn't mix const and non-const variables
in the same section, the non-const vars want a writable section, while the
const ones (unless they need dynamic relocations) want read-only section.
Put them into separate sections, and perhaps through a linker script combine
them together if you for whatever strange reason need that.
Jakub