From owner-svn-src-all@FreeBSD.ORG Tue Aug 10 07:08:16 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7F13106564A; Tue, 10 Aug 2010 07:08:16 +0000 (UTC) (envelope-from neelnatu@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id C19548FC08; Tue, 10 Aug 2010 07:08:15 +0000 (UTC) Received: by wyj26 with SMTP id 26so13561570wyj.13 for ; Tue, 10 Aug 2010 00:08:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Ma5J6S2FWrJV1ImJG4YMSCLceGRq3IMJGejMQE08Q0M=; b=LN+j23nZ00WkGGAEkyNZnPywWwVZu45vR90vGqDLnjivHEHbrIKBFQkLgaTCa6/nqZ HKtkD0bqWjD2WnQUSr8eC9922tXZzo7cH4p1PpxdHCrafOPxFrCgsC5mV+LPlrHMHuoJ WYzzz5FEnBrao+/rx31euK4iVrO0z9RYJ3xzo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=lJOmGiq8YEU9PW1e8P5D0Kai9XIYR5GrWHh8FRGN5O51V67IMM5b9fyK8FGEyJ/7B3 MgJ7N/fPNIaFob0sQsqonGVAMAxaQq8JSMil9AGjNnuOWk9AGl8qlj2nWI1WUKtdSHr8 c1cvmg8mrOrOpEkh3xSmPrxfe4Q2EznKvKXzQ= MIME-Version: 1.0 Received: by 10.216.167.205 with SMTP id i55mr3511060wel.17.1281422556429; Mon, 09 Aug 2010 23:42:36 -0700 (PDT) Received: by 10.216.80.8 with HTTP; Mon, 9 Aug 2010 23:42:36 -0700 (PDT) In-Reply-To: <20100810062829.GA1737@mole.fafoe.narf.at> References: <201008100515.o7A5FZZF017552@svn.freebsd.org> <20100810062829.GA1737@mole.fafoe.narf.at> Date: Mon, 9 Aug 2010 23:42:36 -0700 Message-ID: From: Neel Natu To: Stefan Farfeleder Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211130 - head/libexec/rtld-elf/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Tue, 10 Aug 2010 07:08:16 -0000 Hi Stefan, On Mon, Aug 9, 2010 at 11:28 PM, Stefan Farfeleder wr= ote: > On Tue, Aug 10, 2010 at 05:15:35AM +0000, Neel Natu wrote: >> Author: neel >> Date: Tue Aug 10 05:15:35 2010 >> New Revision: 211130 >> URL: http://svn.freebsd.org/changeset/base/211130 >> >> Log: >> =A0 Fix compilation error for 64-bit little endian build: >> =A0 libexec/rtld-elf/mips/reloc.c:196: warning: right shift count >=3D w= idth of type >> >> =A0 When the expression '(r_info) >> 32' was passed to bswap32() it was = promptly >> =A0 changed to '(uint32_t)(r_info) >> 32' which is not what we intended. > > Wouldn't it be better to fix the bswap32 macro instead? > I think you are right. Can you take a look at the following patch instead? If I hear no objections, I will commit it tomorrow. Index: libexec/rtld-elf/mips/reloc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libexec/rtld-elf/mips/reloc.c (revision 211131) +++ libexec/rtld-elf/mips/reloc.c (working copy) @@ -83,7 +83,7 @@ #undef ELF_R_SYM #undef ELF_R_TYPE #define ELF_R_SYM(r_info) ((r_info) & 0xffffffff) -#define ELF_R_TYPE(r_info) bswap32(((r_info) >> 32)) +#define ELF_R_TYPE(r_info) bswap32((r_info) >> 32) #endif #else #define ELF_R_NXTTYPE_64_P(r_type) (0) Index: sys/sys/endian.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/sys/endian.h (revision 211131) +++ sys/sys/endian.h (working copy) @@ -56,9 +56,9 @@ /* * General byte order swapping functions. */ -#define bswap16(x) __bswap16(x) -#define bswap32(x) __bswap32(x) -#define bswap64(x) __bswap64(x) +#define bswap16(x) __bswap16((x)) +#define bswap32(x) __bswap32((x)) +#define bswap64(x) __bswap64((x)) /* * Host to big endian, host to little endian, big endian to host, and litt= le best Neel >> Modified: >> =A0 head/libexec/rtld-elf/mips/reloc.c >> >> Modified: head/libexec/rtld-elf/mips/reloc.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 =A0Mon Aug =A09 23:32= :37 2010 =A0 =A0 =A0 =A0(r211129) >> +++ head/libexec/rtld-elf/mips/reloc.c =A0 =A0 =A0 =A0Tue Aug 10 05:15:3= 5 2010 =A0 =A0 =A0 =A0(r211130) >> @@ -75,7 +75,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn >> =A0 * ELF64 MIPS encodes the relocs uniquely. =A0The first 32-bits of in= fo contain >> =A0 * the symbol index. =A0The top 32-bits contain three relocation type= s encoded >> =A0 * in big-endian integer with first relocation in LSB. =A0This means = for little >> - * endian we have to byte swap that interger (r_type). >> + * endian we have to byte swap that integer (r_type). >> =A0 */ >> =A0#define =A0 =A0 =A0Elf_Sxword =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0Elf64_Sxword >> =A0#define =A0 =A0 =A0ELF_R_NXTTYPE_64_P(r_type) =A0 =A0 =A0((((r_type) = >> 8) & 0xff) =3D=3D R_TYPE(64)) >> @@ -83,7 +83,7 @@ void _rtld_relocate_nonplt_self(Elf_Dyn >> =A0#undef ELF_R_SYM >> =A0#undef ELF_R_TYPE >> =A0#define ELF_R_SYM(r_info) =A0 =A0 =A0 =A0 =A0 =A0((r_info) & 0xffffff= ff) >> -#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 bswap32((r_info) >> 32) >> +#define ELF_R_TYPE(r_info) =A0 =A0 =A0 =A0 =A0 bswap32(((r_info) >> 32)= ) >> =A0#endif >> =A0#else >> =A0#define =A0 =A0 =A0ELF_R_NXTTYPE_64_P(r_type) =A0 =A0 =A0(0) >> >