This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCHv2] Handle not explicitly zero terminated strings in merge sections
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Olivier Hainque <hainque at adacore dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Richard Biener <rguenther at suse dot de>, Eric Botcazou <ebotcazou at adacore dot com>, Arnaud Charlet <charlet at adacore dot com>, Jeff Law <law at redhat dot com>
- Date: Fri, 21 Sep 2018 11:36:53 +0000
- Subject: Re: [PATCHv2] Handle not explicitly zero terminated strings in merge sections
- References: <AM5PR0701MB2657F9BAF49A613759D90D13E42E0@AM5PR0701MB2657.eurprd07.prod.outlook.com> <7D840828-B2C9-4C20-BFE9-57249E324ED3@adacore.com> <AM5PR0701MB265712E733498503B2AE5F6AE4220@AM5PR0701MB2657.eurprd07.prod.outlook.com> <AM5PR0701MB2657264E715830F482111033E4220@AM5PR0701MB2657.eurprd07.prod.outlook.com> <AM5PR0701MB2657D5808765EA7B6D463886E4220@AM5PR0701MB2657.eurprd07.prod.outlook.com> <AM5PR0701MB2657D45A93A9A5C51850CC46E4220@AM5PR0701MB2657.eurprd07.prod.outlook.com> <AM5PR0701MB26574579A01C0EA68AEE8C1BE4270@AM5PR0701MB2657.eurprd07.prod.outlook.com> <AM5PR0701MB2657DE146167A258FE79441DE43D0@AM5PR0701MB2657.eurprd07.prod.outlook.com> <VI1PR0701MB286296920A9FB159972A9487E4190@VI1PR0701MB2862.eurprd07.prod.outlook.com> <20180914190153.GS8250@tucnak> <VI1PR0701MB2862520A2D5C9651AA5C045AE4190@VI1PR0701MB2862.eurprd07.prod.outlook.com>
Hi Jakub,
are your concerns addressed with this answer, or do you have objections
to this patch?
Thanks
Bernd.
On 09/14/18 21:06, Bernd Edlinger wrote:
> On 09/14/18 21:01, Jakub Jelinek wrote:
>> On Fri, Sep 14, 2018 at 06:39:38PM +0000, Bernd Edlinger wrote:
>>> Hi,
>>>
>>> this is an upate of the string-merge section, it is based on the V2-STRING_CST
>>> semantic patch series, which was finally installed yesterday.
>>> It merges single-byte string constants with or without terminating NUL.
>>> The patch has the same Ada and C test cases that were already in the V1 patch.
>>>
>>> Thus there are no pre-requisite patches necessary at this time.
>>>
>>> Bootstrapped and reg-tested on x86_64-pc-linux-gnu.
>>> Is it OK for trunk?
>>
>> I believe SHF_MERGE | SHF_STRINGS sections should only ever contain
>> zero-terminated strings.
>> See e.g. SCO ELF documentation:
>> "The size of each element is specified in the section header's sh_entsize field. If the SHF_STRINGS flag is also set, the data elements consist of null-terminated character strings."
>> http://www.sco.com/developers/gabi/2003-12-17/ch4.sheader.html
>> https://docs.oracle.com/cd/E23824_01/html/819-0690/ggdlu.html
>>
>> So, please never put non-zero terminated strings into MS sections.
>>
>
> Yes, that is of course clear.
>
> The idea is, if the string itself is not zero-terminated
> another zero is added, that is only done in at the assembly level.
>
> Strings with embedded zero bytes are not put in the merge section.
> >
> Bernd.