This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Weak Alias and Static Question
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>, Chris Johns <chrisj at rtems dot org>
- Date: Tue, 14 Oct 2014 15:41:33 -0500
- Subject: Weak Alias and Static Question
- Authentication-results: sourceware.org; auth=none
Hi
Is it possible to have a static default function for a weak alias?
The pattern we are looking at is this in the C source file:
static void bsp_start_default( void ){...}
/*
* By making this a weak alias for bsp_start_default, a brave soul
* can override the actual bsp_start routine used.
*/
void bsp_start (void) __attribute__ ((weak, alias("bsp_start_default")));
The public name is bsp_start() and that is the symbol defined in a public
.h. We want to allow an application can override it.
Will this use of a static behind the non-static work? Any gotchas
we should be aware of?
Thanks.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985