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

[Libguestfs] [PATCH supermin] bin2s: make sure the data is aligned



Not all the architectures can cope correctly with unaligned data, and
thus the embedded init written is bogus (since it will contain random
padding at the beginning, and truncated of the same amount at the end).

To overcome that, make sure the rodata section with the embedded init
is always aligned to 8 bytes, which should work fine for both 32bit and
64bit architectures.
---
 src/bin2s.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin2s.pl b/src/bin2s.pl
index 6c70446..67ff1f2 100755
--- a/src/bin2s.pl
+++ b/src/bin2s.pl
@@ -44,6 +44,7 @@ print $ofh <<"EOF";
 \t.globl\t_binary_${infile_basename}_end
 
 \t.section\t.rodata
+\t.align 8
 _binary_${infile_basename}_start:
 EOF
 
-- 
2.13.5


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