$ git checkout upstream/br1
Note: checking out 'upstream/br1'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at bd026e3... test
$ make clean
rm -rf test test.o main_test.o
$ make
cc -g -c -o test.o test.c
cc -g -c -o main_test.o main_test.c
cc -g test.o main_test.o -o test
$ ./test
Hello Wen Liao
$ ls test -gG
-rwxrwxr-x 1 10217 Nov 16 22:33 test
可以看到產生出來的執行檔有10217 bytes。我們進一步來看執行檔的symbol。
1234567891011121314
$ nm test
0000000000601050 B __bss_start
...
0000000000601040 D g_myStr
00000000004003e0 T _init
...
0000000000601048 d gp_myStr
...
000000000040056d T main
U printf@@GLIBC_2.2.5
...
000000000040052d t s_test
0000000000400553 T test
0000000000601050 D __TMC_END__
$ make clean
rm -rf test test.o main_test.o
$ make
cc -g -c -o test.o test.c
cc -g -c -o main_test.o main_test.c
cc -g test.o main_test.o -o test
$ nm -a test.o
0000000000000000 b .bss
0000000000000000 n .comment
0000000000000000 d .data
0000000000000000 N .debug_abbrev
0000000000000000 N .debug_aranges
0000000000000000 N .debug_info
0000000000000000 N .debug_line
0000000000000000 N .debug_str
0000000000000000 r .eh_frame
0000000000000000 D g_myStr
0000000000000008 d gp_myStr
0000000000000000 n .note.GNU-stack
U printf
0000000000000000 r .rodata
0000000000000000 t s_test
0000000000000026 T test
0000000000000000 a test.c
0000000000000000 t .text
$ ls -gG test.o
-rw-rw-r-- 1 3944 Nov 16 23:02 test.o
$ strip test.o
$ ls -gG test.o
-rw-rw-r-- 1 952 Nov 16 23:03 test.o
$ nm test.o
nm: test.o: no symbols
$ make
cc -g test.o main_test.o -o test
/usr/bin/ld: error in test.o(.eh_frame); no .eh_frame_hdr table will be created.
main_test.o: In function `main':
/home/wen/tmp/sandbox/main_test.c:6: undefined reference to `test'
collect2: error: ld returned 1 exit status
make: *** [test] Error 1
這邊我nm下了-a參數,這會顯示出所有的symbol,預設的nm輸出如下提供比較。
123456
$ nm test.o
0000000000000000 D g_myStr
0000000000000008 d gp_myStr
U printf
0000000000000000 t s_test
0000000000000026 T test
$ make clean
rm -rf test test.o main_test.o
$ ls -gG test.o
-rw-rw-r-- 1 3944 Nov 16 23:02 test.o
$ make
cc -g -c -o test.o test.c
cc -g -c -o main_test.o main_test.c
cc -g test.o main_test.o -o test
$ ls -gG test.o
-rw-rw-r-- 1 3944 Nov 16 23:02 test.o
$ strip -d test.o
$ nm -a test.o
0000000000000000 b .bss
0000000000000000 n .comment
0000000000000000 d .data
0000000000000000 r .eh_frame
0000000000000000 D g_myStr
0000000000000008 d gp_myStr
0000000000000000 n .note.GNU-stack
U printf
0000000000000000 r .rodata
0000000000000000 t s_test
0000000000000026 T test
0000000000000000 t .text
$ make
cc -g test.o main_test.o -o test
$ ./test
Hello Wen Liao
$ ls -gG test test.o
-rwxrwxr-x 1 9737 Nov 16 23:01 test
-rw-rw-r-- 1 1896 Nov 16 23:01 test.o
$ nm -a libtest.so
0000000000000000 a
0000000000201048 b .bss
0000000000201048 B __bss_start
0000000000000000 n .comment
0000000000201048 b completed.6973
0000000000000000 a crtstuff.c
0000000000000000 a crtstuff.c
w __cxa_finalize@@GLIBC_2.2.5
0000000000201030 d .data
0000000000000000 N .debug_abbrev
0000000000000000 N .debug_aranges
0000000000000000 N .debug_info
0000000000000000 N .debug_line
0000000000000000 N .debug_str
0000000000000650 t deregister_tm_clones
00000000000006c0 t __do_global_dtors_aux
0000000000200df0 t __do_global_dtors_aux_fini_array_entry
0000000000201030 d __dso_handle
0000000000200e00 d .dynamic
0000000000200e00 d _DYNAMIC
0000000000000398 r .dynstr
0000000000000230 r .dynsym
0000000000201048 D _edata
00000000000007c0 r .eh_frame
000000000000079c r .eh_frame_hdr
0000000000201050 B _end
000000000000077c T _fini
000000000000077c t .fini
0000000000200df0 t .fini_array
0000000000000700 t frame_dummy
0000000000200de8 t __frame_dummy_init_array_entry
0000000000000840 r __FRAME_END__
0000000000201000 d _GLOBAL_OFFSET_TABLE_
w __gmon_start__
0000000000201038 D g_myStr
00000000000001f0 r .gnu.hash
000000000000045c r .gnu.version
0000000000000480 r .gnu.version_r
0000000000200fd0 d .got
0000000000201000 d .got.plt
0000000000201040 d gp_myStr
00000000000005f0 T _init
00000000000005f0 t .init
0000000000200de8 t .init_array
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
0000000000200df8 d .jcr
0000000000200df8 d __JCR_END__
0000000000200df8 d __JCR_LIST__
w _Jv_RegisterClasses
00000000000001c8 r .note.gnu.build-id
0000000000000610 t .plt
U printf@@GLIBC_2.2.5
0000000000000680 t register_tm_clones
00000000000004a0 r .rela.dyn
00000000000005a8 r .rela.plt
0000000000000785 r .rodata
0000000000000735 t s_test
0000000000000760 T test
0000000000000000 a test.c
0000000000000650 t .text
0000000000201048 d __TMC_END__
$ ls -gG libtest.so
-rwxrwxr-x 1 9275 Nov 16 23:47 libtest.so
$ strip libtest.so
$ ls -gG libtest.so
-rwxrwxr-x 1 6104 Nov 16 23:47 libtest.so
$ nm -a libtest.so
nm: libtest.so: no symbols
$ LD_LIBRARY_PATH=`pwd` ./test
Hello Wen Liao
# Prints @author tags if set to "yes".
tag.author=yes
# Prints @version tags if set to "yes".
tag.version=yes
# Prints @since tags if set to "yes".
tag.since=yes
# Show the Summary Tables if set to "yes".
summary.table=yes
# Encrypts the document if set to "yes".
encrypted=yes
# The following property is ignored
# if "encrypted" is not set to yes.
allow.printing=yes
# Creates hyperlinks if set to "yes".
# For print documents, use "no", so
# there will be no underscores.
create.links=yes
# Creates an alphabetical index of all
# classes and members at the end of the
# document if set to "yes".
create.index=yes
# Creates a navigation frame (or PDF
# outline tree) if set to "yes".
create.frame=yes
# Creates a title page at the beginning
# of the document if set to "yes".
api.title.page=yes
# Defines the title on the title page if
# no external HTML page is used.
api.title=Test pdfdoeclet
# Defines the author text on the
# title page.
api.author=by Wen Liao
packagecom.test;publicclasstest{publicclassmul{publicintmultiply(inti,intj){returni*j;}}publicstaticfinalintMAX_NUM=9;publicstaticvoidmain(String[]args){testmy_test=newtest();my_test.hello();}privatevoidhello(){mulmy_mul=newmul();for(inti=1;i<=MAX_NUM;i++){for(intj=1;j<=MAX_NUM;j++){System.out.println(i+" x "+j+" = "+my_mul.multiply(i,j));}}}}
<html><body>This a overview document for testing. It should supports javadoc overview tags. However, somehow my pdfdoclet did not get javadoc tag to work while javadoc generated file has no problem at all. There might some missing actions.
</body></html>
package-info.java
package-info.java
12345
/** * This is a page to describe your package */packagetest;
packagecom.test;/** * A example to test javadoc tags * <p> * @see mul * @see test.mul#multiply*/publicclasstest{/** * multiply class, used by {@link test class test} */publicclassmul{/** * @param i operand 1 * @param j operand 2 * @return result of i * j */publicintmultiply(inti,intj){returni*j;}}/** * Number of loop in multiplication: {@value} */publicstaticfinalintMAX_NUM=9;publicstaticvoidmain(String[]args){testmy_test=newtest();my_test.hello();}privatevoidhello(){mulmy_mul=newmul();for(inti=1;i<=MAX_NUM;i++){for(intj=1;j<=MAX_NUM;j++){System.out.println(i+" x "+j+" = "+my_mul.multiply(i,j));}}}}