From owner-freebsd-mips@freebsd.org Mon Oct 1 20:40:55 2018 Return-Path: Delivered-To: freebsd-mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0890110AA0DF for ; Mon, 1 Oct 2018 20:40:55 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 993B58C0BF for ; Mon, 1 Oct 2018 20:40:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 57A7810AA0BA; Mon, 1 Oct 2018 20:40:54 +0000 (UTC) Delivered-To: mips@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 462E810AA0B8 for ; Mon, 1 Oct 2018 20:40:54 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAA6C8C0B8 for ; Mon, 1 Oct 2018 20:40:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 2F0AD11B7C for ; Mon, 1 Oct 2018 20:40:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w91Ker7Q052787 for ; Mon, 1 Oct 2018 20:40:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w91Ker3j052786 for mips@FreeBSD.org; Mon, 1 Oct 2018 20:40:53 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: mips@FreeBSD.org Subject: [Bug 231790] objcopy: corrupts relocation entries in big-endian mips64 output when adjusting symbol indexes Date: Mon, 01 Oct 2018 20:40:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: regression X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: emaste@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: mips@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 20:40:55 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D231790 --- Comment #7 from Ed Maste --- In create_file() we create the output ELF object with elf_begin(..., ELF_C_WRITE_, ...). It calls _libelf_open_object where we default to the host's endianness for e_byteorder: e->e_byteorder =3D LIBELF_PRIVATE(byteorder); We set the output elf header endianness as appropriate: if (ecp->oed =3D=3D ELFDATANONE) ecp->oed =3D ieh.e_ident[EI_DATA]; oeh.e_ident[EI_DATA] =3D ecp->oed; Then the oeh is passed to gelf_update_ehdr, but it does not update e_byteor= der; this is done in _libelf_resync_elf(). There are several ways this could be addressed - I'm not sure what's best o= ff hand, but updating e_byteorder in gelf_update_ehdr might be the easiest short-term fix. --=20 You are receiving this mail because: You are the assignee for the bug.=