How to resolve duplicate symbol link static library

Submitted by lepton on Fri, 05/20/2016 - 11:35

Tags

首先从静态库中解压 .o 文件

ar -x lib.a

nm查看符号表  找到重复的函数符号名

nm a.o

c和c++的符号表不一样

0000000000000000 T __Z4testv //c++

0000000000000000 T test //c

 

隐藏符号 相当于加 static

ld -r a.o -unexported_symbol  __Z4testv -o c.o; rm a.o; mv c.o a.o //mac 下可使用

objcopy --localize-symbol=_Z4testv a.o
 

修改符号名称

ld -r a.o -alias __Z4testv test_c  -unexported_symbol  __Z4testv -o c.o //mac 下可使用

objcopy --redefine-sym _Z4testv=test_a a.o

如果其他 .o文件引用了这个函数 对每一个文件都要执行

find ./ -name "*.o" -exec objcopy --redefine-sym _Z4testv=test_a {} \;

 

可以给所有函数加前缀
c语言可以 函数改名变成foo_test
c++因为引入了很多系统函数 只能用上面的方法一个一个该

objcopy --prefix-symbols=foo_ a.o

重新生成静态库

ar crs lib.a *.o

Comments

icipereporu (not verified)

Wed, 10/28/2020 - 21:25

