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

Scott Wood scottwood at freescale.com
Tue Oct 8 17:06:07 CEST 2013


On Tue, 2013-10-08 at 22:22 +0800, FengHua wrote:
> > 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?

A newer host elf.h should fix this, but if it's going to be a problem
maybe we should just define it ourselves (value is 1027).

-Scott





More information about the U-Boot mailing list