From owner-freebsd-mips@freebsd.org Sat Aug 20 00:27:20 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 561ECBBE577 for ; Sat, 20 Aug 2016 00:27:20 +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 1DAC41702 for ; Sat, 20 Aug 2016 00:27:20 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id x131so42780798ite.0 for ; Fri, 19 Aug 2016 17:27:20 -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=hk3rBno7KN9VAUKuxt+AHDTHBnJL4NdAmMTat9kUW+I=; b=Aq5i2UB8CWgThTzSBp0zPyqZ5sb42aZP1qUBA4936BGF1hDAOFehniDONw+HYHQH9p UJ8sgAaMRAYaGFojINrZbv3o/fkLogSjGA8AjFTGLIMr6lCHTXe2c1I3d+T5s0NALGku f7E7MDQEE3HubvukFm3zE/JosDFZFEPDGgRfVH/hsTmTO0+vxjLrAkup//ZEM/RgE/pH X3IFUCKDEN13DbNdGco3byC4iQQoKfcXXPLMM58bXq2cLuiMEsohkOp6xqWRCLdh1HWu n3ZNXfUSs3s2EI2GCNROVi0TBbAUul/hQx53DsOhGlQP1wdjhYk02SlRzgv6l2W/nSYI owxg== 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=hk3rBno7KN9VAUKuxt+AHDTHBnJL4NdAmMTat9kUW+I=; b=QVx3khHVTUVKr2KqoRBGzmQmiRsogZ/Rdix5nZFVlzYaZpWzIYQ57c5oHzONAkMJ2R M+kmIx2+sBpwOKMvq/9N/HJedEqHbBgZ/6yyzq4VWLgtcgF9qw+8v4aBKc6YYemlFZU+ OJovP4FF9jk59HdeLnnOAsiox9ZSqQHULHdmhKV+G0iWp53en3amRfQ4Kppkkc3iCnVo abpvDjoGcUP5FcquU/G1wbyYt7x95uZl5S213kyaab4UO4bxQCMbohGDW51s+pxXXMoC g6gWIx4POF2OMeH2LEDq+0otmVp+QbahDnqXJPfiV/z9LBqWPZO4ALc86FzdximzipJQ 5xaA== X-Gm-Message-State: AEkoouv4b8ihPCyhb83N+7hzzoufpI4s2L4qRI26I/HAOi7uUNn74lW8l3PwFIywJRtUKMDupzezcvgHzgj9+Q== X-Received: by 10.36.242.68 with SMTP id j65mr8719363ith.25.1471652839526; Fri, 19 Aug 2016 17:27:19 -0700 (PDT) MIME-Version: 1.0 Sender: adrian.chadd@gmail.com Received: by 10.36.141.129 with HTTP; Fri, 19 Aug 2016 17:27:18 -0700 (PDT) In-Reply-To: References: From: Adrian Chadd Date: Fri, 19 Aug 2016 17:27:18 -0700 X-Google-Sender-Auth: oKlUsW6IAT1IwxTlPJCaDbGEIkI 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 00:27:20 -0000 On 17 August 2016 at 19:41, Warner Losh wrote: > On Wed, Aug 17, 2016 at 8:29 PM, Adrian Chadd wrote: >> thanks to warner, I went looking at relocation tables. >> >> It stems from how we're doing LO16/HI16 - we expect HI first, then LO >> - then we update where_hi16. This .. doesn't work in the new world. >> >> eg: >> >> 0000bf9c R_MIPS_HI16 ctl3_lock >> 0000bfa0 R_MIPS_LO16 ctl3_lock >> 0000bfa8 R_MIPS_HI16 M_IPFW >> 0000bfac R_MIPS_LO16 M_IPFW >> 0000bfb8 R_MIPS_LO16 .bss >> 0000bfa4 R_MIPS_HI16 __mtx_unlock_flags >> 0000bfcc R_MIPS_LO16 __mtx_unlock_flags > > A grep suggests we implement them for efl_machdep.c: > > sys/mips/mips/elf_machdep.c: case R_MIPS_HI16: /* ((AHL + S) - > ((short)(AHL + S)) >> 16 */ > sys/mips/mips/elf_machdep.c: case R_MIPS_LO16: /* AHL + S */ > > Might see if you can debug fro there. I'm a terrible, terrible person. http://people.freebsd.org/~adrian/mips/20160819-mips-elf-reloc-gcc-5.3-1.diff It's a totally terrible diff that needs tidying up, but it verifies the basic functionality seems to work. I'd appreciate some initial comments/feedback so I can tidy it up enough to get a more formal review. Yes, it boots up and loads my modules fine. A lot of the modules now trigger the log: kldload: can't load random: No such file or directory .. ipfw elf_reloc_internal: called; where=0xc01010a0; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc010111c; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc01016ac; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc0101680; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc010226c; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc0101f44; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc0101750; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0101760; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0101794; LO16 REL with no HI16 first ... ipfw2 initialized, divert loadable, nat loadable, default to accept, logging disabled .. libalias elf_reloc_internal: called; where=0xc01245d4; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0124674; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0124720; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc01247d4; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0125064; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc012504c; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc0125014; HI16 REL with no LO16 first elf_reloc_internal: called; where=0xc01274b0; LO16 REL with no HI16 first .. .. if_gif elf_reloc_internal: called; where=0xc01360dc; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc01361c4; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0136474; LO16 REL with no HI16 first elf_reloc_internal: called; where=0xc0137108; HI16 REL with no LO16 first .. etc > > Warner