This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Symbols defined via linker script: local or global?
- From: Alan Modra <amodra at gmail dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 12 May 2016 22:12:28 +0930
- Subject: Re: Symbols defined via linker script: local or global?
- Authentication-results: sourceware.org; auth=none
- References: <57346354 dot 80700 at embedded-brains dot de> <20160512121548 dot GB2111 at bubble dot grove dot modra dot org> <57347465 dot 3030305 at embedded-brains dot de>
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.
--
Alan Modra
Australia Development Lab, IBM