From 6d7adebad52252d8c7672fb0ddc0d3f3ad1215bb Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Wed, 21 Aug 2019 10:54:52 +0000 Subject: [PATCH] gprof: disable building of a.out components On arm64, riscv, and s390x disable building of aout components. This allows gprof to build on these architectures which never supported the legacy a.out binary format. Obtained from: s390x branch MFC after: 3 months --- usr.bin/gprof/Makefile | 8 +++++++- usr.bin/gprof/gprof.c | 7 +++++-- usr.bin/gprof/gprof.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/usr.bin/gprof/Makefile b/usr.bin/gprof/Makefile index 506232597a42..28d0ffeef25c 100644 --- a/usr.bin/gprof/Makefile +++ b/usr.bin/gprof/Makefile @@ -2,8 +2,14 @@ # $FreeBSD$ PROG= gprof -SRCS= gprof.c aout.c arcs.c dfn.c elf.c lookup.c hertz.c \ +SRCS= gprof.c arcs.c dfn.c elf.c lookup.c hertz.c \ printgprof.c printlist.c kernel.c + +.if ${MACHINE_ARCH} != "aarch64" && ${MACHINE_ARCH} != "riscv" && \ + ${MACHINE_ARCH} != "s390x" +SRCS+= aout.c +CFLAGS+= -DWITH_AOUT +.endif FILES= gprof.flat gprof.callg FILESDIR= ${SHAREDIR}/misc diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 1821fa0bb33f..4970792f0502 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -160,8 +160,11 @@ main(int argc, char **argv) * get information from the executable file. */ if ((Kflag && kernel_getnfile(a_outname, &defaultEs) == -1) || - (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 && - aout_getnfile(a_outname, &defaultEs) == -1)) + (!Kflag && elf_getnfile(a_outname, &defaultEs) == -1 +#ifdef WITH_AOUT + && aout_getnfile(a_outname, &defaultEs) == -1 +#endif + )) errx(1, "%s: bad format", a_outname); /* * sort symbol table. diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index 4e801cce21e3..6c54fbd4047e 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -256,7 +256,9 @@ void addarc(nltype *, nltype *, long); bool addcycle(arctype **, arctype **); void addlist(struct stringlist *, char *); void alignentries(void); +#ifdef WITH_AOUT int aout_getnfile(const char *, char ***); +#endif int arccmp(arctype *, arctype *); arctype *arclookup(nltype *, nltype *); void asgnsamples(void);