You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/03/27 05:04:47 UTC
[incubator-nuttx] branch master updated (f807702 -> a493c92)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git.
from f807702 Introduce CONFIG_DEFAULT_TASK_STACKSIZE
new bd7829a modlib: Don't truncate 64-bit values
new bb09d56 libelf: Don't truncate 64-bit values
new 24c9fa3 Kconfig: Move ELF_64BIT out of !BINFMT_DISABLE
new c62f806 sim: modlib: Implement some x86_64 relocations
new 18c574d Config.mk: Provide the default MODULECC/MODULELD
new 748777e sim: MODULE definitions for macOS
new a493c92 sim: Use executable memory for the heap
The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
arch/sim/src/Makefile | 6 +
arch/sim/src/sim/up_allocateheap.c | 20 ++-
.../sim/src/sim/up_hostmemory.c | 28 ++--
arch/sim/src/sim/up_internal.h | 4 +
binfmt/Kconfig | 7 +
binfmt/libelf/Kconfig | 6 -
binfmt/libelf/libelf_symbols.c | 2 +-
boards/sim/sim/sim/configs/cxxtest/Make.defs | 12 ++
boards/sim/sim/sim/configs/nsh2/Make.defs | 12 ++
boards/sim/sim/sim/scripts/Make.defs | 12 ++
libs/libc/machine/sim/Make.defs | 12 +-
.../{xtensa/arch_elf.c => sim/arch_elf64.c} | 177 +++++++++------------
libs/libc/modlib/modlib_symbols.c | 2 +-
tools/Config.mk | 6 +
14 files changed, 175 insertions(+), 131 deletions(-)
copy boards/arm/xmc4/xmc4700-relax/src/xmc4_bringup.c => arch/sim/src/sim/up_hostmemory.c (78%)
copy libs/libc/machine/{xtensa/arch_elf.c => sim/arch_elf64.c} (59%)
[incubator-nuttx] 07/07: sim: Use executable memory for the heap
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit a493c92826fd0918231cbfe470e1cf9b48e96de3
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 13:58:26 2020 +0900
sim: Use executable memory for the heap
On modern environments, bss is not executable.
Alternatively we can use the ARCH_HAVE_MODULE_TEXT mechanism.
But it's considered overkill for the sim, which is mainly
for development.
---
arch/sim/src/Makefile | 6 +++++
arch/sim/src/sim/up_allocateheap.c | 20 ++++++++++++--
arch/sim/src/sim/up_hostmemory.c | 55 ++++++++++++++++++++++++++++++++++++++
arch/sim/src/sim/up_internal.h | 4 +++
4 files changed, 83 insertions(+), 2 deletions(-)
diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile
index a454caf..8d4376d 100644
--- a/arch/sim/src/Makefile
+++ b/arch/sim/src/Makefile
@@ -76,6 +76,12 @@ DEPPATH = $(patsubst %,--dep-path %,$(subst :, ,$(VPATH)))
HOSTSRCS = up_hosttime.c
+ifeq ($(CONFIG_LIBC_MODLIB),y)
+ HOSTSRCS += up_hostmemory.c
+else ifeq ($(CONFIG_BINFMT_LOADABLE),y)
+ HOSTSRCS += up_hostmemory.c
+endif
+
ifeq ($(CONFIG_STACK_COLORATION),y)
CSRCS += up_checkstack.c
endif
diff --git a/arch/sim/src/sim/up_allocateheap.c b/arch/sim/src/sim/up_allocateheap.c
index 980cda9..e9329a6 100644
--- a/arch/sim/src/sim/up_allocateheap.c
+++ b/arch/sim/src/sim/up_allocateheap.c
@@ -52,8 +52,6 @@
* Private Data
****************************************************************************/
-static uint8_t sim_heap[SIM_HEAP_SIZE];
-
/****************************************************************************
* Public Functions
****************************************************************************/
@@ -71,6 +69,24 @@ static uint8_t sim_heap[SIM_HEAP_SIZE];
void up_allocate_heap(void **heap_start, size_t *heap_size)
{
+ /* Note: Some subsystems like modlib and binfmt need to allocate
+ * executable memory.
+ */
+
+#if defined(CONFIG_LIBC_MODLIB) || defined(CONFIG_BINFMT_LOADABLE)
+ /* We make the entire heap executable here to keep
+ * the sim simpler. If it turns out to be a problem, the
+ * ARCH_HAVE_MODULE_TEXT mechanism can be an alternative.
+ */
+
+ uint8_t *sim_heap = host_alloc_heap(SIM_HEAP_SIZE);
+#else
+ /* This sim_heap would be placed in BSS, which is often not
+ * executable on modern environments.
+ */
+
+ static uint8_t sim_heap[SIM_HEAP_SIZE];
+#endif
*heap_start = sim_heap;
*heap_size = SIM_HEAP_SIZE;
}
diff --git a/arch/sim/src/sim/up_hostmemory.c b/arch/sim/src/sim/up_hostmemory.c
new file mode 100644
index 0000000..6c4345b
--- /dev/null
+++ b/arch/sim/src/sim/up_hostmemory.c
@@ -0,0 +1,55 @@
+/****************************************************************************
+ * arch/sim/src/sim/up_hostmemory.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <sys/mman.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: host_alloc_heap
+ *
+ * Description:
+ * Allocate executable memory for heap.
+ *
+ ****************************************************************************/
+
+void *host_alloc_heap(size_t sz)
+{
+ void *p;
+
+ p = mmap(NULL, sz, PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (p == MAP_FAILED)
+ {
+ perror("Failed to allocate heap with mmap");
+ exit(EXIT_FAILURE);
+ }
+
+ return p;
+}
diff --git a/arch/sim/src/sim/up_internal.h b/arch/sim/src/sim/up_internal.h
index d12a313..65b8d1f 100644
--- a/arch/sim/src/sim/up_internal.h
+++ b/arch/sim/src/sim/up_internal.h
@@ -224,6 +224,10 @@ volatile spinlock_t g_cpu_paused[CONFIG_SMP_NCPUS] SP_SECTION;
int up_setjmp(xcpt_reg_t *jb);
void up_longjmp(xcpt_reg_t *jb, int val) noreturn_function;
+/* up_hostmemory.c **********************************************************/
+
+void *host_alloc_heap(size_t sz);
+
/* up_hosttime.c ************************************************************/
uint64_t host_gettime(bool rtc);
[incubator-nuttx] 03/07: Kconfig: Move ELF_64BIT out of
!BINFMT_DISABLE
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 24c9fa3cd9f569ac4f4cd411e6272d80d2ed7d56
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 12:24:42 2020 +0900
Kconfig: Move ELF_64BIT out of !BINFMT_DISABLE
Because it's also used by LIBC_MODLIB.
---
binfmt/Kconfig | 7 +++++++
binfmt/libelf/Kconfig | 6 ------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/binfmt/Kconfig b/binfmt/Kconfig
index 15e878a..300a137 100644
--- a/binfmt/Kconfig
+++ b/binfmt/Kconfig
@@ -10,6 +10,13 @@ config BINFMT_DISABLE
By default, support for loadable binary formats is built. This logic
may be suppressed be defining this setting.
+config ELF_64BIT
+ bool "64bit ELF support"
+ default n
+ depends on (!BINFMT_DISABLE && ELF) || LIBC_MODLIB
+ ---help---
+ This option is used to load 64bit ELF files
+
if !BINFMT_DISABLE
config PATH_INITIAL
diff --git a/binfmt/libelf/Kconfig b/binfmt/libelf/Kconfig
index 3d13c71..859ae66 100644
--- a/binfmt/libelf/Kconfig
+++ b/binfmt/libelf/Kconfig
@@ -3,12 +3,6 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
-config ELF_64BIT
- bool "64bit ELF support"
- default n
- ---help---
- This option is used to load 64bit ELF files
-
config ELF_ALIGN_LOG2
int "Log2 Section Alignment"
default 2
[incubator-nuttx] 05/07: Config.mk: Provide the default
MODULECC/MODULELD
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 18c574d66a93442decb4ee4af046e8039ddb5782
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 11:24:03 2020 +0900
Config.mk: Provide the default MODULECC/MODULELD
In some cases, a separate toolchain is necessary to
build modules.
E.g. the sim on macOS, where the native format is Mach-O.
By default, just use CC/LD, which is appropriate for
the most of platforms.
---
tools/Config.mk | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/Config.mk b/tools/Config.mk
index 04cd151..1472ba5 100644
--- a/tools/Config.mk
+++ b/tools/Config.mk
@@ -363,3 +363,9 @@ define TESTANDREPLACEFILE
fi
endef
endif
+
+# Some defaults.
+# $(TOPDIR)/Make.defs can override these appropriately.
+
+MODULECC = $(CC)
+MODULELD = $(LD)
[incubator-nuttx] 06/07: sim: MODULE definitions for macOS
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 748777e3f5f61ccadefac19c0e32b25c13475e44
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 11:28:08 2020 +0900
sim: MODULE definitions for macOS
---
boards/sim/sim/sim/configs/cxxtest/Make.defs | 12 ++++++++++++
boards/sim/sim/sim/configs/nsh2/Make.defs | 12 ++++++++++++
boards/sim/sim/sim/scripts/Make.defs | 12 ++++++++++++
3 files changed, 36 insertions(+)
diff --git a/boards/sim/sim/sim/configs/cxxtest/Make.defs b/boards/sim/sim/sim/configs/cxxtest/Make.defs
index 633eed8..dfab860 100644
--- a/boards/sim/sim/sim/configs/cxxtest/Make.defs
+++ b/boards/sim/sim/sim/configs/cxxtest/Make.defs
@@ -86,6 +86,18 @@ else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
+# NuttX modules are ELF binaries.
+# Non-ELF platforms like macOS need to use a separate ELF toolchain.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ # eg. brew install x86_64-elf-gcc
+ MODULECC = x86_64-elf-gcc
+ MODULELD = x86_64-elf-ld
+ # It seems macOS/x86_64 loads the program text around 00000001_xxxxxxxx.
+ # The gcc default (-mcmodel=small) would produce out-of-range 32-bit
+ # relocations.
+ CMODULEFLAGS += -mcmodel=large
+endif
+
# ELF module definitions
CELFFLAGS = $(CFLAGS)
diff --git a/boards/sim/sim/sim/configs/nsh2/Make.defs b/boards/sim/sim/sim/configs/nsh2/Make.defs
index 21e67fc..4b18758 100644
--- a/boards/sim/sim/sim/configs/nsh2/Make.defs
+++ b/boards/sim/sim/sim/configs/nsh2/Make.defs
@@ -82,6 +82,18 @@ else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
+# NuttX modules are ELF binaries.
+# Non-ELF platforms like macOS need to use a separate ELF toolchain.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ # eg. brew install x86_64-elf-gcc
+ MODULECC = x86_64-elf-gcc
+ MODULELD = x86_64-elf-ld
+ # It seems macOS/x86_64 loads the program text around 00000001_xxxxxxxx.
+ # The gcc default (-mcmodel=small) would produce out-of-range 32-bit
+ # relocations.
+ CMODULEFLAGS += -mcmodel=large
+endif
+
# ELF module definitions
CELFFLAGS = $(CFLAGS)
diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs
index c49735e..c338812 100644
--- a/boards/sim/sim/sim/scripts/Make.defs
+++ b/boards/sim/sim/sim/scripts/Make.defs
@@ -88,6 +88,18 @@ else
LDMODULEFLAGS += -T $(TOPDIR)/libs/libc/modlib/gnu-elf.ld
endif
+# NuttX modules are ELF binaries.
+# Non-ELF platforms like macOS need to use a separate ELF toolchain.
+ifeq ($(CONFIG_HOST_MACOS),y)
+ # eg. brew install x86_64-elf-gcc
+ MODULECC = x86_64-elf-gcc
+ MODULELD = x86_64-elf-ld
+ # It seems macOS/x86_64 loads the program text around 00000001_xxxxxxxx.
+ # The gcc default (-mcmodel=small) would produce out-of-range 32-bit
+ # relocations.
+ CMODULEFLAGS += -mcmodel=large
+endif
+
# ELF module definitions
CELFFLAGS = $(CFLAGS)
[incubator-nuttx] 04/07: sim: modlib: Implement some x86_64
relocations
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit c62f80658109c91641f8206804a5aeb8a1dcd4c1
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 12:34:14 2020 +0900
sim: modlib: Implement some x86_64 relocations
The boilerplate part of the code was copied from:
libs/libc/machine/risc-v/rv64/arch_elf.c
---
libs/libc/machine/sim/Make.defs | 12 ++-
libs/libc/machine/sim/arch_elf64.c | 202 +++++++++++++++++++++++++++++++++++++
2 files changed, 213 insertions(+), 1 deletion(-)
diff --git a/libs/libc/machine/sim/Make.defs b/libs/libc/machine/sim/Make.defs
index 879d2d4..b8c0556 100644
--- a/libs/libc/machine/sim/Make.defs
+++ b/libs/libc/machine/sim/Make.defs
@@ -33,9 +33,19 @@
#
############################################################################
-ifeq ($(CONFIG_LIBC_ARCH_ELF),y)
+# XXX ELF relocations are not actually sim-dependent.
+# We should share the code with eg. ../x86/arch_elf.c.
+ifeq ($(CONFIG_LIBC_ARCH_ELF),y)
+ifeq ($(CONFIG_HOST_X86_64),y)
+ifeq ($(CONFIG_SIM_M32),y)
CSRCS += arch_elf.c
+else
+CSRCS += arch_elf64.c
+endif
+else
+CSRCS += arch_elf.c
+endif
DEPPATH += --dep-path machine/sim
VPATH += :machine/sim
diff --git a/libs/libc/machine/sim/arch_elf64.c b/libs/libc/machine/sim/arch_elf64.c
new file mode 100644
index 0000000..f09d644
--- /dev/null
+++ b/libs/libc/machine/sim/arch_elf64.c
@@ -0,0 +1,202 @@
+/****************************************************************************
+ * libs/libc/machine/sim/arch_elf64.c
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/* References:
+ * AMD64 ABI Draft 0.98
+ * http://refspecs.linuxbase.org/elf/x86_64-abi-0.98.pdf
+ * 4.4 Relocation
+ */
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <stdlib.h>
+#include <errno.h>
+#include <debug.h>
+#include <assert.h>
+
+#include <nuttx/elf.h>
+
+/****************************************************************************
+ * Pre-processor Definitions
+ ****************************************************************************/
+
+#define R_X86_64_NONE 0
+#define R_X86_64_64 1
+#define R_X86_64_PC32 2
+#define R_X86_64_PLT32 4
+#define R_X86_64_32 10
+#define R_X86_64_32S 11
+
+/****************************************************************************
+ * Private Data Types
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: up_checkarch
+ *
+ * Description:
+ * Given the ELF header in 'hdr', verify that the ELF file is appropriate
+ * for the current, configured architecture. Every architecture that uses
+ * the ELF loader must provide this function.
+ *
+ * Input Parameters:
+ * hdr - The ELF header read from the ELF file.
+ *
+ * Returned Value:
+ * True if the architecture supports this ELF file.
+ *
+ ****************************************************************************/
+
+bool up_checkarch(FAR const Elf64_Ehdr *ehdr)
+{
+ /* Make sure it's an x86_64 executable */
+
+ if (ehdr->e_machine != EM_X86_64)
+ {
+ berr("ERROR: Not for x86_64: e_machine=%04x\n", ehdr->e_machine);
+ return false;
+ }
+
+ /* Make sure that 64-bit objects are supported */
+
+ if (ehdr->e_ident[EI_CLASS] != ELFCLASS64)
+ {
+ berr("ERROR: Need 64-bit objects: e_ident[EI_CLASS]=%02x\n",
+ ehdr->e_ident[EI_CLASS]);
+ return false;
+ }
+
+ /* Verify endian-ness */
+
+#ifdef CONFIG_ENDIAN_BIG
+#error x86_64 is LE
+#else
+ if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
+#endif
+ {
+ berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n",
+ ehdr->e_ident[EI_DATA]);
+ return false;
+ }
+
+ /* TODO: Check ABI here. */
+
+ return true;
+}
+
+/****************************************************************************
+ * Name: up_relocate and up_relocateadd
+ *
+ * Description:
+ * Perform on architecture-specific ELF relocation. Every architecture
+ * that uses the ELF loader must provide this function.
+ *
+ * Input Parameters:
+ * rel - The relocation type
+ * sym - The ELF symbol structure containing the fully resolved value.
+ * There are a few relocation types for a few architectures that do
+ * not require symbol information. For those, this value will be
+ * NULL. Implementations of these functions must be able to handle
+ * that case.
+ * addr - The address that requires the relocation.
+ *
+ * Returned Value:
+ * Zero (OK) if the relocation was successful. Otherwise, a negated errno
+ * value indicating the cause of the relocation failure.
+ *
+ ****************************************************************************/
+
+int up_relocate(FAR const Elf64_Rel *rel, FAR const Elf64_Sym *sym,
+ uintptr_t addr)
+{
+ berr("Not implemented\n");
+ return -ENOSYS;
+}
+
+int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
+ uintptr_t addr)
+{
+ unsigned int relotype;
+ uint64_t value;
+
+ relotype = ELF64_R_TYPE(rel->r_info);
+
+ if (sym == NULL && relotype != R_X86_64_NONE)
+ {
+ return -EINVAL;
+ }
+
+ /* A ... The addend (rel->r_addend)
+ * P ... The location (addr)
+ * L ... The PLT location (sym->st_value)
+ * S ... symbol value (sym->st_value)
+ */
+
+ switch (relotype)
+ {
+ case R_X86_64_64: /* S + A */
+ *(uint64_t *)addr = sym->st_value + rel->r_addend;
+ break;
+ case R_X86_64_PC32: /* S + A - P */
+ case R_X86_64_PLT32: /* L + A - P */
+ value = sym->st_value + rel->r_addend - addr;
+ if ((int32_t)value != value)
+ {
+ berr("ERROR: Out of range relocation: %d\n", relotype);
+ return -EINVAL;
+ }
+
+ *(uint32_t *)addr = value;
+ break;
+ case R_X86_64_32: /* S + A */
+ case R_X86_64_32S: /* S + A */
+ value = sym->st_value + rel->r_addend;
+ if ((relotype == R_X86_64_32 && (uint32_t)value != value) ||
+ (relotype == R_X86_64_32S && (int32_t)value != value))
+ {
+ berr("ERROR: Out of range relocation: %d\n", relotype);
+ return -EINVAL;
+ }
+
+ *(uint32_t *)addr = value;
+ break;
+ default:
+ berr("ERROR: Unsupported relocation: %d\n", relotype);
+ return -EINVAL;
+ }
+
+ return OK;
+}
[incubator-nuttx] 02/07: libelf: Don't truncate 64-bit values
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit bb09d564db53196bc2236be7f854d3ccbf1f38a0
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 16:01:02 2020 +0900
libelf: Don't truncate 64-bit values
---
binfmt/libelf/libelf_symbols.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/binfmt/libelf/libelf_symbols.c b/binfmt/libelf/libelf_symbols.c
index 373bd06..f5ac359 100644
--- a/binfmt/libelf/libelf_symbols.c
+++ b/binfmt/libelf/libelf_symbols.c
@@ -325,7 +325,7 @@ int elf_symvalue(FAR struct elf_loadinfo_s *loadinfo, FAR Elf_Sym *sym,
loadinfo->iobuffer, sym->st_value, symbol->sym_value,
sym->st_value + symbol->sym_value);
- sym->st_value += (Elf_Word)((uintptr_t)symbol->sym_value);
+ sym->st_value += ((uintptr_t)symbol->sym_value);
}
break;
[incubator-nuttx] 01/07: modlib: Don't truncate 64-bit values
Posted by xi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit bd7829a44da56654a254dc3967f7266f27b63bc3
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Mar 26 15:44:54 2020 +0900
modlib: Don't truncate 64-bit values
---
libs/libc/modlib/modlib_symbols.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libs/libc/modlib/modlib_symbols.c b/libs/libc/modlib/modlib_symbols.c
index 0723e17..a3eed52 100644
--- a/libs/libc/modlib/modlib_symbols.c
+++ b/libs/libc/modlib/modlib_symbols.c
@@ -418,7 +418,7 @@ int modlib_symvalue(FAR struct module_s *modp,
loadinfo->iobuffer, sym->st_value, symbol->sym_value,
sym->st_value + symbol->sym_value);
- sym->st_value += (Elf_Word)((uintptr_t)symbol->sym_value);
+ sym->st_value += ((uintptr_t)symbol->sym_value);
}
break;