This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Fwd: Compiling with -fdata-sections doesn't put the constant in the section expected
- From: ClÃment PÃron <peron dot clem at gmail dot com>
- To: Andrew Haley <aph at redhat dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 1 Oct 2014 11:48:04 +0200
- Subject: Re: Fwd: Compiling with -fdata-sections doesn't put the constant in the section expected
- Authentication-results: sourceware.org; auth=none
- References: <CAJiuCcfJHXCRAnj4v7fhoAcwWAyWLN2z_9+Seygqx05iJUQCtw at mail dot gmail dot com> <CAJiuCceKWtpiJdySnft_K_9FkxXvBKiXt9U2EYmSnWZHr26nyA at mail dot gmail dot com> <CAJiuCcd0PsOs3cw=Qfz5XJO1rY2dyAX8j-XqyZ6tYuN-OWgX1Q at mail dot gmail dot com> <542BCC98 dot 5030901 at redhat dot com>
Hi Andrew,
Thanks for your reply,
I try with
gcc -c -o hello.o -ffunction-sections -fdata-sections hello.c -Os
But same result the data are put in section depending on their length
and not on the function where they are declared (due to the
fmerge-constants optimization).
I got a .rodata.str1.1 section.
gcc -c -o hello.o -ffunction-sections -fdata-sections hello.c -Os
-fno-merge-constants
And same result as without -Os argument
After the link my string used will stay in my ELF :S
Regards,
Clement
2014-10-01 11:42 GMT+02:00 Andrew Haley <aph@redhat.com>:
> On 01/10/14 10:30, ClÃment PÃron wrote:
>> I have different .text.__function__
>>
>> But i have only one .rodata instead of different .rodata.__function__
>>
>> Thanks for your help,
>
> Now turn on the optimizer. :-)
>
> Andrew.
>