Author: emaste
Date: Mon Dec  1 17:49:42 2014
New Revision: 275373
URL: https://svnweb.freebsd.org/changeset/base/275373

Log:
  Build infrastructure for elftoolchain tools
  
  Set WITH_ELFTOOLCHAIN_TOOLS in src.conf to use the elftoolchain version
  of the following tools:
  
   * addr2line
   * elfcopy (strip / mcs)
   * nm
   * size
   * strings
  
  Reviewed by:  bapt (earlier version)
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D1224

Added:
  head/lib/libelftc/
  head/lib/libelftc/Makefile   (contents, props changed)
  head/lib/libelftc/elftc_version.c   (contents, props changed)
  head/tools/build/options/WITH_ELFTOOLCHAIN_TOOLS   (contents, props changed)
  head/usr.bin/addr2line/
  head/usr.bin/addr2line/Makefile   (contents, props changed)
  head/usr.bin/elfcopy/
  head/usr.bin/elfcopy/Makefile   (contents, props changed)
  head/usr.bin/nm/
  head/usr.bin/nm/Makefile   (contents, props changed)
  head/usr.bin/size/
  head/usr.bin/size/Makefile   (contents, props changed)
  head/usr.bin/strings/
  head/usr.bin/strings/Makefile   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/gnu/usr.bin/binutils/Makefile
  head/lib/Makefile
  head/share/mk/src.libnames.mk
  head/share/mk/src.opts.mk
  head/usr.bin/Makefile

