Send MinGW-Notify mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.osdn.me/mailman/listinfo/mingw-notify
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of MinGW-Notify digest..."
Please do not reply to this notification; the sender address is unable to
accept incoming e-mail. If you wish to unsubscribe you can do so at
https://lists.osdn.me/mailman/listinfo/mingw-notify.
Today's Topics:
1. [mingw] #38607: Improved standards support for aligned memory
allocators (MinGW Notification List)
2. [mingw] #38607: Improved standards support for aligned memory
allocators (MinGW Notification List)
----------------------------------------------------------------------
Message: 1
Date: Fri, 07 Dec 2018 22:00:12 +0000
From: MinGW Notification List <[email protected]>
To: OSDN Ticket System <[email protected]>
Subject: [MinGW-Notify] [mingw] #38607: Improved standards support for
aligned memory allocators
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
#38607: Improved standards support for aligned memory allocators
Open Date: 2018-09-17 18:25
Last Update: 2018-12-07 22:00
URL for this Ticket:
https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607
---------------------------------------------------------------------
Last Changes/Comment on this Ticket:
2018-12-07 22:00 Updated by: keith
Comment:
Following a brief dialogue, on the project contributors (private) forum, I've
updated the implementation to provide:–
1. void *__mingw_realloc( void *, size_t );
2. void __mingw_free( void * );
each of which has been implemented with a capability to detect whether its void
* argument refers to memory allocated by a function providing default malloc()
alignment, or by any of the functions offering __mingw_aligned_malloc(), (but
*not* Microsoft's _aligned_malloc()), extended alignment, and to proceed
accordingly. Additionally, for congruence with both Microsoft's and our own
earlier implementation, this reimplementation continues to provide (modified
versions of):–
1. void *__mingw_aligned_malloc( size_t, size_t );
2. void *__mingw_aligned_offset_malloc( size_t, size_t, size_t);
3. void *__mingw_aligned_offset_realloc( void *, size_t, size_t, size_t );
4. void *__mingw_aligned_realloc( void *, size_t, size_t );
5. void __mingw_aligned_free( void * );
Do please note that, while this latter function set is semantically equivalent
to its Microsoft counterpart, it is not binary compatible; additionally, void
__mingw_aligned_free( void * ); has become redundant — it is now, in fact,
implemented as a trivial alias for void __mingw_free( void * );
I have updated the attached patch files, to reflect this revised
implementation.
---------------------------------------------------------------------
Ticket Status:
Reporter: keith
Owner: (None)
Type: Feature Request
Status: Open
Priority: 5 - Medium
MileStone: (None)
Component: WSL
Severity: 5 - Medium
Resolution: None
---------------------------------------------------------------------
Ticket details:
Microsoft introduced _aligned_malloc(), and associated functions, with
MSVCR70.DLL. Although subsequently supported in MSVCRT.DLL, from WinXP onwards,
exposure of these APIs interferes with a clean build of GCC — not only insofar
as, having detected presence of the APIs, GCC would become dependent on WinXP
and later, thus needlessly breaking legacy support, but furthermore, the GCC
sources neglect to include the requisite <malloc.h> header file, and thus do
not build cleanly.
Legacy support for similar APIs was added to MinGW, in 2003/2004, under feature
request #260; however, it may be ill-advised to make GCC dependent on these
MinGW specific APIs, for the following reasons:—
1. A patch, to incorporate them, would be unlikely to be accepted upstream.
2. If the APIs are not detected, GCC will provide its own replacement
functions.
3. A review reveals potential flaws in the MinGW implementation.
Consequently, I suggest:—
1. **Not** exposing the Microsoft APIs in libmsvcrt.a
2. Reworking the MinGW implementation, to address potential flaws.
3. Consider adding support for ISO-C11's aligned_alloc() and POSIX.1's
posix_memalign() APIs.
--
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN
Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net
URL for this Ticket:
https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607
------------------------------
Message: 2
Date: Fri, 07 Dec 2018 22:24:22 +0000
From: MinGW Notification List <[email protected]>
To: OSDN Ticket System <[email protected]>
Subject: [MinGW-Notify] [mingw] #38607: Improved standards support for
aligned memory allocators
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
#38607: Improved standards support for aligned memory allocators
Open Date: 2018-09-17 18:25
Last Update: 2018-12-07 22:24
URL for this Ticket:
https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607
---------------------------------------------------------------------
Last Changes/Comment on this Ticket:
2018-12-07 22:24 Updated by: keith
Comment:
Following on from my preceding comment, astute readers may observe that, since
1. void *__mingw_realloc( void *, size_t );
2. void __mingw_free( void * );
can handle both malloc() alignment, and __mingw_aligned_malloc() alignment, and
since their signatures are semantically compatible, they could be mapped as
redirection targets for calls to
1. void *realloc( void *, size_t );
2. void free( void * );
respectively, thus providing a suitable foundation for implementations of an
ISO-C11 compatible
1. void *aligned_alloc( size_t, size_t );
and a POSIX.1 compatible
1. int posix_memalign( void **, size_t, size_t );
in terms of simple (potentially in-line) wrappers around
1. void *__mingw_aligned_malloc( size_t, size_t );
---------------------------------------------------------------------
Ticket Status:
Reporter: keith
Owner: (None)
Type: Feature Request
Status: Open
Priority: 5 - Medium
MileStone: (None)
Component: WSL
Severity: 5 - Medium
Resolution: None
---------------------------------------------------------------------
Ticket details:
Microsoft introduced _aligned_malloc(), and associated functions, with
MSVCR70.DLL. Although subsequently supported in MSVCRT.DLL, from WinXP onwards,
exposure of these APIs interferes with a clean build of GCC — not only insofar
as, having detected presence of the APIs, GCC would become dependent on WinXP
and later, thus needlessly breaking legacy support, but furthermore, the GCC
sources neglect to include the requisite <malloc.h> header file, and thus do
not build cleanly.
Legacy support for similar APIs was added to MinGW, in 2003/2004, under feature
request #260; however, it may be ill-advised to make GCC dependent on these
MinGW specific APIs, for the following reasons:—
1. A patch, to incorporate them, would be unlikely to be accepted upstream.
2. If the APIs are not detected, GCC will provide its own replacement
functions.
3. A review reveals potential flaws in the MinGW implementation.
Consequently, I suggest:—
1. **Not** exposing the Microsoft APIs in libmsvcrt.a
2. Reworking the MinGW implementation, to address potential flaws.
3. Consider adding support for ISO-C11's aligned_alloc() and POSIX.1's
posix_memalign() APIs.
--
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN
Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net
URL for this Ticket:
https://osdn.net//projects/mingw/ticket/38607
RSS feed for this Ticket:
https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=38607
------------------------------
Subject: Digest Footer
_______________________________________________
MinGW-Notify mailing list
[email protected]
https://lists.osdn.me/mailman/listinfo/mingw-notify
------------------------------
End of MinGW-Notify Digest, Vol 15, Issue 2
*******************************************