From owner-svn-src-all@freebsd.org Fri Apr 7 20:02:02 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AA4BD33354; Fri, 7 Apr 2017 20:02:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 415A526C; Fri, 7 Apr 2017 20:02:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v37K21CW032934; Fri, 7 Apr 2017 20:02:01 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v37K21Ux032932; Fri, 7 Apr 2017 20:02:01 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704072002.v37K21Ux032932@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 7 Apr 2017 20:02:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316622 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Apr 2017 20:02:02 -0000 Author: jhb Date: Fri Apr 7 20:02:01 2017 New Revision: 316622 URL: https://svnweb.freebsd.org/changeset/base/316622 Log: Explicitly set the desired MIPS ABI in toolchain flags. Specifically, set '-mabi=XX' in AFLAGS, CFLAGS, and LDFLAGS. This permits building MIPS worlds and binaries with a toolchain whose default output does not match the desired TARGET_ARCH. _LDFLAGS (which is used with LD instead of with CC) required an update as LD does not accept the -mabi flags (so they must be stripped from LDFLAGS when generating _LDFLAGS). For bare uses of LD (rather than linking via CC), the desired ABI must be set by setting an explicit linker emulation as done in r316514 for kernels and kernel modules. Reviewed by: imp Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D10085 Modified: head/share/mk/bsd.cpu.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Fri Apr 7 19:56:12 2017 (r316621) +++ head/share/mk/bsd.cpu.mk Fri Apr 7 20:02:01 2017 (r316622) @@ -314,6 +314,19 @@ AFLAGS += -EB CFLAGS += -EB LDFLAGS += -EB . endif +. if ${MACHINE_ARCH:Mmips64*} != "" +AFLAGS+= -mabi=64 +CFLAGS+= -mabi=64 +LDFLAGS+= -mabi=64 +. elif ${MACHINE_ARCH:Mmipsn32*} != "" +AFLAGS+= -mabi=n32 +CFLAGS+= -mabi=n32 +LDFLAGS+= -mabi=n32 +. else +AFLAGS+= -mabi=32 +CFLAGS+= -mabi=32 +LDFLAGS+= -mabi=32 +. endif . if ${MACHINE_ARCH:Mmips*hf} CFLAGS += -mhard-float . else Modified: head/share/mk/sys.mk ============================================================================== --- head/share/mk/sys.mk Fri Apr 7 19:56:12 2017 (r316621) +++ head/share/mk/sys.mk Fri Apr 7 20:02:01 2017 (r316622) @@ -217,9 +217,12 @@ INSTALL ?= install LEX ?= lex LFLAGS ?= +# LDFLAGS is for CC, _LDFLAGS is for LD. Generate _LDFLAGS from +# LDFLAGS by stripping -Wl, from pass-through arguments and dropping +# compiler driver flags (e.g. -mabi=*) that conflict with flags to LD. LD ?= ld -LDFLAGS ?= # LDFLAGS is for CC, -_LDFLAGS = ${LDFLAGS:S/-Wl,//g} # strip -Wl, for LD +LDFLAGS ?= +_LDFLAGS = ${LDFLAGS:S/-Wl,//g:N-mabi=*} LINT ?= lint LINTFLAGS ?= -cghapbx