Fix tests2/120_alias.c on macos
While MacOS doesn't natively support the alias attribute, let's support it with TCC anyway. This means we need to make a decision if the string in the alias attribute is decorated or not due to the implicit underscore on MacOS. To make life easier we decide that it's the C name, i.e. without underscore, and so TCC needs to emit alias names with underscore handling. Irrespective of that the test case needs to deal with the underscore itself for __asm__ renaming which is always requiring the assembler name.
This commit is contained in:
parent
0da93838c1
commit
78da4586a0
2 changed files with 5 additions and 1 deletions
2
tccgen.c
2
tccgen.c
|
|
@ -8472,7 +8472,7 @@ found:
|
||||||
if (!esym)
|
if (!esym)
|
||||||
tcc_error("unsupported forward __alias__ attribute");
|
tcc_error("unsupported forward __alias__ attribute");
|
||||||
put_extern_sym2(sym, esym->st_shndx,
|
put_extern_sym2(sym, esym->st_shndx,
|
||||||
esym->st_value, esym->st_size, 0);
|
esym->st_value, esym->st_size, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type.t & VT_STATIC)
|
if (type.t & VT_STATIC)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,11 @@ void target(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void alias_for_target(void) __attribute__((alias("target")));
|
void alias_for_target(void) __attribute__((alias("target")));
|
||||||
|
#ifdef __leading_underscore
|
||||||
|
void asm_for_target(void) __asm__("_target");
|
||||||
|
#else
|
||||||
void asm_for_target(void) __asm__("target");
|
void asm_for_target(void) __asm__("target");
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is not supposed to compile, alias targets must be defined in the
|
/* This is not supposed to compile, alias targets must be defined in the
|
||||||
same unit. In TCC they even must be defined before the reference
|
same unit. In TCC they even must be defined before the reference
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue