[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] xen/riscv: add EMBEDDED_EXTRA_CFLAGS to CFLAGS


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 16 Mar 2023 14:54:13 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wb17+LzZElRJyCFvA7B6zLYsmWnVZwBMBmAEEr+v5zM=; b=d4p4DlJloJ/b8MOdRZO5YbY/EkeDxf2Osmqy6EDokpaltue4TOBvGKtMCunAD86lIns8FqkcWv2EYL4bEotTcj1vJCvky9neFNW7lP21Ahc+WbpAOA99FDoI5jCAI3UUh1Kxr15rWqcnAVHDEQNoClMpm9oK22l8dDGxxPB3gOSvswaETh+xmA2jpmgOgY+8oICWaQQ37X1OMxEydIoNlIIfJXqhHv9i5GMk6rhPm4aMP+XeX9tjQmmgFIrQ6HF1wZ1VpHVjGCnm/9Y2QLX+sK95kUlVwXXWIi3X97xXLPjv087QP4Hta30TtuaQl9O6HLJhnXevO6IxR/DhaL/JkQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=buCEHxvfxECAy9kY/uILWEQluXAVZiY8Q908G0GWTQcx1dAvLAixs5GnSjTfnAvnT1ZAm6RV1AG2P8AufO5FPGgHZ3oYuq7MCSG+p+BGDDkm3+8l/pNtdzuv9RjPH1GUqoq4MaFv5ySEhN+Cx/LGb95oRGNuhk7gKFnEn/UpnV5w69kIp0+YuNP3wVPTkCO6oIpY8RArFiWH3ZCB5aZhjHLqOYglVKomKxZOw2oJrqvfEt88MzDz1lrOQ24r8Hhvk2ucl3O6FtNTj5Z22TgFXR8BwfeX7/XlVyuRusyiottBmDuyX1iAHeqE6Q8ZLKkEYhgbHId68tkzkjpPQ/kWVQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Gianluca Guida <gianluca@xxxxxxxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 16 Mar 2023 13:54:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.03.2023 14:22, Oleksii Kurochko wrote:
> The patch is needed to keep all address of cpu0_boot_stack
> PC-relative.
> 
> Pseudoinstruction 'la' can be transformed to 'auipc/addi' or
> 'auipc/l{w|d}'. It depends on the .option directive: nopic and pic
> or compiler flags.
> 
> Right now, 'la' transforms to 'auipc/l{w|d}', which in case of
> cpu0_boot_stack[] will lead to the usage of _GLOBAL_OFFSET_TABLE_
> where all addresses will be without counting that it might happen
> that linker address != load address ( so addresses inside got
> sections will be relative to linker time ).
> 
> It happens becuase the compiler from riscv64 docker compiled with
> --enable-default-pie:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -v
>   Using built-in specs.
>   COLLECT_GCC=riscv64-linux-gnu-gcc
>   COLLECT_LTO_WRAPPER=/usr/lib/gcc/riscv64-linux-gnu/12.2.0/lto-wrapper
>   Target: riscv64-linux-gnu
>   Configured with: /build/riscv64-linux-gnu-gcc/src/gcc-12.2.0/configure
>   --prefix=/usr --program-prefix=riscv64-linux-gnu- --with-local-
>   prefix=/usr/riscv64-linux-gnu --with-sysroot=/usr/riscv64-linux-gnu --
>   with-build-sysroot=/usr/riscv64-linux-gnu --libdir=/usr/lib --
>   libexecdir=/usr/lib --target=riscv64-linux-gnu --host=x86_64-pc-linux-
>   gnu --build=x86_64-pc-linux-gnu --with-system-zlib --with-isl --with-
>   linker-hash-style=gnu --disable-nls --disable-libunwind-exceptions --
>   disable-libstdcxx-pch --disable-libssp --disable-multilib --disable-
>   werror --enable-languages=c,c++ --enable-shared --enable-threads=posix
>   --enable-__cxa_atexit --enable-clocale=gnu --enable-gnu-unique-object -
>   -enable-linker-build-id --enable-lto --enable-plugin --enable-install-
>   libiberty --enable-gnu-indirect-function --enable-default-pie --enable-
>   checking=release
>   Thread model: posix
>   Supported LTO compression algorithms: zlib zstd
>   gcc version 12.2.0 (GCC)
> 
> Looking at gcc spec file for the RISC-V architecture:
>   [user@49295ae49cbe build]$ riscv64-linux-gnu-gcc -dumpspecs | grep -i
>   pic
>   --traditional-format %(subtarget_asm_debugging_spec) %{fno-pie|fno-
>   PIE|fno-pic|fno-PIC:;:-fpic} %{march=*} %{mabi=*} %{mno-relax} %{mbig-
>   endian} %{mlittle-endian} %(subtarget_asm_spec)%{misa-spec=*}
> which means that -fpic is enabled if none of the following options are
> present on the command line:
>     -fno-pie
>     -fno-PIE
>     -fno-pic
>     -fno-PIC
> 
> That's the reasons why 'la' is transformed to 'aupic/l{w|d} GOT' and
> not be dependent on the toolchain used.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

There may also want to be Suggested-by to both Andrew and me.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.