How to resolve duplicate symbol link static library

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


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

ar -x lib.a

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

nm a.o


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


icipereporu (not verified)

Wed, 10/28/2020 - 21:25

Also, unsupported [URL= - what does cialis do for women[/URL - [URL= - finpecia for sale[/URL - [URL= - vidalista[/URL - prices for vidalista [URL= - prelone[/URL - [URL= - cialis[/URL - [URL= - amoxil[/URL - [URL= - sildenafil vs cialis[/URL - [URL= - zithromax online[/URL - [URL= - kamagra jelly for sale[/URL - [URL= - propecia buy online[/URL - [URL= - buy nolvadex online[/URL - [URL= - lasix[/URL - [URL= - levaquin and flagyl same iv line[/URL - [URL= - pharmacy[/URL - [URL= - 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 canada pharmacy online viagra cheapest 100mg soft exhibit elucidating what does cialis do for women finpecia without prescription lowest price on generic vidalista prelone online usa cialis buy amoxicillin online whats best viagra cialis zithromax on internet uses of zithromax 500mg buy cheap kamagra from india propecia overnight nolvadex lasix without a prescription metronidazole in cats pharmacy viagra soft from india cerebellum statutory.

ideqkuiajep (not verified)

Wed, 10/28/2020 - 21:27

Cervical polyhydramnios, [URL= - prednisone 10 mg[/URL - [URL= - finpecia[/URL - [URL= - cialis[/URL - [URL= - zanaflex generic[/URL - [URL= - levitra canada[/URL - levitra [URL= - cheapest plaquenil dosage price[/URL - [URL= - buspar without a prescription[/URL - [URL= - diovan non generic[/URL - [URL= - pharmacy prices for levitra[/URL - [URL= - cipro[/URL - [URL= - canada pharmacy online[/URL - [URL= - copegus for sale[/URL - [URL= - canada online pharmacy[/URL - [URL= - buy amoxicillin[/URL - [URL= - 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, buy prednisone on line finpecia buy cialis zanaflex without a prescription levitra 20mg information plaquenil price of buspar generic diovan in canada diovan online levitra canada ciprofloxacin 500mg antibiotics walmart pharmacy price pharmacy online copegus without a prescription cialis online pharmacy amoxicillin prednisone rx scanning, surplus radiotherapy; plans.

ikvxieh (not verified)

Wed, 10/28/2020 - 21:28

Continual inflate [URL= - diovan[/URL - [URL= - cialis commercial[/URL - [URL= - skelaxin[/URL - [URL= - prednisone dosage for a flare-up[/URL - [URL= - mail order prednisone[/URL - [URL= - levitra online[/URL - [URL= - propecia online pharmacy[/URL - [URL= - levitra 20mg prices[/URL - [URL= - womenra online no script[/URL - [URL= - purchase amoxil[/URL - [URL= - cialis soft without insurance[/URL - cialis soft [URL= - asthalin[/URL - [URL= - lowest cialis prices[/URL - [URL= - generic amoxicillin 500 mg[/URL - [URL= - lowest price[/URL - cures diovan in usa cialis 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 diovan to buy cialis 20 mg best price skelaxin cost buying prednisone online prednisone no prescription levitra online pharmacy levitra cheap cheapest womenra amoxicillin for sale cialis soft cialis tadalafil 20 mg amoxicillin 500mg capsules for sale 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.