From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web12.1951.1571137213347925547 for ; Tue, 15 Oct 2019 04:00:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=Z60kFSMp; spf=pass (domain: linaro.org, ip: 209.85.128.66, mailfrom: leif.lindholm@linaro.org) Received: by mail-wm1-f66.google.com with SMTP id p7so20366646wmp.4 for ; Tue, 15 Oct 2019 04:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=zLT4360CirF9ZQKIlBxHxq7o3aVrUwB5UjpyU6NEFEE=; b=Z60kFSMp38DTjaBM9Qzn+dPDrw20P4GwJPwYUzoeLshZqDmqp31n+qaskRDARYQzyy nEg4Qie61M5cqo/KbMbeqWAfn1lxeQ4IyhAy0QLYHaWL+WLwgw3cDDp8RyIxE3aUXwop eZrZB10VMAJd13vuHM3RVsUuPxiFqhPZTNwbqmOwObFRQbn1a/ERfPuyNhFp05gi6SzC 0+zBTP9lIeQCew8bzBdHC4NCwM517sjM2DQGZs+QlKnbvU9Jq2xNkkv+r/xl0HDhGGQz 0iw+mphEawfd4OTVcAdo28f6OlwmwziMUFK5AFBHF0ZnkTDm/LvdJTtMGDTYxwQobhqj uQZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=zLT4360CirF9ZQKIlBxHxq7o3aVrUwB5UjpyU6NEFEE=; b=UZs7rWtZVH6CbHJMlScaD6ijEh7iWRn0RpIvdR9b/2l8jZFzY8lgyH+FVZTyDWG5GF 5uynz4dU4i/OqcsnHqpx+C60R9cXZRYrzdMsgllJYK/s7FeAMVRYn/1RFmby2vanVvD5 yZATEBs7PLZpNiCK79TvB7wq80dp2zYbo0nUv9eM14K7CHyPnmsZGorblxJiCrlsQJtA bNzK6ULlK080wgj1+x28nreWqH3zt+YL2sQPAY5gV10upxSF5XZTttsy/PHeVYIAFTC0 xirdnvRLDmho+k2VotR1OLoxRsqztrtCqi61PQ2Ij7oh/SPn2THwtXup7gSTc/CAOfSn +ehQ== X-Gm-Message-State: APjAAAVR8PMcLL1V6HGvDe+UBQ5IidJXraF7MW4VXIaWxWXfa1sIBmvv Jw3twpsku2PNj9mPwTNOsOekXQxAKtA= X-Google-Smtp-Source: APXvYqxr1rY3OusWzgLl05qoPn7L3SEO8LXq9eUKtyPphc+Zc7Z6fUYEuZ5BEHPWaUWRewnkw7u9ug== X-Received: by 2002:a7b:ce89:: with SMTP id q9mr18946113wmj.2.1571137211644; Tue, 15 Oct 2019 04:00:11 -0700 (PDT) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id 79sm33889279wmb.7.2019.10.15.04.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 04:00:10 -0700 (PDT) Date: Tue, 15 Oct 2019 12:00:09 +0100 From: "Leif Lindholm" To: "Chang, Abner (HPS SW/FW Technologist)" Cc: "devel@edk2.groups.io" Subject: Re: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 25/29] BaseTools/Scripts Message-ID: <20191015110009.GL25504@bivouac.eciton.net> References: <1569198715-31552-1-git-send-email-abner.chang@hpe.com> <1569198715-31552-27-git-send-email-abner.chang@hpe.com> <20190926205040.GU28454@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Oct 15, 2019 at 06:31:06AM +0000, Chang, Abner (HPS SW/FW Technologist) wrote: > > -----Original Message----- > > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > > Leif Lindholm > > Sent: Friday, September 27, 2019 4:51 AM > > To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist) > > > > Subject: Re: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 25/29] > > BaseTools/Scripts > > > > On Mon, Sep 23, 2019 at 08:31:51AM +0800, Abner Chang wrote: > > > Add RISC-V specific LD scripts. ."rela(INFO)" in the latest > > > GccBase.lds causes PE32 relocation error. > > > This is the temporaty solution untill we find the root casue. > > > > I presume you mean that having a separate version for RISCV is temporary? I > > am OK with this for now. However, the diff is not what I would expect. Can > > you verify that the difference is only what you actually need? > > Yes. Hope I can remove this change after I figuring out the toolchain issue. > > > For example: > > > > > Signed-off-by: Abner Chang > > > --- > > > BaseTools/Scripts/GccBaseRiscV.lds | 66 > > > ++++++++++++++++++++++++++++++++++++++ > > > 1 file changed, 66 insertions(+) > > > create mode 100644 BaseTools/Scripts/GccBaseRiscV.lds > > > > > > diff --git a/BaseTools/Scripts/GccBaseRiscV.lds > > > b/BaseTools/Scripts/GccBaseRiscV.lds > > > new file mode 100644 > > > index 0000000..7f9fae6 > > > --- /dev/null > > > +++ b/BaseTools/Scripts/GccBaseRiscV.lds > > > @@ -0,0 +1,66 @@ > > > +/** @file > > > + > > > + Unified linker script for GCC based builds > > > + > > > + Copyright (c) 2010 - 2015, Intel Corporation. All rights > > > + reserved.
Copyright (c) 2015, Linaro Ltd. All rights > > > + reserved.
Copyright (c) 2019, Hewlett Packard Enterprise > > > + Development LP. All rights reserved.
> > > + > > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > > + > > > +**/ > > > + > > > +SECTIONS { > > > + > > > + /* > > > + * The PE/COFF binary consists of DOS and PE/COFF headers, and a > > sequence of > > > + * section headers adding up to PECOFF_HEADER_SIZE bytes (which > > differs > > > + * between 32-bit and 64-bit builds). The actual start of the .text section > > > + * will be rounded up based on its actual alignment. > > > + */ > > > + . = PECOFF_HEADER_SIZE; > > > + > > > + .text : ALIGN(CONSTANT(COMMONPAGESIZE)) { > > > + *(.text .text.* .stub .gnu.linkonce.t.*) > > > + *(.rodata .rodata.* .gnu.linkonce.r.*) > > > + *(.got .got.*) > > > + > > > + /* > > > + * The contents of AutoGen.c files are constant from the POV of the > > program, > > > + * but most of its contents end up in .data or .bss by default since few of > > > + * the variable definitions that get emitted are declared as CONST. > > > + */ > > > > The above comment block looks completely different - in GccBase.lds: > > /* > > * The contents of AutoGen.c files are mostly constant from the POV of > > the > > * program, but most of it ends up in .data or .bss by default since few of > > * the variable definitions that get emitted are declared as CONST. > > * Unfortunately, we cannot pull it into the .text section entirely, since > > * patchable PCDs are also emitted here, but we can at least move all of > > the > > * emitted GUIDs here. > > */ > > > > > + *:AutoGen.obj(.data.g*Guid) > > > + } > > > + > > > + /* > > > + * The alignment of the .data section should be less than or equal to the > > > + * alignment of the .text section. This ensures that the relative offset > > > + * between these sections is the same in the ELF and the PE/COFF > > versions of > > > + * this binary. > > > + */ > > > + .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) > > { > > > + *(.data .data.* .gnu.linkonce.d.*) > > > + *(.bss .bss.*) > > > + } > > > + > > > + .eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : { > > > + KEEP (*(.eh_frame)) > > > + } > > > + > > > + .rela ALIGN(CONSTANT(COMMONPAGESIZE)) : { > > > > The above line is, I believe, the only necessary change for your workaround? > > Yes. only this line is necessary. I guess I copied entire lds file from my old edk2 tree. Yeah, that makes sense. If you can provide an updated version based on the current common .lds, I'm OK for that to go into the -staging branch. / Leif > > > > > + *(.rela .rela.*) > > > + } > > > + > > > > The original one as the following: > > .hii : ALIGN(CONSTANT(COMMONPAGESIZE)) { > > KEEP (*(.hii)) > > } > > > > I do not think including this could be the cause of any issues. > > > > Also, GccBase.lds includes here: > > /* > > * Retain the GNU build id but in a non-allocatable section so GenFw > > * does not copy it into the PE/COFF image. > > */ > > .build-id (INFO) : { *(.note.gnu.build-id) } > > > > > + /DISCARD/ : { > > > + *(.note.GNU-stack) > > > + *(.gnu_debuglink) > > > + *(.interp) > > > + *(.dynsym) > > > + *(.dynstr) > > > + *(.dynamic) > > > + *(.hash) > > > > In GccBase.lds: > > *(.hash .gnu.hash) > > > > / > > Leif > > > > > + *(.comment) > > > + *(COMMON) > > > + } > > > +} > > > -- > > > 2.7.4 > > > > > > > > > > > > > > > > >