[U-Boot] [PATCH 1/4] arm64: Add tool to statically apply RELA relocations

FengHua fenghua at phytium.com.cn
Tue Oct 8 16:22:12 CEST 2013


> diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c
> new file mode 100644
> index 0000000..47afe0b
> --- /dev/null
> +++ b/tools/relocate-rela.c
> @@ -0,0 +1,185 @@
> +/*
> + * Copyright 2013 Freescale Semiconductor, Inc.
> + *
> + * SPDX-License-Identifier:	GPL-2.0+ BSD-2-Clause
> + *
> + * 64-bit and little-endian target only until we need to support a different
> + * arch that needs this.
> + */
> +
> +#include <elf.h>
> +#include <errno.h>
> +#include <inttypes.h>
> +#include <stdarg.h>
> +#include <stdbool.h>
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +
> +static const bool debug_en;
> +
> +static void debug(const char *fmt, ...)
> +{
> +	va_list args;
> +
> +	va_start(args, fmt);
> +	if (debug_en)
> +		vprintf(fmt, args);
> +}
> +
> +static bool supported_rela(Elf64_Rela *rela)
> +{
> +	uint64_t mask = 0xffffffffULL; /* would be different on 32-bit */
> +	uint32_t type = rela->r_info & mask;
> +
> +	switch (type) {
> +#ifdef R_AARCH64_RELATIVE
> +	case R_AARCH64_RELATIVE:
> +		return true;
> +#endif

hi Scott,
     the R_AARCH64_RELATIVE is not deinfed in my system. Whether we should define it at somewhere?

David









More information about the U-Boot mailing list