Symbols defined via linker script: local or global?
Sebastian Huber
sebastian.huber@embedded-brains.de
Thu May 12 12:43:00 GMT 2016
On 12/05/16 14:42, Alan Modra wrote:
> On Thu, May 12, 2016 at 02:17:41PM +0200, Sebastian Huber wrote:
>> >
>> >
>> >On 12/05/16 14:15, Alan Modra wrote:
>>> > >On Thu, May 12, 2016 at 01:04:52PM +0200, Sebastian Huber wrote:
>>>> > >>Hello,
>>>> > >>
>>>> > >>I define a symbol in a custom linker script, e.g.
>>>> > >>
>>>> > >>foo = 0x123;
>>>> > >>
>>>> > >>In case I reference this symbol in my executable (e.g. printf("%p\n", foo)),
>>>> > >>then the symbol is global in the ELF file. In case it is not referenced by
>>>> > >>the executable, then it is local.
>>> > >What target, and what options were you passing to ld?
>>> > >
>> >
>> >Target is ARM EABI, command line generated via GCC:
>> >
>> >arm-rtems4.11-ld -dc -dp -N -o b-atsamv/app.exe
>> >/opt/rtems-4.12/arm-rtems4.12/atsamv/lib/start.o /opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/thumb/cortex-m7/fpv5-d16/hard/crti.o /opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/thumb/cortex-m7/fpv5-d16/hard/crtbegin.o
>> >-e _start
>> >-L/opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/thumb/cortex-m7/fpv5-d16/hard -L/opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/../../../../arm-rtems4.12/lib/thumb/cortex-m7/fpv5-d16/hard
>> >-L/opt/rtems-4.12/arm-rtems4.12/atsamv/lib
>> >-L/opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1
>> >-L/opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/../../../../arm-rtems4.12/lib
>> >--gc-sections -Map b-atsamv/app.map b-atsamv/init.o
>> >b-atsamv/dev/cfi/cfi_core.o b-atsamv/atsam_flash.o
>> >b-atsamv/test-file-system.o -ljffs2 --start-group -lgcc --start-group
>> >-lrtemsbsp -lrtemscpu -latomic -lc -lgcc --end-group --end-group /opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/thumb/cortex-m7/fpv5-d16/hard/crtend.o /opt/rtems-4.12/lib64/gcc/arm-rtems4.12/6.1.1/thumb/cortex-m7/fpv5-d16/hard/crtn.o
>> >-T linkcmds.sdram
> I don't see anything odd there, but I can't reproduce the global to
> local change with a simple testcase. All of my linker script symbols
> are global.
Ok, I try to create a simple test case.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the Binutils
mailing list