mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Fixes https://github.com/dlang/dmd/issues/21241 C Static functions were being given the same externally mangled name as their identifier, which caused only one to be picked when linking with linkers that supported that. Additionally, the dmd glue code was only outputting one of these static functions as a workaround for a different linker issue. Solve this by giving C static functions a unique name (by using D mangling) and adding an `isStatic()` check to the dmd glue hack.
This commit is contained in:
parent
5fd0d29211
commit
1244ef260b
5 changed files with 37 additions and 1 deletions
9
compiler/test/runnable/imports/imp21241a.c
Normal file
9
compiler/test/runnable/imports/imp21241a.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
// https://github.com/dlang/dmd/issues/21241
|
||||
enum {aValue=1};
|
||||
static int foo(void){
|
||||
return aValue;
|
||||
}
|
||||
|
||||
int getA(void){
|
||||
return foo();
|
||||
}
|
9
compiler/test/runnable/imports/imp21241b.c
Normal file
9
compiler/test/runnable/imports/imp21241b.c
Normal file
|
@ -0,0 +1,9 @@
|
|||
// https://github.com/dlang/dmd/issues/21241
|
||||
enum {bValue=2};
|
||||
static int foo(void){
|
||||
return bValue;
|
||||
}
|
||||
|
||||
int getB(void){
|
||||
return foo();
|
||||
}
|
13
compiler/test/runnable/test21241.d
Normal file
13
compiler/test/runnable/test21241.d
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
REQUIRED_ARGS: runnable/imports/imp21241a.c runnable/imports/imp21241b.c
|
||||
*/
|
||||
// https://github.com/dlang/dmd/issues/21241
|
||||
import imp21241a;
|
||||
import imp21241b;
|
||||
|
||||
void main(){
|
||||
int x = getA();
|
||||
assert(x==aValue);
|
||||
x = getB();
|
||||
assert(x==bValue);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue