diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2012-03-29 13:30:31 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2012-05-25 12:48:22 -0400 |
commit | 1efea40d4172a2a475ccb29b59d6221e9d0c174b (patch) | |
tree | 8152b61bb3fa83eb3403bca5cb05731c1063e999 /arch/tile/kernel/module.c | |
parent | 73636b1aacb1a07e6fbe0d25e560e69b024a8e25 (diff) |
arch/tile: support building big-endian kernel
The toolchain supports big-endian mode now, so add support for building
the kernel to run big-endian as well.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/kernel/module.c')
-rw-r--r-- | arch/tile/kernel/module.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/tile/kernel/module.c b/arch/tile/kernel/module.c index 98d476920106..001cbfa10ac6 100644 --- a/arch/tile/kernel/module.c +++ b/arch/tile/kernel/module.c | |||
@@ -159,7 +159,17 @@ int apply_relocate_add(Elf_Shdr *sechdrs, | |||
159 | 159 | ||
160 | switch (ELF_R_TYPE(rel[i].r_info)) { | 160 | switch (ELF_R_TYPE(rel[i].r_info)) { |
161 | 161 | ||
162 | #define MUNGE(func) (*location = ((*location & ~func(-1)) | func(value))) | 162 | #ifdef __LITTLE_ENDIAN |
163 | # define MUNGE(func) \ | ||
164 | (*location = ((*location & ~func(-1)) | func(value))) | ||
165 | #else | ||
166 | /* | ||
167 | * Instructions are always little-endian, so when we read them as data, | ||
168 | * we have to swap them around before and after modifying them. | ||
169 | */ | ||
170 | # define MUNGE(func) \ | ||
171 | (*location = swab64((swab64(*location) & ~func(-1)) | func(value))) | ||
172 | #endif | ||
163 | 173 | ||
164 | #ifndef __tilegx__ | 174 | #ifndef __tilegx__ |
165 | case R_TILE_32: | 175 | case R_TILE_32: |