Recent Entries
Archives
Search


Links
Powered by
Movable Type 2.64

2009年10月16日

バイナリにソースを同梱とか

バイナリにソースを同梱するトカ(;´Д`)

コンパイル元のソースファイルどれだっけ?というか、コレ誰が何時作ったんだよとか多数の企業さんが客先に出入りしてるような環境だとわからなくなったりして、そもそもソースどこ行ったのよ?と非常に困ることがありました。

で、サンプル:


objcopy --add-section=.cob_src=AICS0510.cob AICS0510.so AICS0510_new.so

ヽ(´ー`)ノ
.cob_srcというセクションにAICS0510.cobってファイルを流し込んでます(ぉぃ

readelf -aの結果を外挿する前、後で比べると:


--- AICS0510.so.txt 2009-10-15 17:48:48.000000000 +0900
+++ AICS0510_new.so.txt 2009-10-15 17:52:39.000000000 +0900
@@ -10,14 +10,14 @@
Version: 0x1
Entry point address: 0xfa0
Start of program headers: 52 (bytes into file)
- Start of section headers: 121060 (bytes into file)
+ Start of section headers: 214888 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 4
Size of section headers: 40 (bytes)
- Number of section headers: 27
- Section header string table index: 24
+ Number of section headers: 28
+ Section header string table index: 25

Section Headers:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al
@@ -45,9 +45,10 @@
[21] .data PROGBITS 0001d19c 01d19c 000590 00 WA 0 0 4
[22] .bss NOBITS 0001d740 01d72c 021394 00 WA 0 0 32
[23] .comment PROGBITS 00000000 01d72c 0000e6 00 0 0 1
- [24] .shstrtab STRTAB 00000000 01d812 0000d2 00 0 0 1
- [25] .symtab SYMTAB 00000000 01dd1c 000e60 10 26 193 4
- [26] .strtab STRTAB 00000000 01eb7c 000970 00 0 0 1
+ [24] .cob_src PROGBITS 00000000 01d812 016e78 00 0 0 1
+ [25] .shstrtab STRTAB 00000000 03468a 0000db 00 0 0 1
+ [26] .symtab SYMTAB 00000000 034bc8 000e70 10 27 194 4
+ [27] .strtab STRTAB 00000000 035a38 000970 00 0 0 1
Key to Flags:
W (write), A (alloc), X (execute), M (merge), S (strings)
I (info), L (link order), G (group), x (unknown)


ちゃんと出来てますね(´ー`)typeとか弄った方が良いんですが、そういうのは追々やってまいります。

Posted by minemaz at 2009年10月16日 15:30
トラックバック
このエントリーのトラックバックURL:
http://www.lancard.com/mt/mt-tb.cgi/473

Comments
Post a comment









Remember personal info?