* [PATCH PROPOSAL] Bcc: output an import directive on external function declaration
@ 2015-04-11 19:33 MFLD
0 siblings, 0 replies; only message in thread
From: MFLD @ 2015-04-11 19:33 UTC (permalink / raw)
To: ELKS; +Cc: Robert de Bath, lkundrak
Hello,
This patch tries to solve the problem described in the "Question on
import symbols generated by BCC
<http://news.gmane.org/find-root.php?message_id=551599A4.7060804%40gmail.com>"
topic (see earlier in the mailing list archive). When parsing an
external function declaration, Bcc outputs an assembler import directive
in the code segment. So that in the object symbol table, the external
function is flagged 'T' (= symbol in code segment) in place of 'U' (=
undefined segment).
Unit test result (to be compared with the one in the referenced topic):
mfld@mfldhome ~/advantech/dev86/bcc $ bcc -c -o test2.o test2.c
mfld@mfldhome ~/advantech/dev86/bcc $ objdump86 test2.o
OBJECTFILE 'test2.o'
MODULE 'test2'
BYTEPOS 00000038
BINLEN 0000000c
STRINGS 0025 +0013
VERSION 0.0
SEG0 0000000c
SYMS 2
SYM 0 00000000 ..E.T _main
SYM 1 00000000 ...IT _entry
text data bss dec hex filename
12 0 0 12 c test2.o
BYTECODE
SEG 0
: 55 89 e5 57 56 e8 U..WV.
RELSZ 2
DW _entry-PC
: 5e 5f 5d c3 ^_].
SEG 3
-----
diff --git a/bcc/declare.c b/bcc/declare.c
index 1f0aae2..2fd7239 100644
--- a/bcc/declare.c
+++ b/bcc/declare.c
@@ -834,7 +834,15 @@
gvarsymptr->flags = DIRECTPAGE;
#endif
if (gvarsc == EXTERNDECL)
- gvarsymptr->flags |= EXTERNAL;
+ {
+ gvarsymptr->flags |= EXTERNAL;
+ if (gvartype->constructor == FUNCTION)
+ {
+ /* Output an assembler import directive in code segment */
+ cseg ();
+ import (gvarname);
+ }
+ }
}
else
{
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-04-11 19:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-11 19:33 [PATCH PROPOSAL] Bcc: output an import directive on external function declaration MFLD
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.