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: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: Alan Modra <amodra at gmail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 12 May 2016 14:17:41 +0200
- 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>
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
--
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.