diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-03-08 16:05:08 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-03-08 16:05:08 +0000 |
commit | ccefc95d8e768b6473f08b59316fe5e014fa4589 (patch) | |
tree | 6c3eb93b9c918762cc0d2928070ba90a9c77c749 /rbutil | |
parent | 29a602cb801285bed6ef97784256d33017786397 (diff) | |
download | rockbox-ccefc95d8e768b6473f08b59316fe5e014fa4589.tar.gz rockbox-ccefc95d8e768b6473f08b59316fe5e014fa4589.zip |
Make bin2c ensure that the generated C arrays are 32bit aligned. Building nrv2e_d8 with the eabi toolchain breaks this assumption
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25071 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/mkamsboot/dualboot/bin2c.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/rbutil/mkamsboot/dualboot/bin2c.c b/rbutil/mkamsboot/dualboot/bin2c.c index 830224c35a..b02af88a4d 100644 --- a/rbutil/mkamsboot/dualboot/bin2c.c +++ b/rbutil/mkamsboot/dualboot/bin2c.c | |||
@@ -97,6 +97,7 @@ int main (int argc, char* argv[]) | |||
97 | for(i=0; i < argc - 2; i++) { | 97 | for(i=0; i < argc - 2; i++) { |
98 | unsigned char* buf; | 98 | unsigned char* buf; |
99 | off_t len; | 99 | off_t len; |
100 | off_t orig_len; | ||
100 | char *ext; | 101 | char *ext; |
101 | char *array = argv[2+i]; | 102 | char *array = argv[2+i]; |
102 | 103 | ||
@@ -108,14 +109,20 @@ int main (int argc, char* argv[]) | |||
108 | return 4; | 109 | return 4; |
109 | } | 110 | } |
110 | 111 | ||
111 | len = filesize(fd); | 112 | orig_len = filesize(fd); |
113 | /* pad to 32bit */ | ||
114 | len = (orig_len + 3) & ~3; | ||
112 | 115 | ||
113 | buf = malloc(len); | 116 | buf = malloc(len); |
114 | if (read(fd,buf,len) < len) { | 117 | if (read(fd,buf,orig_len) < orig_len) { |
115 | fprintf(stderr,"Short read, aborting\n"); | 118 | fprintf(stderr,"Short read, aborting\n"); |
116 | return 5; | 119 | return 5; |
117 | } | 120 | } |
118 | 121 | ||
122 | /* pad to 32bit with zeros */ | ||
123 | if (len > orig_len) | ||
124 | memset(buf+orig_len, 0, len-orig_len); | ||
125 | |||
119 | /* remove file extension */ | 126 | /* remove file extension */ |
120 | ext = strchr (array, '.'); | 127 | ext = strchr (array, '.'); |
121 | if (ext != NULL) | 128 | if (ext != NULL) |