Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#3604 closed defect (fixed)

RTL Unresolved Symbols from common section on i386/pc686 (cloned)

Reported by: Joseph Hickey Owned by: Chris Johns
Priority: normal Milestone: 5.1
Component: lib/dl Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Cloned from #3527:


By default GCC puts uninitialized global variables into a common section in the ELF file. When attempting to load the resulting ELF file at runtime using dlopen(), these global symbols are not resolved as expected.

The RTL reports unresolved symbols, and runtime code that take the address of the global get NULL instead.

This is reproducible using the libtests/dl01 example by adding a global variable to the module code. I will attach a patch that replicates the issue.

Test platform is QEMU using pc686 BSP, RTEMS source version 4.11.3 (latest on 4.11 git branch as of this writing)

Change History (3)

comment:1 Changed on 11/13/18 at 06:14:16 by Chris Johns

Owner: set to Chris Johns
Status: newaccepted

comment:2 Changed on 11/22/18 at 02:17:39 by Chris Johns <chrisj@…>

In [changeset:"803eac954ed7a3481c6af9b020d5d25419d3a19d/rtems" 803eac9/rtems]:

libdl: Manage the allocation of common uninitialised variables.

The use of separate text and data results in uninitialised variables
being placed in the common section. There is no section in ELF for
the common variables so the loader needs to create the section and
allocate the variables in that section. This patch does that.

The patch adds a second pass over the symbols.

The issue can also be seen as a section 65522 error.

Updates #3604

comment:3 Changed on 11/27/18 at 06:12:05 by Chris Johns

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.