File tree Expand file tree Collapse file tree 3 files changed +43
-5
lines changed Expand file tree Collapse file tree 3 files changed +43
-5
lines changed Original file line number Diff line number Diff line change 11#include <stdio.h>
2+ #include <assert.h>
23
3- void side ();
4+ void side_print_foo ();
5+ int side_get_foo ();
6+ void * side_get_foo_addr ();
7+
8+ int side_get_bar ();
9+ void * side_get_bar_addr ();
410
511__attribute__((weak )) int foo () {
612 return 42 ;
713}
814
15+ __attribute__((weak )) int bar = 43 ;
16+
917int main (int argc , char const * argv []) {
1018 printf ("main foo() -> %d\n" , foo ());
11- side ();
19+ side_print_foo ();
20+
21+ // Check that addresses match
22+ assert (& foo == side_get_foo_addr ());
23+ assert (& bar == side_get_bar_addr ());
24+
25+ // Check that main-moduled defined symbols take precedence.
26+ assert (bar == 43 );
27+ assert (side_get_bar () == 43 );
28+
29+ assert (foo () == 42 );
30+ assert (side_get_foo () == 42 );
31+
1232 return 0 ;
1333}
Original file line number Diff line number Diff line change 11#include <stdio.h>
22
33extern int foo ();
4+ extern int bar ;
45
56__attribute__((weak )) int foo () {
67 return 99 ;
78}
89
9- void side () {
10+ __attribute__((weak )) int bar = 100 ;
11+
12+ void side_print_foo () {
1013 printf ("side foo() -> %d\n" , foo ());
1114}
15+
16+ int side_get_foo () {
17+ return foo ();
18+ }
19+
20+ void * side_get_foo_addr () {
21+ return & foo ;
22+ }
23+
24+ int side_get_bar () {
25+ return bar ;
26+ }
27+
28+ void * side_get_bar_addr () {
29+ return & bar ;
30+ }
Original file line number Diff line number Diff line change @@ -3780,7 +3780,7 @@ def test_dylink_static_funcpointer_float(self):
37803780 header = 'typedef float (*floatfunc)(float);' , force_c = True )
37813781
37823782 @needs_dylink
3783- def test_missing_signatures (self ):
3783+ def test_dylink_missing_signatures (self ):
37843784 create_file ('test_sig.c' , r'''#include <emscripten.h>
37853785 int main() {
37863786 return 0 == ( (long)&emscripten_run_script_string +
@@ -4567,7 +4567,6 @@ def test_dylink_argv_argc(self):
45674567 expected = '3 hello world!' ,
45684568 need_reverse = False )
45694569
4570- @disabled ('https://github.com/emscripten-core/emscripten/issues/13773' )
45714570 def test_dylink_weak (self ):
45724571 # Verify that weakly symbols can be defined in both side module and main
45734572 # module
You can’t perform that action at this time.
0 commit comments