Linux???????????????????
???????????? ???????[ 2014/6/5 10:09:22 ] ?????????????? Linux ????? ?????
??????5??????.o???????????????
???????????????????淶????????????????淶??????????????????????lib???????????????.so?????磺??????????????????myhello??????????????libmyhello.so????gcc???????????
????????????????????????????????????libmyhello.so??
????# gcc -shared -fPCI -o libmyhello.so hello.o
????#
???????????????ls????????????????????ɡ?
????# ls
????hello.c hello.h hello.o libmyhello.so main.c
????#
??????6??????????????????
?????????????????????t???????????????????????Щ???ú???????????а?????Щ???ú?????????????????????gcc????????????????????????????б?????????????gcc?????????????????????????????????
????# gcc -o hello main.c -L. -l myhello
????# ./hello
????./hello: error while loading shared libraries: libmyhello.so: cannot open shared object
????file: No such file or directory
????#
?????????????????????????????????????????????libmyhello.so???????????????????/usr/lib??/lib?????в???????????????????????????????????????????????????????????????С?????????libmyhello.so???????/usr/lib?У????????
????# mv libmyhello.so /usr/lib
????# ./hello
????./hello: error while loading shared libraries: /usr/lib/libhello.so: cannot restore segment
????prot after reloc: Permission denied
????????SELinux????
????# chcon -t texrel_shlib_t /usr/lib/libhello.so
????# ./hello
????Hello everyone!
????#
?????????????????????????????????????????????
???????????????????????t??????????????????????????gcc???????????????????????????????gcc??????????????????????????????????????飬?????????
????????? ??.c??.h??? ??????????????????????????????????
????# rm -f hello hello.o /usr/lib/libmyhello.so
????# ls
????hello.c hello.h main.c
????#
????????????????????libmyhello.a?????????libmyhello.so??
????# gcc -c hello.c
????# ar cr libmyhello.a hello.o
????# gcc -shared -fPCI -o libmyhello.so hello.o
????# ls
????hello.c hello.h hello.o libmyhello.a libmyhello.so main.c
????#
????????????????ls??????????????????libmyhello.a?????????libmyhello.so?????????????????????С????????????gcc????????ú?????myhello??????????hello???????г???hello??
????# gcc -o hello main.c -L. -lmyhello
????# ./hello
????./hello: error while loading shared libraries: libmyhello.so: cannot open shared object
????file: No such file or directory
????#
?????????hello???е????к???????????????????????????? gcc???????????????
???????????????????淶????????????????淶??????????????????????lib???????????????.so?????磺??????????????????myhello??????????????libmyhello.so????gcc???????????
????????????????????????????????????libmyhello.so??
????# gcc -shared -fPCI -o libmyhello.so hello.o
????#
???????????????ls????????????????????ɡ?
????# ls
????hello.c hello.h hello.o libmyhello.so main.c
????#
??????6??????????????????
?????????????????????t???????????????????????Щ???ú???????????а?????Щ???ú?????????????????????gcc????????????????????????????б?????????????gcc?????????????????????????????????
????# gcc -o hello main.c -L. -l myhello
????# ./hello
????./hello: error while loading shared libraries: libmyhello.so: cannot open shared object
????file: No such file or directory
????#
?????????????????????????????????????????????libmyhello.so???????????????????/usr/lib??/lib?????в???????????????????????????????????????????????????????????????С?????????libmyhello.so???????/usr/lib?У????????
????# mv libmyhello.so /usr/lib
????# ./hello
????./hello: error while loading shared libraries: /usr/lib/libhello.so: cannot restore segment
????prot after reloc: Permission denied
????????SELinux????
????# chcon -t texrel_shlib_t /usr/lib/libhello.so
????# ./hello
????Hello everyone!
????#
?????????????????????????????????????????????
???????????????????????t??????????????????????????gcc???????????????????????????????gcc??????????????????????????????????????飬?????????
????????? ??.c??.h??? ??????????????????????????????????
????# rm -f hello hello.o /usr/lib/libmyhello.so
????# ls
????hello.c hello.h main.c
????#
????????????????????libmyhello.a?????????libmyhello.so??
????# gcc -c hello.c
????# ar cr libmyhello.a hello.o
????# gcc -shared -fPCI -o libmyhello.so hello.o
????# ls
????hello.c hello.h hello.o libmyhello.a libmyhello.so main.c
????#
????????????????ls??????????????????libmyhello.a?????????libmyhello.so?????????????????????С????????????gcc????????ú?????myhello??????????hello???????г???hello??
????# gcc -o hello main.c -L. -lmyhello
????# ./hello
????./hello: error while loading shared libraries: libmyhello.so: cannot open shared object
????file: No such file or directory
????#
?????????hello???е????к???????????????????????????? gcc???????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??