Some targets prepend an underscore to C identifier, while others do
not (e.g. H8 vs. ARM). This can cause problems in two situations:
1. when linking C and assembly code;
2. when a symbol name is specified on the linker's command line.
This patch resolves both issues by using the asm keyword to associate C
identifiers with the corresponding assembler/linker symbol names in a
target-independent manner.
Signed-off-by: Jan Dubiec <jdx@o2.pl>
extern const char * getstr3(int);
extern int printf (const char *, ...);
-extern const char *addr_of_str;
-extern const char *addr_of_str2;
+extern const char *addr_of_str asm("addr_of_str");
+extern const char *addr_of_str2 asm("addr_of_str2");
/* "foobar" needs to be a string literal, so that it's put into
a mergable string section, then merged with the "foobar" from merge4b.s
-void foo(void);
+void foo(void) asm("foo");
+void foo2(void) asm("foo2");
+int main(void) asm("main");
int main(void)
{
{
a = 3;
}
-
-
int (*p)(void);
+int main(void) asm("main");
int
main ()