From owner-freebsd-mips@freebsd.org Sat Aug 20 01:06:11 2016 Return-Path: Delivered-To: freebsd-mips@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 6509EBBEEEF for ; Sat, 20 Aug 2016 01:06:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B0F01BF1 for ; Sat, 20 Aug 2016 01:06:11 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id x131so43283475ite.0 for ; Fri, 19 Aug 2016 18:06:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=gP77njr4oUyKRoz1Fu5MTHVzEOmqEJmj6ZPeg9NNm0g=; b=Ed+RIl8BGdWe+KsK9UI5mjQYP/F7cn2mxEblowfXgdIo+fAcKz/Ye/e6Vk51LeAeH3 bIbPvSvY6Ibp4XRNzsM9P3i+zY5j7p+3V+PkCbS8BWn0NJGxcOEQmVhSEDIQPNqS4TRX 4Q94Z2Yuf+05Da8IPne9EYS3zAYyCGKktWmdn8ZP2W86WC0xvkt78/tyMBSFPTwLRH9R pC9Xkw4A+nluDDVgbgMUSQXCjPJWvJEZ1rNblvElKzDLHtbta7aaObCfdSmua2r/X/nY B3FDtWKT+aLZlO9e+mqCRAekHS3BsW7aho7nZKHF+1U3iQ5JjcQBUKPLXlppZ08WryrD 3s4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=gP77njr4oUyKRoz1Fu5MTHVzEOmqEJmj6ZPeg9NNm0g=; b=QkWSfxycrfF6WaOq2ZJfmDQkRIB4LAzZOsRC3zEzzZoKzA5NyVuPuF7QBx1nagEIYX tGumm87XRKHGelXvlNq1xYF789sWBr6jUgTUSpH1ql00zqyIggUGsnCa7gprc04mr6tW HuwbJFUG0f1kS2dcoQSdP7IcDvgUthvLpDlACrGbA4osh+8k5udS8LBXDjPODDPpAOQj /NkYAmDr0wvQ1bK1EKNB/mrbBYgttCmaIs3vsTOcfWlGDi+7XdIvsbNeby4e2Q0XQyef FkAKRvbyHFNlxXiyULqMl4VleCZ/DT1gJG3qrjDMH0yMAWqWxMJmU7mvJj6jGyXaDLk/ n9XA== X-Gm-Message-State: AEkoouuUiTw8+1kBGClVNuUrfqMHDYgQfYFEcP97ZnszNr/21ALDBbDjQX2Yu/ZCaDb+cVcPPQAFSL9/k18zRw== X-Received: by 10.36.150.70 with SMTP id z67mr8660240itd.80.1471655170683; Fri, 19 Aug 2016 18:06:10 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.36.141.129 with HTTP; Fri, 19 Aug 2016 18:06:09 -0700 (PDT) In-Reply-To: References: From: Adrian Chadd Date: Fri, 19 Aug 2016 18:06:09 -0700 X-Google-Sender-Auth: k9HQT0VWwx55cwS3YrSFNcjiRBA Message-ID: Subject: Re: kernel using gcc-5.3 fails to boot right To: Warner Losh Cc: "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2016 01:06:11 -0000 [snip] http://people.freebsd.org/~adrian/mips/20160819-mips-elf-reloc-gcc-5.3-3.diff This has the debugging output removed and includes the relevant bits from the current "authoritative" (as far as I'm aware) documentation on what MIPS relocations are doing, including the GNU "extensions". I say extensions because binutils says this: /* The combined value is the sum of the HI16 addend, left-shifted by sixteen bits, and the LO16 addend, sign extended. (Usually, the code does a `lui' of the HI16 value, and then an `addiu' of the LO16 value.) Scan ahead to find a matching LO16 relocation. According to the MIPS ELF ABI, the R_MIPS_LO16 relocation must be immediately following. However, for the IRIX6 ABI, the next relocation may be a composed relocation consisting of several relocations for the same address. In that case, the R_MIPS_LO16 relocation may occur as one of these. We permit a similar extension in general, as that is useful for GCC. In some cases GCC dead code elimination removes the LO16 but keeps the corresponding HI16. This is strictly speaking a violation of the ABI but not immediately harmful. */ ... -adrian