Skip to content
Snippets Groups Projects
Commit 84aa7065 authored by Nathaniel Shead's avatar Nathaniel Shead
Browse files

c++/modules: Fallback to ftruncate if posix_fallocate fails [PR115008]


Depending on the libc and filesystem, in cases where posix_fallocate
cannot do an efficient preallocation it may return EINVAL.  In such a
case we should fall back to ftruncate instead.

Apparently, depending on the system the use of posix_fallocate can have
a noticeable speedup over ftruncate in general (depending on the system)
so it probably isn't worth it to use ftruncate in all cases.

	PR c++/100358
	PR c++/115008

gcc/cp/ChangeLog:

	* module.cc (elf_out::create_mapping): Fallback to ftruncate if
	posix_fallocate fails.

Signed-off-by: default avatarNathaniel Shead <nathanieloshead@gmail.com>
parent ce81cd2e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment