Fun with the dynamic loader.

Rob Landley rob at landley.net
Fri Nov 14 17:41:39 UTC 2008


On Friday 14 November 2008 07:31:02 Bernd Schmidt wrote:
> Rob Landley wrote:
> > On Thursday 13 November 2008 21:14:39 Rob Landley wrote:
> >> Only three architectures actually #define this macro: frv, bfin, and
> >> avr32.
> >
> > And while we're at it: frv and bfin define START() to do exactly the same
> > thing.  Does anybody know why it's doing this and why the calling code
> > hasn't just got an if() case for whatever it is?
>
> Uhhh???  This is from bfin/dl-startup.h:
>
> /*
>  * Transfer control to the user's application, once the dynamic loader
>  * is done.  We return the address of the function's entry point to
>  * _dl_boot, see boot1_arch.h.
>  */
> #define START() do {                                                    \
>   struct elf_resolve *exec_mod = _dl_loaded_modules;                    \
>   dl_main_funcdesc->entry_point = _dl_elf_main;                         \
>   while (exec_mod->libtype != elf_executable)                           \
>     exec_mod = exec_mod->next;                                          \
>   dl_main_funcdesc->got_value = exec_mod->loadaddr.got_value;           \
>   return;                                                               \
> } while (0)

And this is from frv:
/*
 * Transfer control to the user's application, once the dynamic loader
 * is done.  We return the address of the function's entry point to
 * _dl_boot, see boot1_arch.h.
 */
#define START() do {                                                    \
  struct elf_resolve *exec_mod = _dl_loaded_modules;                    \
  dl_main_funcdesc->entry_point = _dl_elf_main;                         \
  while (exec_mod->libtype != elf_executable)                           \
    exec_mod = exec_mod->next;                                          \
  dl_main_funcdesc->got_value = exec_mod->loadaddr.got_value;           \
  /* _dl_dprintf(2, "entry point is (%x,%x)\n", dl_main_funcdesc->entry_point, 
dl_main_funcdesc->got_value); */ \
  return;                                                               \
} while (0)


The difference?  Acording to diff, the insertion of a commented out debug 
line.  Hence frv and bfin defining START() to do exactly the same thing.  And 
those are the only two effectively making any use of START() that I can 
find...

Rob



More information about the uClibc mailing list