grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] fs: remove implicit compiler calls to memset/memcpy


From: Vladimir 'phcoder' Serbinenko
Subject: Re: [PATCH] fs: remove implicit compiler calls to memset/memcpy
Date: Sun, 10 Apr 2016 14:30:33 +0000



Le dim. 10 avr. 2016 15:53, Pete Batard <address@hidden> a écrit :
Hi,

I am using the GRUB codebase to build generic read-only EFI file system
drivers [1] and during that process, I found that some compilers (e.g.
MSVC, but most likely others) may insert implicit calls to memset/memcpy
when initializing or copying structure content, which defeats the use of
grub_memset/grub_memcpy as well as the avoidance of standard libraries.
We alias memcpy/memset to their grub equivalents because of this. Why is the same solution not suitable for you? Where compiler inserts those references is unpredictable. 

This patch ensures that grub_memset/grub_memcpy are used where required
in the file system sources (as well as some corollary files).

The patch also removes unnecessary trailing whitespaces for the affected
files.

A couple of additional notes:

* The patch also removes page breaks on some files as this is something
my git client (TortoiseGit) does automatically on its own and that
doesn't seem to be configurable. I do hope that this isn't a deal
breaker, as it would be a major PITA for me to rework patches to keep
the breaks in, and I kind of fail to see why we'd want to keep them in
the sources.

* Yes, the 'const char nl[2] = "\n";' in misc.h does generate an
implicit memcpy(), at least with MSVC for ARM. For what is worth, every
non whitespace change that was applied in this patch stems from looking
at the generated assembly, and isolating the memset/memcpy references.

* In zfs.c, you'll see that some function calls had to be modified to
get their parameters by reference, as passing them by value was also
generating implicit memcpy calls.

Regards,

/Pete

[1] https://github.com/pbatard/efifs
_______________________________________________
Grub-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/grub-devel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]