PROG_FLTHDR = flthdr$(EXEEXT)
PROGS = $(PROG_ELF2FLT) $(PROG_FLTHDR)
-all: $(PROGS)
+all: $(PROGS) ld-elf2flt
$(PROG_ELF2FLT): $(srcdir)/elf2flt.c compress.o $(srcdir)/stubs.c
$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
$(PROG_FLTHDR): $(srcdir)/flthdr.c compress.o
$(CC) $(CCFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ld-elf2flt: $(srcdir)/ld-elf2flt.in
+ ./config.status $@
+
Makefile: $(srcdir)/Makefile.in
./config.status $@
[ emit_relocs=yes ]
)
+AC_ARG_ENABLE(emit_ctor_dtor,
+ AS_HELP_STRING([--enable-emit-ctor-dtor], [manually create ctor/dtor list]),
+ [ emit_ctor_dtor=$enableval ],
+ [ emit_ctor_dtor=no ]
+)
+
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_SUBST(binutils_ldscript_dir)
AC_SUBST(got_check)
AC_SUBST(emit_relocs)
+AC_SUBST(emit_ctor_dtor)
AC_SUBST(SYMBOL_PREFIX)
AC_OUTPUT(Makefile ld-elf2flt elf2flt.ld)
PROVIDE(@SYMBOL_PREFIX@_SDA2_BASE_ = @SYMBOL_PREFIX@_ssro + (@SYMBOL_PREFIX@_ssro_size / 2));
. = ALIGN(4) ;
- @SYMBOL_PREFIX@__CTOR_LIST__ = .;
- LONG((@SYMBOL_PREFIX@__CTOR_END__ - @SYMBOL_PREFIX@__CTOR_LIST__) / 4 - 2)
+TOR: @SYMBOL_PREFIX@__CTOR_LIST__ = .;
+TOR: 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: KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
SINGLE_LINK: KEEP (*(SORT(.ctors.*)))
KEEP (*(.ctors))
- LONG(0)
- @SYMBOL_PREFIX@__CTOR_END__ = .;
- @SYMBOL_PREFIX@__DTOR_LIST__ = .;
- LONG((@SYMBOL_PREFIX@__DTOR_END__ - @SYMBOL_PREFIX@__DTOR_LIST__) / 4 - 2)
+TOR: LONG(0)
+TOR: @SYMBOL_PREFIX@__CTOR_END__ = .;
+TOR: @SYMBOL_PREFIX@__DTOR_LIST__ = .;
+TOR: 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)
- @SYMBOL_PREFIX@__DTOR_END__ = .;
+TOR: LONG(0)
+TOR: @SYMBOL_PREFIX@__DTOR_END__ = .;
PROVIDE (@SYMBOL_PREFIX@__preinit_array_start = .);
KEEP (*(.preinit_array))
else
SEDOP="$SEDOP -e /^SINGLE_LINK:/d"
fi
+ if [ "@emit_ctor_dtor@" = "yes" ]
+ then
+ SEDOP="$SEDOP -e s/^TOR://"
+ else
+ SEDOP="$SEDOP -e /^TOR:/d"
+ fi
# provide a default linker script, we usually need one
[ -z "$LDSCRIPT" ] && LDSCRIPT="${LDSCRIPTPATH}/elf2flt.ld"