From 294ecc7e0a41c3c09efa7a3d5d0e1418be019b79 Mon Sep 17 00:00:00 2001 From: Ami Fischman Date: Thu, 18 Jul 2013 10:11:01 -0700 Subject: [PATCH] libvpx: enable building for iOS devices (armv7) Allow output of gas syntax assembly directly from obj_int_extract Change-Id: I33a747e87ef1c590a8766dea17f8cb2497e54591 --- build/make/obj_int_extract.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c index 1604b5e68..feed9d983 100644 --- a/build/make/obj_int_extract.c +++ b/build/make/obj_int_extract.c @@ -38,7 +38,21 @@ int log_msg(const char *fmt, ...) { #include #include -int parse_macho(uint8_t *base_buf, size_t sz) { +int print_macho_equ(output_fmt_t mode, uint8_t* name, int val) { + switch (mode) { + case OUTPUT_FMT_RVDS: + printf("%-40s EQU %5d\n", name, val); + return 0; + case OUTPUT_FMT_GAS: + printf(".set %-40s, %5d\n", name, val); + return 0; + default: + log_msg("Unsupported mode: %d", mode); + return 1; + } +} + +int parse_macho(uint8_t *base_buf, size_t sz, output_fmt_t mode) { int i, j; struct mach_header header; uint8_t *buf = base_buf; @@ -156,8 +170,7 @@ int parse_macho(uint8_t *base_buf, size_t sz) { memcpy(&val, base_buf + base_data_section + nl.n_value, sizeof(val)); - printf("%-40s EQU %5d\n", - str_buf + nl.n_un.n_strx + 1, val); + print_macho_equ(mode, str_buf + nl.n_un.n_strx + 1, val); } else { /* if (bits == 64) */ struct nlist_64 nl; int val; @@ -167,8 +180,7 @@ int parse_macho(uint8_t *base_buf, size_t sz) { memcpy(&val, base_buf + base_data_section + nl.n_value, sizeof(val)); - printf("%-40s EQU %5d\n", - str_buf + nl.n_un.n_strx + 1, val); + print_macho_equ(mode, str_buf + nl.n_un.n_strx + 1, val); } } } @@ -796,7 +808,7 @@ int main(int argc, char **argv) { #if defined(__GNUC__) && __GNUC__ #if defined(__MACH__) - res = parse_macho(file_buf, file_size); + res = parse_macho(file_buf, file_size, mode); #elif defined(__ELF__) res = parse_elf(file_buf, file_size, mode); #endif