You shouldn't need this any more. This tool was written at a time when
the released toolchain did not know about the new ELF flag yet, and we
needed something to fill the gap. The LLVM release you are using does
add this flag itself as appropriate (i.e. when building purecap binaries).

You are right, I have just checked this with readelf, again thank you for updating me.
I shall remove the patcher in V2.

I think that the busybox 1.5 makefile is still using the patcher as well:
https://git.morello-project.org/morello/morello-busybox/-/blob/morello-release-1.5.0/Makefile#L145

Kind regards,
Pawel


On Wed, 4 Jan 2023 at 10:21, Kevin Brodsky <kevin.brodsky@arm.com> wrote:
On 20/12/2022 16:29, Pawel Zalewski wrote:
> Add native recipe for the elf patcher.
>
> Signed-off-by: Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>
> ---
>  .../elf-patcher/elf-patcher-1.5-native.bb     |  4 +++
>  .../elf-patcher/elf-patcher-native.inc        | 34 +++++++++++++++++++
>  2 files changed, 38 insertions(+)
>  create mode 100644 recipes-devtools/elf-patcher/elf-patcher-1.5-native.bb
>  create mode 100644 recipes-devtools/elf-patcher/elf-patcher-native.inc
>
> diff --git a/recipes-devtools/elf-patcher/elf-patcher-1.5-native.bb b/recipes-devtools/elf-patcher/elf-patcher-1.5-native.bb
> new file mode 100644
> index 0000000..80a9a52
> --- /dev/null
> +++ b/recipes-devtools/elf-patcher/elf-patcher-1.5-native.bb
> @@ -0,0 +1,4 @@
> +require elf-patcher-native.inc
> +
> +LIC_FILES_CHKSUM  = "file://LICENSE;md5=30c1e44ff81caee33ce2f777440df394"
> +SRCBRANCH         = "morello/release-1.5"
> diff --git a/recipes-devtools/elf-patcher/elf-patcher-native.inc b/recipes-devtools/elf-patcher/elf-patcher-native.inc
> new file mode 100644
> index 0000000..871be9c
> --- /dev/null
> +++ b/recipes-devtools/elf-patcher/elf-patcher-native.inc
> @@ -0,0 +1,34 @@
> +inherit llvm-morello-native native
> +
> +SUMMARY      = "Elf-patcher"
> +DESCRIPTION  = "Tool for paching up elf e_flag with EF_AARCH64_CHERI_PURECAP"

You shouldn't need this any more. This tool was written at a time when
the released toolchain did not know about the new ELF flag yet, and we
needed something to fill the gap. The LLVM release you are using does
add this flag itself as appropriate (i.e. when building purecap binaries).

Kevin

> +HOMEPAGE     = "http://llvm.org"
> +LICENSE      = "BSD-3-Clause"
> +OUTPUTS_NAME = "elf-patcher"
> +
> +PROVIDES     = "virtual/${OUTPUTS_NAME}-native"
> +
> +SRC_URI = " \
> +    git://git.morello-project.org/morello/morello-aarch64;protocol=https;branch=${SRCBRANCH} \
> +    "
> +DEPENDS:remove  = " virtual/elf-patcher-native virtual/musl-morello-libs-native"
> +
> +SRCREV        = "${AUTOREV}"
> +PV            = "${PN}+git${SRCPV}"
> +
> +S             = "${WORKDIR}/git"
> +S-elf-patcher = "${WORKDIR}/git/morello/tools"
> +
> +FILES:${PN}   = "${bindir}/${OUTPUTS_NAME}"
> +
> +do_configure[noexec] = "1"
> +
> +do_compile(){
> +    mkdir -p ${B}/${OUTPUTS_NAME}
> +    ${CC} -o ${B}/${OUTPUTS_NAME}/${OUTPUTS_NAME} ${S-elf-patcher}/morello_elf.c
> +}
> +
> +do_install(){
> +    install -d ${D}${bindir}
> +    install -m 0744 ${S}/${OUTPUTS_NAME}/${OUTPUTS_NAME} ${D}${bindir}/${OUTPUTS_NAME}
> +}
> \ No newline at end of file