optimize: get_current_target for AOT thumb loader (#342)

This commit is contained in:
Karl Fessel 2020-08-11 03:40:18 +02:00 committed by GitHub
parent 6aeefbebb2
commit 3be29c3f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,22 +117,32 @@ get_target_symbol_map(uint32 *sym_num)
return target_sym_map;
}
#define BUILD_TARGET_THUMB_V4T "thumbv4t"
void
get_current_target(char *target_buf, uint32 target_buf_size)
{
char *build_target = BUILD_TARGET;
char *p = target_buf, *p_end;
snprintf(target_buf, target_buf_size, "%s", build_target);
p_end = p + strlen(target_buf);
while (p < p_end) {
if (*p >= 'A' && *p <= 'Z')
*p++ += 'a' - 'A';
else
p++;
const char * s = BUILD_TARGET;
size_t s_size = sizeof(BUILD_TARGET);
char *d = target_buf;
/* Set to "thumbv4t" by default if sub version isn't specified */
if (strcmp(s, "THUMB") == 0) {
s = BUILD_TARGET_THUMB_V4T;
s_size = sizeof(BUILD_TARGET_THUMB_V4T);
}
if (!strcmp(target_buf, "thumb"))
snprintf(target_buf, target_buf_size, "thumbv4t");
if(target_buf_size < s_size){
s_size = target_buf_size;
}
while (--s_size) {
if (*s >= 'A' && *s <= 'Z')
*d++ = *s++ + 'a' - 'A';
else
*d++ = *s++ ;
}
/* Ensure the string is null byte ('\0') terminated */
*d = '\0';
}
#undef BUILD_TARGET_THUMB_V4T
uint32
get_plt_item_size()