summaryrefslogtreecommitdiffstats
path: root/libvpx/build/make/obj_int_extract.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvpx/build/make/obj_int_extract.c')
-rw-r--r--libvpx/build/make/obj_int_extract.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/libvpx/build/make/obj_int_extract.c b/libvpx/build/make/obj_int_extract.c
index 1604b5e..feed9d9 100644
--- a/libvpx/build/make/obj_int_extract.c
+++ b/libvpx/build/make/obj_int_extract.c
@@ -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