macos: Disable verbose linking output

This commit is contained in:
Michael Matz 2020-05-22 06:27:37 +02:00
parent 9ce5b4a691
commit f2e154e1e5

View file

@ -17,6 +17,8 @@
*/ */
#include "tcc.h" #include "tcc.h"
#define DEBUG_MACHO 0
struct mach_header { struct mach_header {
uint32_t magic; /* mach magic number identifier */ uint32_t magic; /* mach magic number identifier */
int cputype; /* cpu specifier */ int cputype; /* cpu specifier */
@ -373,9 +375,10 @@ static int check_symbols(TCCState *s1, struct macho *mo)
unsigned bind = ELFW(ST_BIND)(sym->st_info); unsigned bind = ELFW(ST_BIND)(sym->st_info);
unsigned vis = ELFW(ST_VISIBILITY)(sym->st_other); unsigned vis = ELFW(ST_VISIBILITY)(sym->st_other);
printf("%4d (%4d): %09llx %4d %4d %4d %3d %s\n", if (DEBUG_MACHO)
sym_index, elf_index, sym->st_value, printf("%4d (%4d): %09llx %4d %4d %4d %3d %s\n",
type, bind, vis, sym->st_shndx, name); sym_index, elf_index, sym->st_value,
type, bind, vis, sym->st_shndx, name);
if (bind == STB_LOCAL) { if (bind == STB_LOCAL) {
if (mo->ilocal == -1) if (mo->ilocal == -1)
mo->ilocal = sym_index - 1; mo->ilocal = sym_index - 1;
@ -680,14 +683,16 @@ static void collect_sections(TCCState *s1, struct macho *mo)
for (s = mo->sk_to_sect[sk].s; s; s = s->prev) { for (s = mo->sk_to_sect[sk].s; s; s = s->prev) {
al = s->sh_addralign; al = s->sh_addralign;
curaddr = (curaddr + al - 1) & -al; curaddr = (curaddr + al - 1) & -al;
tcc_warning("curaddr now 0x%llx", curaddr); if (DEBUG_MACHO)
printf("curaddr now 0x%llx\n", curaddr);
s->sh_addr = curaddr; s->sh_addr = curaddr;
curaddr += s->sh_size; curaddr += s->sh_size;
if (s->sh_type != SHT_NOBITS) { if (s->sh_type != SHT_NOBITS) {
fileofs = (fileofs + al - 1) & -al; fileofs = (fileofs + al - 1) & -al;
s->sh_offset = fileofs; s->sh_offset = fileofs;
fileofs += s->sh_size; fileofs += s->sh_size;
tcc_warning("fileofs now %lld", fileofs); if (DEBUG_MACHO)
printf("fileofs now %lld\n", fileofs);
} }
if (sec) if (sec)
mo->elfsectomacho[s->sh_num] = numsec; mo->elfsectomacho[s->sh_num] = numsec;
@ -695,27 +700,28 @@ static void collect_sections(TCCState *s1, struct macho *mo)
if (sec) if (sec)
sec->size = curaddr - sec->addr; sec->size = curaddr - sec->addr;
} }
for (s = mo->sk_to_sect[sk].s; s; s = s->prev) { if (DEBUG_MACHO)
int type = s->sh_type; for (s = mo->sk_to_sect[sk].s; s; s = s->prev) {
int flags = s->sh_flags; int type = s->sh_type;
printf("%d section %-16s %-10s %09llx %04x %02d %s,%s,%s\n", int flags = s->sh_flags;
sk, printf("%d section %-16s %-10s %09llx %04x %02d %s,%s,%s\n",
s->name, sk,
type == SHT_PROGBITS ? "progbits" : s->name,
type == SHT_NOBITS ? "nobits" : type == SHT_PROGBITS ? "progbits" :
type == SHT_SYMTAB ? "symtab" : type == SHT_NOBITS ? "nobits" :
type == SHT_STRTAB ? "strtab" : type == SHT_SYMTAB ? "symtab" :
type == SHT_INIT_ARRAY ? "init" : type == SHT_STRTAB ? "strtab" :
type == SHT_FINI_ARRAY ? "fini" : type == SHT_INIT_ARRAY ? "init" :
type == SHT_RELX ? "rel" : "???", type == SHT_FINI_ARRAY ? "fini" :
s->sh_addr, type == SHT_RELX ? "rel" : "???",
(unsigned)s->data_offset, s->sh_addr,
s->sh_addralign, (unsigned)s->data_offset,
flags & SHF_ALLOC ? "alloc" : "", s->sh_addralign,
flags & SHF_WRITE ? "write" : "", flags & SHF_ALLOC ? "alloc" : "",
flags & SHF_EXECINSTR ? "exec" : "" flags & SHF_WRITE ? "write" : "",
); flags & SHF_EXECINSTR ? "exec" : ""
} );
}
} }
if (seg) { if (seg) {
seg->vmsize = curaddr - seg->vmaddr; seg->vmsize = curaddr - seg->vmaddr;