Modified: head/Makefile.inc1
==============================================================================
--- head/Makefile.inc1  Mon Dec  1 17:36:10 2014        (r275372)
+++ head/Makefile.inc1  Mon Dec  1 17:49:42 2014        (r275373)
@@ -1415,6 +1415,14 @@ _kgzip=          usr.sbin/kgzip
 # If we're given an XAS, don't build binutils.
 .if ${XAS:M/*} == "" && ${MK_BINUTILS_BOOTSTRAP} != "no"
 _binutils=     gnu/usr.bin/binutils
+.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
+_elftctools=   lib/libelftc \
+               usr.bin/addr2line \
+               usr.bin/elfcopy \
+               usr.bin/nm \
+               usr.bin/size \
+               usr.bin/strings
+.endif
 .endif
 
 # If an full path to an external cross compiler is given, don't build
@@ -1434,6 +1442,7 @@ cross-tools: .MAKE
     ${_clang_libs} \
     ${_clang} \
     ${_binutils} \
+    ${_elftctools} \
     ${_cc} \
     usr.bin/xlint/lint1 usr.bin/xlint/lint2 usr.bin/xlint/xlint \
     ${_btxld} \
@@ -1491,6 +1500,7 @@ native-xtools: .MAKE
     ${_clang_tblgen} \
     usr.bin/ar \
     ${_binutils} \
+    ${_elftctools} \
     ${_cc} \
     ${_gcc_tools} \
     ${_clang_libs} \
@@ -2045,6 +2055,7 @@ _xb-build-tools:
 _xb-cross-tools:
 .for _tool in \
     ${_binutils} \
+    ${_elftctools} \
     usr.bin/ar \
     ${_clang_libs} \
     ${_clang} \
@@ -2077,6 +2088,7 @@ _xi-cross-tools:
        @echo "_xi-cross-tools"
 .for _tool in \
     ${_binutils} \
+    ${_elftctools} \
     usr.bin/ar \
     ${_clang_libs} \
     ${_clang} \

Modified: head/gnu/usr.bin/binutils/Makefile
==============================================================================
--- head/gnu/usr.bin/binutils/Makefile  Mon Dec  1 17:36:10 2014        
(r275372)
+++ head/gnu/usr.bin/binutils/Makefile  Mon Dec  1 17:49:42 2014        
(r275373)
@@ -1,19 +1,29 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 SUBDIR=        libiberty \
        libbfd \
        libopcodes \
        libbinutils \
-       addr2line \
+       ${_addr2line} \
        as \
        ld \
-       nm \
+       ${_nm} \
        objcopy \
        objdump \
        readelf \
-       size \
-       strings \
-       strip \
+       ${_size} \
+       ${_strings} \
+       ${_strip} \
        doc
+       
+.if ${MK_ELFTOOLCHAIN_TOOLS} == "no"
+_addr2line=    addr2line
+_nm=           nm
+_size=         size
+_strings=      strings
+_strip=                strip
+.endif
 
 .include <bsd.subdir.mk>

Modified: head/lib/Makefile
==============================================================================
--- head/lib/Makefile   Mon Dec  1 17:36:10 2014        (r275372)
+++ head/lib/Makefile   Mon Dec  1 17:49:42 2014        (r275373)
@@ -45,6 +45,7 @@ SUBDIR=       ${SUBDIR_ORDERED} \
        libdpv \
        libdwarf \
        libedit \
+       ${_libelftc} \
        ${_libevent} \
        libexecinfo \
        libexpat \
@@ -190,6 +191,10 @@ _clang=            clang
 _cuse=         libcuse
 .endif
 
+.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
+_libelftc=     libelftc
+.endif
+
 .if ${MK_GPIB} != "no"
 _libgpib=      libgpib
 .endif

Added: head/lib/libelftc/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libelftc/Makefile  Mon Dec  1 17:49:42 2014        (r275373)
@@ -0,0 +1,30 @@
+# $FreeBSD$
+.include <bsd.own.mk>
+
+INTERNALLIB=
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+
+.PATH: ${ELFTCDIR}/libelftc
+
+LIB=   elftc
+
+SRCS=  elftc_bfdtarget.c                       \
+       elftc_copyfile.c                        \
+       elftc_demangle.c                        \
+       elftc_set_timestamps.c                  \
+       elftc_string_table.c                    \
+       elftc_version.c                         \
+       libelftc_bfdtarget.c                    \
+       libelftc_dem_arm.c                      \
+       libelftc_dem_gnu2.c                     \
+       libelftc_dem_gnu3.c                     \
+       libelftc_hash.c                         \
+       libelftc_vstr.c
+
+INCS=  libelftc.h
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+NO_MAN=        yes
+
+.include <bsd.lib.mk>

Added: head/lib/libelftc/elftc_version.c
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libelftc/elftc_version.c   Mon Dec  1 17:49:42 2014        
(r275373)
@@ -0,0 +1,10 @@
+/* $FreeBSD$ */
+
+#include <sys/types.h>
+#include <libelftc.h>
+
+const char *
+elftc_version(void)
+{
+       return "libelftc r2974";
+}

Modified: head/share/mk/src.libnames.mk
==============================================================================
--- head/share/mk/src.libnames.mk       Mon Dec  1 17:36:10 2014        
(r275372)
+++ head/share/mk/src.libnames.mk       Mon Dec  1 17:49:42 2014        
(r275373)
@@ -27,6 +27,7 @@ _INTERNALIBS= \
                amu \
                bsnmptools \
                cron \
+               elftc \
                event \
                fifolog \
                ipf \
@@ -286,6 +287,10 @@ LIBATF_CXX?=       ${LIBATF_CXXDIR}/libatf-c++
 LIBBSDSTATDIR= ${ROOTOBJDIR}/lib/libbsdstat
 LIBBSDSTAT?=   ${LIBBSDSTATDIR}/libbsdstat.a
 
+LIBELFTCDIR=   ${ROOTOBJDIR}/lib/libelftc
+LDELFTC?=      ${LIBELFTCDIR}/libelftc.a
+LIBELFTC?=     ${LIBELFTCDIR}/libelftc.a
+
 LIBEVENTDIR=   ${ROOTOBJDIR}/lib/libevent
 LIBEVENT?=     ${LIBEVENTDIR}/libevent.a
 

Modified: head/share/mk/src.opts.mk
==============================================================================
--- head/share/mk/src.opts.mk   Mon Dec  1 17:36:10 2014        (r275372)
+++ head/share/mk/src.opts.mk   Mon Dec  1 17:49:42 2014        (r275373)
@@ -160,6 +160,7 @@ __DEFAULT_NO_OPTIONS = \
     BSD_GREP \
     CLANG_EXTRAS \
     EISA \
+    ELFTOOLCHAIN_TOOLS \
     FMAKE \
     HESIOD \
     LLDB \

Added: head/tools/build/options/WITH_ELFTOOLCHAIN_TOOLS
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/build/options/WITH_ELFTOOLCHAIN_TOOLS    Mon Dec  1 17:49:42 
2014        (r275373)
@@ -0,0 +1,9 @@
+.\" $FreeBSD$
+Set to use
+.Xr addr2line 1 ,
+.Xr nm 1 ,
+.Xr size 1 ,
+.Xr strings 1 ,
+and
+.Xr strip 1
+from the elftoolchain project instead of GNU binutils.

Modified: head/usr.bin/Makefile
==============================================================================
--- head/usr.bin/Makefile       Mon Dec  1 17:36:10 2014        (r275372)
+++ head/usr.bin/Makefile       Mon Dec  1 17:49:42 2014        (r275373)
@@ -9,7 +9,8 @@
 # Moved to secure: bdes
 #
 
-SUBDIR=        alias \
+SUBDIR=        ${_addr2line} \
+       alias \
        apply \
        asa \
        awk \
@@ -41,6 +42,7 @@ SUBDIR=       alias \
        du \
        ee \
        elf2aout \
+       ${_elfcopy} \
        elfdump \
        enigma \
        env \
@@ -119,6 +121,7 @@ SUBDIR=     alias \
        nfsstat \
        nice \
        nl \
+       ${_nm} \
        nohup \
        opieinfo \
        opiekey \
@@ -150,12 +153,14 @@ SUBDIR=   alias \
        seq \
        shar \
        showmount \
+       ${_size} \
        sockstat \
        soeliminate \
        sort \
        split \
        stat \
        stdbuf \
+       ${_strings} \
        su \
        systat \
        tabs \
@@ -236,6 +241,14 @@ SUBDIR+=   calendar
 _clang=                clang
 .endif
 
+.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
+_addr2line=    addr2line
+_elfcopy=      elfcopy
+_nm=           nm
+_size=         size
+_strings=      strings
+.endif
+
 .if ${MK_FMAKE} != "no"
 SUBDIR+=       make
 .endif

Added: head/usr.bin/addr2line/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/addr2line/Makefile     Mon Dec  1 17:49:42 2014        
(r275373)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+ADDR2LINEDIR=  ${ELFTCDIR}/addr2line
+
+.PATH: ${ADDR2LINEDIR}
+
+PROG=  addr2line
+
+LIBADD=        elftc dwarf elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>

Added: head/usr.bin/elfcopy/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/elfcopy/Makefile       Mon Dec  1 17:49:42 2014        
(r275373)
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+ELFCOPYDIR=    ${ELFTCDIR}/elfcopy
+
+.PATH: ${ELFCOPYDIR}
+
+PROG=  elfcopy
+
+SRCS=  archive.c ascii.c binary.c main.c sections.c segments.c symbols.c
+
+WARNS?=        5
+
+LIBADD=        archive elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+MAN=   elfcopy.1 strip.1
+
+LINKS= ${BINDIR}/elfcopy ${BINDIR}/strip
+
+.include <bsd.prog.mk>

Added: head/usr.bin/nm/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/nm/Makefile    Mon Dec  1 17:49:42 2014        (r275373)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+NMDIR=         ${ELFTCDIR}/nm
+
+.PATH: ${NMDIR}
+
+PROG=  nm
+
+LIBADD=        dwarf elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>

Added: head/usr.bin/size/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/size/Makefile  Mon Dec  1 17:49:42 2014        (r275373)
@@ -0,0 +1,16 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+SIZEDIR=       ${ELFTCDIR}/size
+
+.PATH: ${SIZEDIR}
+
+PROG=  size
+
+LIBADD=        elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>

Added: head/usr.bin/strings/Makefile
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.bin/strings/Makefile       Mon Dec  1 17:49:42 2014        
(r275373)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+.include <src.opts.mk>
+
+ELFTCDIR=      ${.CURDIR}/../../contrib/elftoolchain
+
+.PATH: ${ELFTCDIR}/strings
+
+PROG=  strings
+
+LIBADD=        elftc elf
+
+CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common
+
+.include <bsd.prog.mk>
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to