From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24297 invoked by alias); 10 Dec 2018 02:43:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 24288 invoked by uid 89); 10 Dec 2018 02:43:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=3.5 required=5.0 tests=BAYES_05,BODY_8BITS,FREEMAIL_FROM,GARBLED_BODY,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=HX-Received:a02, H*Ad:U*joseph, sk:zongbox, H*r:ip*209.85.166.194 X-HELO: mail-it1-f194.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=KtHKVx1gBcuCrHJLFnkOlQyfUKwC6YxEq/3I5AoOLxg=; b=ti8UuQ5/ZNGZSqn1J8SpPAOxfwNXP5aSJB+34a/ZBzccazsPeXt3EeHIOPTvtsdsH9 y9Ll6X1oE3/Ov/0WW0WZFJ0ta0aWjIdbhMQu34seMCU0QjLJi3HFYldAsuWMmCrdYbkX 3uGZXJSx94VTZhZcWglE+7/PhzQh8gscVYEcAlVwVkBfRhnO/1L4DEHgkUEztwnKAmlb xpizyAN4olZEDdES3+yTmATh9TaVFN5/j64SM/tP6b1H1Pfc7+axBIjvvVqBNCY82oT0 MBYJ0nuSARdwSj5KT4Yrso5G2S0Y1orMZwO7UTtogUUi9QqqgRWbfC/gJSSSELw7X2S8 +F+Q== MIME-Version: 1.0 References: In-Reply-To: From: Zong Li Date: Mon, 10 Dec 2018 02:45:00 -0000 Message-ID: Subject: Re: [PATCH v4 03/10] RISC-V: Add path of library directories for the 32-bit To: dj@redhat.com Cc: joseph@codesourcery.com, Palmer Dabbelt , darius@bluespec.com, Andrew Waterman , libc-alpha@sourceware.org, Zong Li Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-SW-Source: 2018-12/txt/msg00295.txt.bz2 DJ Delorie =E6=96=BC 2018=E5=B9=B412=E6=9C=888=E6=97=A5 =E9= =80=B1=E5=85=AD =E4=B8=8A=E5=8D=886:18=E5=AF=AB=E9=81=93=EF=BC=9A > > > As much as I hate code duplication, I think we need separate macros for > 64 and 32 bit targets, else the 32-bit linker will search 64-bit > libraries and the 64-bit linker will search 32-bit libraries. While the > linker should be smart enough to skip incompatible libraries, it's > expensive to do so, and certainly "unexpected" from a developer's point > of view. Make sense. It should be separated for rv32 and rv64. > Zong Li writes: > > @@ -51,7 +53,14 @@ > > size_t len =3D strlen (dir); = \ > > char path[len + 9]; \ > > memcpy (path, dir, len + 1); \ > > - if (len >=3D 12 && ! memcmp(path + len - 12, "/lib64/lp64d", 12)= ) \ > > + if (len >=3D 13 && ! memcmp(path + len - 13, "/lib32/ilp32d", 13= )) \ > > + { \ > > + len -=3D 9; = \ > > + path[len] =3D '\0'; = \ > > + } \ > > + if (len >=3D 12 = \ > > + && (! memcmp(path + len - 12, "/lib32/ilp32", 12) \ > > + || ! memcmp(path + len - 12, "/lib64/lp64d", 12))) \ > > { \ > > len -=3D 8; = \ > > path[len] =3D '\0'; = \ > > @@ -64,6 +73,10 @@ > > add_dir (path); = \ > > if (len >=3D 4 && ! memcmp(path + len - 4, "/lib", 4)) = \ > > { \ > > + memcpy (path + len, "32/ilp32d", 10); \ > > + add_dir (path); \ > > + memcpy (path + len, "32/ilp32", 9); \ > > + add_dir (path); \ > > memcpy (path + len, "64/lp64d", 9); \ > > add_dir (path); \ > > memcpy (path + len, "64/lp64", 8); \