get a symbol prefix. In our case, it's an underscore ("_"). So we set the
symbol prefix in the configure script and output it in the linker script and
all relevant files.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
LDFILE= elf2flt.ld
ifeq ($(strip $(CPU)),e1)
LDFILE= elf2flt.ld
ifeq ($(strip $(CPU)),e1)
-SRC_LDFILE= $(CPU)-elf2flt.ld
+SRC_LDFILE= $(srcdir)/$(CPU)-elf2flt.ld
else
SRC_LDFILE= elf2flt.ld
endif
else
SRC_LDFILE= elf2flt.ld
endif
mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
$(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
$(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
mv $(target_bindir)/ld$(EXEEXT) $(target_bindir)/ld.real$(EXEEXT)
$(INSTALL) -m 755 ld-elf2flt $(bindir)/$(TARGET)-ld
$(INSTALL) -m 755 ld-elf2flt $(target_bindir)/ld
- $(INSTALL) -m 644 $(srcdir)/$(SRC_LDFILE) $(target_libdir)/$(LDFILE)
+ $(INSTALL) -m 644 $(SRC_LDFILE) $(target_libdir)/$(LDFILE)
+SYMBOL_PREFIX=
+case $target in
+ bfin*)
+ SYMBOL_PREFIX=_
+ ;;
+esac
+
dnl Make sure we resolve system symbols before libiberty/libbfd ones.
dnl Otherwise, things like getopt get screwed up because the system headers
dnl redirect some functions to the system symbols, but other local symbols
dnl Make sure we resolve system symbols before libiberty/libbfd ones.
dnl Otherwise, things like getopt get screwed up because the system headers
dnl redirect some functions to the system symbols, but other local symbols
AC_SUBST(binutils_ldscript_dir)
AC_SUBST(got_check)
AC_SUBST(emit_relocs)
AC_SUBST(binutils_ldscript_dir)
AC_SUBST(got_check)
AC_SUBST(emit_relocs)
-AC_OUTPUT(Makefile ld-elf2flt)
+AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)
+ENTRY (@SYMBOL_PREFIX@_start)
MEMORY {
flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
MEMORY {
flatmem : ORIGIN = 0x0, LENGTH = 0xfffffff
.text 0x0 : {
. = . + 4;
. = ALIGN(0x4) ;
.text 0x0 : {
. = . + 4;
. = ALIGN(0x4) ;
+ @SYMBOL_PREFIX@_stext = . ;
*(.text)
*(.text.*)
*(.gnu.warning)
*(.text)
*(.text.*)
*(.gnu.warning)
the start followed by the code pointed to by entries
in the lookup table. */
. = ALIGN (4) ;
the start followed by the code pointed to by entries
in the lookup table. */
. = ALIGN (4) ;
+ PROVIDE(@SYMBOL_PREFIX@__ctbp = .);
*(.call_table_data)
*(.call_table_text)
. = ALIGN(0x20) ;
*(.call_table_data)
*(.call_table_text)
. = ALIGN(0x20) ;
+ @SYMBOL_PREFIX@_etext = . ;
} > flatmem
.data : {
. = ALIGN(0x4) ;
} > flatmem
.data : {
. = ALIGN(0x4) ;
- _sdata = . ;
- __data_start = . ;
- data_start = . ;
+ @SYMBOL_PREFIX@_sdata = . ;
+ @SYMBOL_PREFIX@__data_start = . ;
+ @SYMBOL_PREFIX@data_start = . ;
*(.got.plt)
*(.got)
FILL(0) ;
*(.got.plt)
*(.got)
FILL(0) ;
/* Microblaze has .sdata and .sbss (small bss). They must
be contiguous, so please don't move any of this. JW */
/* Microblaze has .sdata and .sbss (small bss). They must
be contiguous, so please don't move any of this. JW */
+ @SYMBOL_PREFIX@_ssrw = . ;
*(.sdata)
*(.sdata.*)
*(.sbss) /* Don't move this! */
*(.gnu.linkonce.sb*)
*(.sdata)
*(.sdata.*)
*(.sbss) /* Don't move this! */
*(.gnu.linkonce.sb*)
+ @SYMBOL_PREFIX@_essrw = . ;
- _ssrw_size = _essrw - _ssrw;
- PROVIDE(_SDA_BASE_ = _ssrw + (_ssrw_size / 2));
+ @SYMBOL_PREFIX@_ssrw_size = @SYMBOL_PREFIX@_essrw - @SYMBOL_PREFIX@_ssrw;
+ PROVIDE(@SYMBOL_PREFIX@_SDA_BASE_ = @SYMBOL_PREFIX@_ssrw + (@SYMBOL_PREFIX@_ssrw_size / 2));
*(.gnu.linkonce.s.*)
*(__libc_atexit)
*(.gnu.linkonce.s.*)
*(__libc_atexit)
/* microblaze-specific read-only small data area
and associated locating symbols */
/* microblaze-specific read-only small data area
and associated locating symbols */
+ @SYMBOL_PREFIX@_ssro = . ;
- _essro = . ;
- _ssro_size = _essro - _ssro;
- PROVIDE(_SDA2_BASE_ = _ssro + (_ssro_size / 2));
+ @SYMBOL_PREFIX@_essro = . ;
+ @SYMBOL_PREFIX@_ssro_size = @SYMBOL_PREFIX@_essro - @SYMBOL_PREFIX@_ssro;
+ PROVIDE(@SYMBOL_PREFIX@_SDA2_BASE_ = @SYMBOL_PREFIX@_ssro + (@SYMBOL_PREFIX@_ssro_size / 2));
- __CTOR_LIST__ = .;
- LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
+ @SYMBOL_PREFIX@__CTOR_LIST__ = .;
+ LONG((@SYMBOL_PREFIX@__CTOR_END__ - @SYMBOL_PREFIX@__CTOR_LIST__) / 4 - 2)
SINGLE_LINK: /* gcc uses crtbegin.o to find the start of
SINGLE_LINK: the constructors, so we make sure it is
SINGLE_LINK: first. Because this is a wildcard, it
SINGLE_LINK: /* gcc uses crtbegin.o to find the start of
SINGLE_LINK: the constructors, so we make sure it is
SINGLE_LINK: first. Because this is a wildcard, it
SINGLE_LINK: KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
LONG(0)
SINGLE_LINK: KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
LONG(0)
- __CTOR_END__ = .;
- __DTOR_LIST__ = .;
- LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
+ @SYMBOL_PREFIX@__CTOR_END__ = .;
+ @SYMBOL_PREFIX@__DTOR_LIST__ = .;
+ LONG((@SYMBOL_PREFIX@__DTOR_END__ - @SYMBOL_PREFIX@__DTOR_LIST__) / 4 - 2)
SINGLE_LINK: KEEP (*crtbegin*.o(.dtors))
SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
SINGLE_LINK: KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
LONG(0)
SINGLE_LINK: KEEP (*crtbegin*.o(.dtors))
SINGLE_LINK: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
SINGLE_LINK: KEEP (*(SORT(.dtors.*)))
KEEP (*(.dtors))
LONG(0)
+ @SYMBOL_PREFIX@__DTOR_END__ = .;
- PROVIDE (__preinit_array_start = .);
+ PROVIDE (@SYMBOL_PREFIX@__preinit_array_start = .);
- PROVIDE (__preinit_array_end = .);
+ PROVIDE (@SYMBOL_PREFIX@__preinit_array_end = .);
- PROVIDE (__init_array_start = .);
+ PROVIDE (@SYMBOL_PREFIX@__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
- PROVIDE (__init_array_end = .);
+ PROVIDE (@SYMBOL_PREFIX@__init_array_end = .);
- PROVIDE (__fini_array_start = .);
+ PROVIDE (@SYMBOL_PREFIX@__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
- PROVIDE (__fini_array_end = .);
+ PROVIDE (@SYMBOL_PREFIX@__fini_array_end = .);
} > flatmem
.eh_frame_hdr : { *(.eh_frame_hdr) } > flatmem
} > flatmem
.eh_frame_hdr : { *(.eh_frame_hdr) } > flatmem
.gcc_except_table : { KEEP(*(.gcc_except_table)) } >flatmem
. = ALIGN(0x10) ;
.gcc_except_table : { KEEP(*(.gcc_except_table)) } >flatmem
. = ALIGN(0x10) ;
+ @SYMBOL_PREFIX@_edata = . ;
.bss : {
. = ALIGN(0x4) ;
.bss : {
. = ALIGN(0x4) ;
- _sbss = ALIGN(0x4) ;
- __bss_start = . ;
+ @SYMBOL_PREFIX@_sbss = ALIGN(0x4) ;
+ @SYMBOL_PREFIX@__bss_start = . ;
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.dynsbss)
*(.sbss)
*(.sbss.*)
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(0x10) ;
*(.gnu.linkonce.b*)
*(COMMON)
. = ALIGN(0x10) ;
- _ebss = . ;
- _end = . ;
- end = . ;
+ @SYMBOL_PREFIX@_ebss = . ;
+ @SYMBOL_PREFIX@_end = . ;
+ @SYMBOL_PREFIX@end = . ;
} > flatmem
.stack : {
. = ALIGN(0x4);
} > flatmem
.stack : {
. = ALIGN(0x4);
+ @SYMBOL_PREFIX@_stack_start = .;
}
.junk 0 : { *(.rel*) *(.rela*) }
}
.junk 0 : { *(.rel*) *(.rela*) }
then
# Non application modules enter via main not _start
# SEDOP="$SEDOP -e 's/ENTRY (_start)/ENTRY (main)/'"
then
# Non application modules enter via main not _start
# SEDOP="$SEDOP -e 's/ENTRY (_start)/ENTRY (main)/'"
- SEDOP="$SEDOP -e s/\\(ENTRY.\\)(_start)/\1(lib_main)/"
+ SEDOP="$SEDOP -e s/\\(ENTRY.\\)(@SYMBOL_PREFIX@_start)/\1(lib_main)/"
OBJCOPYOP="--localize-hidden --weaken"
fi
OBJCOPYOP="--localize-hidden --weaken"
fi