Robert Mykland
2006-Nov-16 16:53 UTC
[LLVMdev] Question about functions/bytecodes: external linkage
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> So I'm going through this super-easy example of a bytecode file along the lines of "Hello World!" Here is the llvm for it:<br> <br> ; ModuleID = 'hello.bc'<br> target endian = little<br> target pointersize = 32<br> target triple = "i686-pc-linux-gnu"<br> %str = internal constant [18 x sbyte] c"Hello RKM world!\0A\00" ; <[18 x sbyte]*> [#uses=1]<br> <br> implementation ; Functions:<br> <br> int %main() {<br> entry:<br> %tmp = call int (sbyte*, ...)* %printf( sbyte* getelementptr ([18 x sbyte]* %str, int 0, uint 0) ) ; <int> [#uses=0]<br> ret int 0<br> }<br> <br> declare int %printf(sbyte*, ...)<br> <br> And here is the bytecode for it:<br> <br> <font face="Courier New, Courier, monospace" size="-1">00000000 6c 6c 76 63 30 01 00 00 00 a3 00 00 00 50 86 02 |llvc0........P..|<br> 00000010 00 00 07 10 0e 0f 03 12 10 10 0d 07 00 10 13 10 |................|<br> 00000020 03 0d 07 02 12 00 c5 03 00 00 af 03 01 00 e1 03 |................|<br> 00000030 b1 04 00 00 11 69 36 38 36 2d 70 63 2d 6c 69 6e |.....i686-pc-lin|<br> 00000040 75 78 2d 67 6e 75 00 00 e3 03 00 00 01 00 0e 48 |ux-gnu.........H|<br> 00000050 65 6c 6c 6f 20 52 4b 4d 20 77 6f 72 6c 64 21 0a |ello RKM world!.|<br> 00000060 00 01 12 04 1a 01 0d 00 07 00 06 62 04 00 00 00 |...........b....|<br> 00000070 27 01 00 00 74 11 02 01 01 05 07 00 00 24 02 00 |'...t........$..|<br> 00000080 00 00 01 0c 00 05 65 6e 74 72 79 01 07 01 03 74 |......entry....t|<br> 00000090 6d 70 44 03 00 00 00 01 11 01 06 70 72 69 6e 74 |mpD........print|<br> 000000a0 66 01 0f 01 04 6d 61 69 6e 01 0d 01 03 73 74 72 |f....main....str|<br> 000000b0</font><br> <br> My question is about the single function in the bytecode file, which to my decoding starts at offset 0x06b in the bytecode file. Based on my interpretation of the bytecode spec, looks to me that the byte at 0x06f should specify the linkage for the function, which decodes to external. Yet the next module is an instruction list, and the function is specified right there in the file. So I figure that either I don't understand what external linkage means or I'm decoding the bytecode file wrong. Help!<br> <br> Thanks in Advance,<br> <br> -- Robert.<br> <br> <br> </body> </html>
Seemingly Similar Threads
- [LLVMdev] Some basic questions about LLVM version 1.8 bytecode format
- [LLVMdev] Some basic questions about LLVM version 1.8 bytecode format
- "isolinux.bin missing or corrupt" when booting USB flash drive in old PC
- ogg files with spx and tagging
- buffer_get_bignum2: negative numbers not supported