This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

arch-specific funcs in libgloss to override libnosys


i'm not terribly familiar with libgloss' source layout.  ive reviewed the
porting doc, but it seems some pieces are out of date, and it doesnt exactly
explain how one folds a bsp lib from libgloss into gcc's default linker
output.

in my case, i'm looking at overriding the default _exit() symbol.  the
libnosys code attempts to trigger a divide-by-zero exception which doesnt
exist on Blackfin parts.  atm, our local tree is doing:
libgloss/libnosys/_exit.c:
#ifdef __BFIN__
  asm ("EXCPT 0;");
#else
  /* Default stub just causes a divide by 0 exception.  */
  int x = rc / INT_MAX;
  x = 4 / x;
  asm volatile ("" : : "r" (x));
#endif
clearly this goes against the whole point of libnosys :)

there is also an additional support function i need to add that is Blackfin-
specific and required by gcc (for clearing caches).

so what i'm thinking is that i declare a new libbsp.a in bfin/Makefile.in,
stick a _exit.c file in there as well as the Blackfin-specific files, and then
build them up as part of libgloss.

then i modify the Blackfin elf gcc spec like so:
-#define LIB_SPEC "--start-group -lc %{msim:-lsim}%{!msim:-lnosys} --end-group \
+#define LIB_SPEC "--start-group -lc %{msim:-lsim}%{!msim:-lbsp -lnosys} --end-group \

is this the way to go ?  or am i completely off base ?
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]