[PATCH 06/25] Add struct scratch_buffer and its internal helper functions

Florian Weimer fweimer@redhat.com
Thu Apr 2 18:31:00 GMT 2015


On 04/01/2015 06:28 PM, Florian Weimer wrote:
> On 03/23/2015 07:48 PM, Florian Weimer wrote:
>> On 03/23/2015 07:46 PM, Joseph Myers wrote:
>>> On Mon, 23 Mar 2015, Florian Weimer wrote:
>>>
>>>> On 03/23/2015 07:41 PM, Joseph Myers wrote:
>>>>
>>>>>> Since C allows platforms where pointers and/or floating-point values have
>>>>>> alignments stricter than intmax_t, I suggest using 'max (__alignof__
>>>>>> (intmax_t), __alignof__ (max_align_t))' along with a comment explaining why
>>>>>> you don't trust max_align_t here.
>>>>>
>>>>> max_align_t was added to stddef.h in GCC 4.7, so we can't rely on it in 
>>>>> glibc without appropriate conditionals.
>>>>
>>>> We compile glibc in -std=gnu99 mode, and max_align_t appears available.
>>>>  Suggestions?
>>>
>>> It's specifically when compiling with GCC 4.6 (the oldest supported 
>>> version) that it won't be available.
>>
>> Oh, I misread what you wrote.  What I was saying is that we can't get it
>> easily with GCC 4.9.2, either.
> 
> I proposed a patch for a libc_max_align_t type here:
> 
>   <https://sourceware.org/ml/libc-alpha/2015-04/msg00004.html>
> 
> As far as I can see, using that instead of intmax_t should address the
> only remaining issue with this patch.

And here is this patch, with libc_max_align_t.

	* include/scratch_buffer.h: New file.
	* malloc/scratch_buffer_grow.c: Likewise.
	* malloc/scratch_buffer_grow_preserve.c: Likewise.
	* malloc/scratch_buffer_set_array_size.c: Likewise.
	* malloc/tst-scratch_buffer.c: Likewise.
	* malloc/Makefile (routines): Add scratch_buffer_grow.
	(tests): Add test case.
	* malloc/Versions (GLIBC_PRIVATE): Export
	__libc_scratch_buffer_grow, __libc_scratch_buffer_grow_preserve,
	__libc_scratch_buffer_set_array_size.

-- 
Florian Weimer / Red Hat Product Security
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-struct-scratch_buffer-and-its-internal-helper-fu.patch
Type: text/x-patch
Size: 18878 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20150402/604a0988/attachment.bin>


More information about the Libc-alpha mailing list