mirror of
https://github.com/apache/nuttx.git
synced 2026-08-14 08:53:15 +00:00
Implement architecture-specific ELF header definitions and relocation handling for the MIPS architecture to enable loadable modules. Fixes #19178. Changes include: - Add `arch/mips/include/elf.h` with MIPS ELF relocation types and architecture-specific ELF data structures (`arch_elfdata_s`). - Implement `libs/libc/machine/mips/arch_elf.c` containing `up_checkarch`, `up_relocate`, and `up_relocateadd` functions handling `R_MIPS_NONE`, `R_MIPS_32`, `R_MIPS_26`, `R_MIPS_HI16`, and `R_MIPS_LO16` relocations. - Integrate MIPS machine-specific C library support in `libs/libc/machine/mips/Make.defs`. - Update `LDMODULEFLAGS` in `arch/mips/src/mips32/Toolchain.defs` to include the little-endian (`-EL`) flag. - Update `up_coherent_dcache` for proper cache synchronization on JZ4780. Signed-off-by: Lwazi Dube <lwazeh@gmail.com>
62 lines
1.9 KiB
C
62 lines
1.9 KiB
C
/****************************************************************************
|
|
* arch/mips/include/elf.h
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership. The
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
* "License"); you may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations
|
|
* under the License.
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef __ARCH_MIPS_INCLUDE_ELF_H
|
|
#define __ARCH_MIPS_INCLUDE_ELF_H
|
|
|
|
/****************************************************************************
|
|
* Pre-processor Definitions
|
|
****************************************************************************/
|
|
|
|
#define R_MIPS_NONE 0
|
|
#define R_MIPS_32 2
|
|
#define R_MIPS_26 4
|
|
#define R_MIPS_HI16 5
|
|
#define R_MIPS_LO16 6
|
|
|
|
#define MIPS_HI16_COUNT 10
|
|
#define ARCH_ELFDATA 1
|
|
|
|
/****************************************************************************
|
|
* Private Data Types
|
|
****************************************************************************/
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
struct arch_elfdata_s
|
|
{
|
|
struct hi_rel_s
|
|
{
|
|
Elf_Addr ahi;
|
|
Elf32_Addr *p;
|
|
}
|
|
hi[MIPS_HI16_COUNT];
|
|
int pos;
|
|
|
|
Elf_Addr ahi; /* The newest ahi */
|
|
};
|
|
|
|
typedef struct arch_elfdata_s arch_elfdata_t;
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* __ARCH_MIPS_INCLUDE_ELF_H */
|