From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=SNBc4yS1; spf=pass (domain: linaro.org, ip: 209.85.221.65, mailfrom: leif.lindholm@linaro.org) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by groups.io with SMTP; Thu, 26 Sep 2019 13:50:45 -0700 Received: by mail-wr1-f65.google.com with SMTP id l3so293050wru.7 for ; Thu, 26 Sep 2019 13:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kTlzMujctZx8z/6EIlhhUX9aSGwx47T9tTM7OaDP4Kg=; b=SNBc4yS1aYXx2OUMlGCqKc9qa2LGvmk5Hgb5fIvdBv0J1SScprJr6NtPlJz1lUmS4e dhYrjuTTRdTEtkotOHsoZ/pqo28S2qO6DlKH4Frw422DxfqeGpZdbfaCtd9mbQqiY+fB 43P6leNnGXPE4EzCKc5lBbNLCssvJ0b814s1qJqrAnFtYuMRsJ5hUfoehWtQ6r5glaDb oZVtjKMU4+ETw+Tl8Bs+KX1LUZxJqGDJB0WcxZHdt8FUm4j7d56xEvAHv3Gmd+hkP8hx QdsuS15YRnC7ll2DoXVhpvgzAeWejkTRZeYGD/t7JtuFd805iWsEq3iwyeQNgtx9VnB4 QRag== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kTlzMujctZx8z/6EIlhhUX9aSGwx47T9tTM7OaDP4Kg=; b=r57HXBIfCvHZKEl6oZj7NB6fDGuYCaDV3MFtrQxOg+pQy82XKcLZ6UrXbeAXOxXhZN RZCS+oGdYo8ofiaYoP0qtS7DMBF7/oIpodnnXEdhoLFXrykF0QRb5QQ9hJTmaDICVY5O l1M3qrbkQtfN2VF5I+H37E97W1FCBo+WKkINMks7+tzUKJqQPjLCEWFfp+lTdFKUDHM2 mmJCitEtWGwdbsN7wKqjXyLhCFdIS1hTv2RYGy31OhzOKMHmhCD/bfLR9614EGDQ6pC9 GClZAJ1iYaOWL7x0bROF0KSGcVNqnzIbDPeJ6SaNiaeIDCUKwfS4960gD7jMCM9TEu4/ MdYg== X-Gm-Message-State: APjAAAVSUeRi+ySZng6F3q7xnxPwzitmtBjLZtZyHUmNkO9/UZF88RHK PxuwazsXrPD1YB6ATQAsRsD7Y3WTyFfOHA== X-Google-Smtp-Source: APXvYqwUq64CHVP8czPyy92QjuJUVsSCzsZ8knYc2NOgke+nJP8w7gnt3uy17v2dmc5yuZozr4ttTQ== X-Received: by 2002:a5d:5111:: with SMTP id s17mr240420wrt.59.1569531042904; Thu, 26 Sep 2019 13:50:42 -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 i5sm2300023wmd.21.2019.09.26.13.50.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 13:50:41 -0700 (PDT) Date: Thu, 26 Sep 2019 21:50:40 +0100 From: "Leif Lindholm" To: devel@edk2.groups.io, abner.chang@hpe.com Subject: Re: [edk2-devel] [edk2-staging/RISC-V-V2 PATCH v2 25/29] BaseTools/Scripts Message-ID: <20190926205040.GU28454@bivouac.eciton.net> References: <1569198715-31552-1-git-send-email-abner.chang@hpe.com> <1569198715-31552-27-git-send-email-abner.chang@hpe.com> MIME-Version: 1.0 In-Reply-To: <1569198715-31552-27-git-send-email-abner.chang@hpe.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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? 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? > + *(.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 > > > >