Fix cross-endian ELF note file / memory conversion

The namesz and descsz variables need to be used in native endianness.
The sizes are in native order after swapping in the file to memory case,
and before swapping in the memory to file case.

This issue was identified for r273443, but the change was applied to the
wrong case. Revert r273443 to fix the to-memory case, and apply the
equivalent change to the to-file case.

Obtained from:	FreeBSD r275430
Sponsored by:	DARPA, AFRL
Reviewed by:	adrian, brooks, marcel
Differential Revision: https://reviews.freebsd.org/D1257