libvpx: enable building for iOS devices (armv7)
Allow output of gas syntax assembly directly from obj_int_extract Change-Id: I33a747e87ef1c590a8766dea17f8cb2497e54591
This commit is contained in:
parent
4f5815290c
commit
294ecc7e0a
@ -38,7 +38,21 @@ int log_msg(const char *fmt, ...) {
|
||||
#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 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user