On Sat, Dec 10, 2016 at 06:14:11PM +0100, Patrick Wildt wrote:
> On Sat, Dec 10, 2016 at 11:23:54AM +1100, Jonathan Gray wrote:
> > On Tue, Dec 06, 2016 at 06:31:59PM +0100, Patrick Wildt wrote:
> > > Hi,
> > > 
> > > now that we have an AArch64-capable toolchain for our arm64 efforts, we
> > > can start compiling 64-bit u-boots.  Instead of creating another port
> > > for that we can make u-boot create different packages depending on the
> > > flavor.
> > > 
> > > To upgrade from u-boot to u-boot-arm we'd need a Quirk as well.
> > > 
> > > Patrick
> > 
> > Setting FULLPKGNAME like that allows both FLAVORS to be installed
> > at the same time?  The pine64 discussions on the u-boot list seem
> 
> Yes, exactly.  The idea was to be able to be able to use both at the
> same time.
> 
> > to be going in the direction of a 32 bit config for the SPL while
> > still only having a 64 bit target for the main u-boot image.
> > 
> > And 'make update-plist' would additionally need
> > 'FLAVOR=aarch64 make update-list' when updating u-boot?
> 
> Yes, that's true.  One pass with ARM, copy the list to PFRAG.arm,
> another pass with aarch64, copy the list to PFRAG.aarch64.  It's
> a bit of a hassle.

The relocate-rela.c patch won't work right on big endian systems
as __BYTE_ORDER and __LITTLE_ENDIAN won't be defined unless
u-boot's compiler.h is included.

I'm ok with your diff if you instead use the following,
which I'll try submit upstream:

$OpenBSD$
--- tools/relocate-rela.c.orig  Tue Dec  6 10:36:23 2016
+++ tools/relocate-rela.c       Sun Dec 11 14:15:57 2016
@@ -15,6 +15,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "compiler.h"
 
 #ifndef R_AARCH64_RELATIVE
 #define R_AARCH64_RELATIVE     1027
@@ -50,40 +51,6 @@ static bool supported_rela(Elf64_Rela *rela)
        }
 }
 
-static inline uint64_t swap64(uint64_t val)
-{
-       return ((val >> 56) & 0x00000000000000ffULL) |
-              ((val >> 40) & 0x000000000000ff00ULL) |
-              ((val >> 24) & 0x0000000000ff0000ULL) |
-              ((val >>  8) & 0x00000000ff000000ULL) |
-              ((val <<  8) & 0x000000ff00000000ULL) |
-              ((val << 24) & 0x0000ff0000000000ULL) |
-              ((val << 40) & 0x00ff000000000000ULL) |
-              ((val << 56) & 0xff00000000000000ULL);
-}
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-static inline uint64_t be64(uint64_t val)
-{
-       return swap64(val);
-}
-
-static inline uint64_t le64(uint64_t val)
-{
-       return val;
-}
-#else
-static inline uint64_t le64(uint64_t val)
-{
-       return swap64(val);
-}
-
-static inline uint64_t be64(uint64_t val)
-{
-       return val;
-}
-#endif
-
 static bool read_num(const char *str, uint64_t *num)
 {
        char *endptr;
@@ -148,9 +115,9 @@ int main(int argc, char **argv)
                        return 4;
                }
 
-               swrela.r_offset = le64(rela.r_offset);
-               swrela.r_info = le64(rela.r_info);
-               swrela.r_addend = le64(rela.r_addend);
+               swrela.r_offset = cpu_to_le64(rela.r_offset);
+               swrela.r_info = cpu_to_le64(rela.r_info);
+               swrela.r_addend = cpu_to_le64(rela.r_addend);
 
                if (!supported_rela(&swrela))
                        continue;

Reply via email to