Bug 201204 - stable/10 mips build fails in usr.bin/gcore
Summary: stable/10 mips build fails in usr.bin/gcore
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.1-STABLE
Hardware: mips Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-29 16:00 UTC by na
Modified: 2015-07-02 18:29 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description na 2015-06-29 16:00:03 UTC
It seems that I can no longer build stable/10 for TARGET=mips TARGET_ARCH=mips64. This is on an amd64 host, running a fresh build of the exact same tree.

===> usr.bin/gcore (all)
cc  -O -pipe -G0   -std=gnu99  -Wsystem-headers -Werror -Wno-pointer-sign -c /usr/src/usr.bin/gcore/elfcore.c -o elfcore.o
cc1: warnings being treated as errors
/usr/src/usr.bin/gcore/elfcore.c: In function 'elf_ident':
/usr/src/usr.bin/gcore/elfcore.c:149: warning: implicit declaration of function 'ELF_MACHINE_OK'
*** Error code 1

Or, with -DNO_WERROR:

===> usr.bin/gcore (all)
cc  -O -pipe -G0   -std=gnu99  -Wsystem-headers -Wno-pointer-sign -c /usr/src/usr.bin/gcore/elfcore.c -o elfcore.o
/usr/src/usr.bin/gcore/elfcore.c: In function 'elf_ident':
/usr/src/usr.bin/gcore/elfcore.c:149: warning: implicit declaration of function 'ELF_MACHINE_OK'
cc  -O -pipe -G0   -std=gnu99  -Wsystem-headers -Wno-pointer-sign -c /usr/src/usr.bin/gcore/gcore.c -o gcore.o
cc  -O -pipe -G0   -std=gnu99  -Wsystem-headers -Wno-pointer-sign  -o gcore elfcore.o gcore.o -lsbuf -lutil
elfcore.o: In function `elf_ident':
elfcore.c:(.text+0x15bc): undefined reference to `ELF_MACHINE_OK'
elfcore.c:(.text+0x15c0): undefined reference to `ELF_MACHINE_OK'
*** Error code 1
Comment 1 na 2015-07-02 18:05:40 UTC
Based on a grep for that symbol, I think it's pretty certain that the tiny patch below is correct. Any chance we can fix this before 10.2-RELEASE?

The complete grep:

./sys/arm/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_ARM)
./sys/ia64/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_IA_64)
./sys/mips/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_MIPS)
./sys/powerpc/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_PPC64)
./sys/powerpc/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_PPC)
./sys/sparc64/include/elf.h:#define	ELF_MACHINE_OK(x)	((x) == ELF_ARCH)
./sys/x86/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_386 || (x) == EM_486)
./sys/x86/include/elf.h:#define	ELF_MACHINE_OK(x) ((x) == EM_X86_64)
./usr.bin/gcore/elfcore.c:	if (!ELF_MACHINE_OK(machine))

And the (obvious?) patch:

Index: sys/mips/include/elf.h
===================================================================
--- sys/mips/include/elf.h	(revision 285049)
+++ sys/mips/include/elf.h	(working copy)
@@ -77,6 +77,8 @@
 #define ELF_ARCH	EM_MIPS
 #define ELF_ARCH32	EM_MIPS
 
+#define	ELF_MACHINE_OK(x) ((x) == EM_MIPS)
+
 /* Define "machine" characteristics */
 #if __ELF_WORD_SIZE == 32
 #define	ELF_TARG_CLASS	ELFCLASS32
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-07-02 18:27:53 UTC
A commit references this bug:

Author: emaste
Date: Thu Jul  2 18:27:05 UTC 2015
New revision: 285052
URL: https://svnweb.freebsd.org/changeset/base/285052

Log:
  MFC r269137 by marcel:

    Add missing definition of ELF_MACHINE_OK, now used by gcore(1).

  PR:	201204

Changes:
_U  stable/10/
  stable/10/sys/mips/include/elf.h