Also, scr.pafy.leptonstar.com.xji.is unsupported [URL=http://charlotteelliottinc.com/medicine/generic-soft-tabs-cialis/ - what does cialis do for women[/URL - [URL=http://lowesmobileplants.com/product/finpecia/ - finpecia for sale[/URL - [URL=http://themusicianschoice.net/prices-for-vidalista/ - vidalista[/URL - prices for vidalista [URL=http://eatingaftergastricbypass.net/prelone/ - prelone[/URL - [URL=http://davincipictures.com/cialis-20-mg-price/ - cialis[/URL - [URL=http://lokcal.org/amoxicillin/ - amoxil[/URL - [URL=http://palcouponcodes.com/cialis-russia/ - sildenafil vs cialis[/URL - [URL=http://fitnesscabbage.com/zithromax-online/ - zithromax online[/URL - [URL=http://mannycartoon.com/kamagra-oral-jelly/ - kamagra jelly for sale[/URL - [URL=http://memoiselle.com/propecia/ - propecia buy online[/URL - [URL=http://ossoccer.org/nolvadex/ - buy nolvadex online[/URL - [URL=http://thegrizzlygrowler.com/lasix-online/ - lasix[/URL - [URL=http://disasterlesskerala.org/metronidazole-500-mg-antibiotic/ - levaquin and flagyl same iv line[/URL - [URL=http://iliannloeb.com/online-pharmacy/ - pharmacy[/URL - [URL=http://themusicianschoice.net/viagra-soft/ - soft viagra 100mg tablets[/URL - grooved dipstick itch what does cialis do for women cialis black 800mg finpecia for sale prices for vidalista canadian pharmacy prelone cialis 20 mg amoxicillin buy online buycialisprofessional cialis azithromycin for acne zithromax on internet kamagra propecia buy nolvadex lasix furosemide for sale lasix online metronidazole 500 mg antibiotic northwestpharmacy.com canada pharmacy online viagra cheapest 100mg soft exhibit elucidating http://charlotteelliottinc.com/medicine/generic-soft-tabs-cialis/ what does cialis do for women http://lowesmobileplants.com/product/finpecia/ finpecia without prescription http://themusicianschoice.net/prices-for-vidalista/ lowest price on generic vidalista http://eatingaftergastricbypass.net/prelone/ prelone online usa http://davincipictures.com/cialis-20-mg-price/ cialis http://lokcal.org/amoxicillin/ buy amoxicillin online http://palcouponcodes.com/cialis-russia/ whats best viagra cialis http://fitnesscabbage.com/zithromax-online/ zithromax on internet uses of zithromax 500mg http://mannycartoon.com/kamagra-oral-jelly/ buy cheap kamagra from india http://memoiselle.com/propecia/ propecia http://ossoccer.org/nolvadex/ overnight nolvadex http://thegrizzlygrowler.com/lasix-online/ lasix without a prescription http://disasterlesskerala.org/metronidazole-500-mg-antibiotic/ metronidazole in cats http://iliannloeb.com/online-pharmacy/ pharmacy http://themusicianschoice.net/viagra-soft/ viagra soft from india cerebellum statutory.

ideqkuiajep (not verified)

Wed, 10/28/2020 - 21:27

Cervical rbt.ilgx.leptonstar.com.iul.nh polyhydramnios, [URL=http://mannycartoon.com/prednisone-for-dogs/ - prednisone 10 mg[/URL - [URL=http://iliannloeb.com/finpecia/ - finpecia[/URL - [URL=http://healthkosh.com/buy-cialis/ - cialis[/URL - [URL=http://calendr.net/zanaflex/ - zanaflex generic[/URL - [URL=http://eatingaftergastricbypass.net/levitra-online/ - levitra canada[/URL - levitra [URL=http://oliveogrill.com/plaquenil-generic-canada/ - cheapest plaquenil dosage price[/URL - [URL=http://mannycartoon.com/buspar/ - buspar without a prescription[/URL - [URL=http://aawaaart.com/diovan-without-dr-prescription/ - diovan non generic[/URL - [URL=http://oliveogrill.com/levitra-generic-pills/ - pharmacy prices for levitra[/URL - [URL=http://aawaaart.com/ciprofloxacin-500-mg/ - cipro[/URL - [URL=http://frankfortamerican.com/pharmacy-online/ - canada pharmacy online[/URL - [URL=http://americanartgalleryandgifts.com/copegus/ - copegus for sale[/URL - [URL=http://gaiaenergysystems.com/product/northwest-pharmacy-canada/ - canada online pharmacy[/URL - [URL=http://frankfortamerican.com/amoxicillin-500-mg-to-buy/ - buy amoxicillin[/URL - [URL=http://buckeyejeeps.com/canadian-prednisone/ - prednisone 20 mg purchase no rx[/URL - mass, embark chickens overnight prednisone prednisone finpecia without prescription cialis cheapest price 20mg cialis zanaflex levitra online non prescription plaquenil online buspar diovan non generic levitra ciprofloxacin 500mg usa pharmacy online copegus for sale northwest pharmacy canada amoxicillin prp prednisone absorption, http://mannycartoon.com/prednisone-for-dogs/ buy prednisone on line http://iliannloeb.com/finpecia/ finpecia http://healthkosh.com/buy-cialis/ buy cialis http://calendr.net/zanaflex/ zanaflex without a prescription http://eatingaftergastricbypass.net/levitra-online/ levitra 20mg information http://oliveogrill.com/plaquenil-generic-canada/ plaquenil http://mannycartoon.com/buspar/ price of buspar http://aawaaart.com/diovan-without-dr-prescription/ generic diovan in canada diovan online http://oliveogrill.com/levitra-generic-pills/ levitra canada http://aawaaart.com/ciprofloxacin-500-mg/ ciprofloxacin 500mg antibiotics http://frankfortamerican.com/pharmacy-online/ walmart pharmacy price pharmacy online http://americanartgalleryandgifts.com/copegus/ copegus without a prescription http://gaiaenergysystems.com/product/northwest-pharmacy-canada/ cialis online pharmacy http://frankfortamerican.com/amoxicillin-500-mg-to-buy/ amoxicillin http://buckeyejeeps.com/canadian-prednisone/ prednisone rx scanning, surplus radiotherapy; plans.

ikvxieh (not verified)

Wed, 10/28/2020 - 21:28

Continual jsp.fops.leptonstar.com.fic.zn inflate [URL=http://aawaaart.com/diovan/ - diovan[/URL - [URL=http://recipiy.com/cialis-20-mg-best-price/ - cialis commercial[/URL - [URL=http://iliannloeb.com/skelaxin/ - skelaxin[/URL - [URL=http://livinlifepc.com/buying-prednisone-online/ - prednisone dosage for a flare-up[/URL - [URL=http://homemenderinc.com/prednisone-no-prescription/ - mail order prednisone[/URL - [URL=http://gunde1resim.com/levitra-online/ - levitra online[/URL - [URL=http://recipiy.com/canadian-pharmacy-cialis/ - propecia online pharmacy[/URL - [URL=http://eatingaftergastricbypass.net/levitra-online/ - levitra 20mg prices[/URL - [URL=http://recipiy.com/drugs/where-to-buy-womenra/ - womenra online no script[/URL - [URL=http://recipiy.com/amoxil-500-mg/ - purchase amoxil[/URL - [URL=http://bootstrapplusplus.com/cialis-soft/ - cialis soft without insurance[/URL - cialis soft [URL=http://eatingaftergastricbypass.net/item/asthalin/ - asthalin[/URL - [URL=http://gccroboticschallenge.com/cheapest-cialis/ - lowest cialis prices[/URL - [URL=http://timtheme.com/amoxicillin/ - generic amoxicillin 500 mg[/URL - [URL=http://elearning101.org/product/celin/ - celin.com lowest price[/URL - cures diovan in usa cialis cialis.com lowest price on line skelaxin drug list of prednisone prednisone online uk levitra online pharmacy canadian pharmacy cialis generic levitra 40 mg levitra 20 mg prix where to buy womenra order amoxicillin cialis soft 40mg cialis soft 40mg cheapest asthalin dosage price cialis buy amoxicillin 500 mg celin best price undeclared gene http://aawaaart.com/diovan/ diovan to buy http://recipiy.com/cialis-20-mg-best-price/ cialis 20 mg best price http://iliannloeb.com/skelaxin/ skelaxin cost http://livinlifepc.com/buying-prednisone-online/ buying prednisone online http://homemenderinc.com/prednisone-no-prescription/ prednisone no prescription http://gunde1resim.com/levitra-online/ levitra online http://recipiy.com/canadian-pharmacy-cialis/ pharmacy http://eatingaftergastricbypass.net/levitra-online/ levitra cheap http://recipiy.com/drugs/where-to-buy-womenra/ cheapest womenra http://recipiy.com/amoxil-500-mg/ amoxicillin for sale http://bootstrapplusplus.com/cialis-soft/ cialis soft http://eatingaftergastricbypass.net/item/asthalin/ asthalin.com http://gccroboticschallenge.com/cheapest-cialis/ cialis tadalafil 20 mg http://timtheme.com/amoxicillin/ amoxicillin 500mg capsules for sale http://elearning101.org/product/celin/ celin aircraft, vaccinees.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.