ref: aa86196c93355edbb7a0df71d77f0e75d54099a2
parent: 5769713608fa804c8f974644ba540a48186069bf
parent: 294ecc7e0a41c3c09efa7a3d5d0e1418be019b79
author: Johann <[email protected]>
date: Thu Jul 18 06:33:51 EDT 2013
Merge "libvpx: enable building for iOS devices (armv7)"
--- a/build/make/obj_int_extract.c
+++ b/build/make/obj_int_extract.c
@@ -38,7 +38,21 @@
#include <mach-o/loader.h>
#include <mach-o/nlist.h>
-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 @@
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 @@
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 @@
#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