Skip to content

Commit 4e9820c

Browse files
committed
Allow undefined weak symbols.
1 parent 9ad088f commit 4e9820c

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
2-
index 9f623a6..d5fc91c 100644
2+
index 9f623a6..f4ee928 100644
33
--- a/rts/linker/Elf.c
44
+++ b/rts/linker/Elf.c
5-
@@ -1056,6 +1056,11 @@ ocGetNames_ELF ( ObjectCode* oc )
5+
@@ -1056,7 +1056,15 @@ ocGetNames_ELF ( ObjectCode* oc )
66
)
77
) {
88
/* Section 0 is the undefined section, hence > and not >=. */
9-
+ if (!(secno > 0 && secno < shnum)) {
10-
+ debugBelch("while processing %s\n", OC_INFORMATIVE_FILENAME(oc));
11-
+ debugBelch("while processing symbol %s (%d)\n", nm, j);
12-
+ barf("secno %d out of range (0, %d)\n", secno, shnum);
13-
+ }
14-
CHECK(secno > 0 && secno < shnum);
9+
- CHECK(secno > 0 && secno < shnum);
10+
+ // This is only a problem if the symbol is _not_ WEAK. If it's
11+
+ // weak this is perfectly ok. See below how we set the symbol's
12+
+ // address to NULL in that case.
13+
+ // if (!(secno > 0 && secno < shnum)) {
14+
+ // debugBelch("while processing %s\n", OC_INFORMATIVE_FILENAME(oc));
15+
+ // debugBelch("while processing symbol %s (%d)\n", nm, j);
16+
+ // barf("secno %d out of range (0, %d)\n", secno, shnum);
17+
+ // }
18+
+ // CHECK(secno > 0 && secno < shnum);
1519
/*
1620
if (shdr[secno].sh_type == SHT_NOBITS) {
21+
debugBelch(" BSS symbol, size %d off %d name %s\n",
22+

0 commit comments

Comments
 (0)