Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-pcd!hpfcso!mjs From: mjs@hpfcso.FC.HP.COM (Marc Sabatella) Newsgroups: comp.sys.hp Subject: Re: WANTED: patch/zap program for HP9000 Message-ID: <7370389@hpfcso.FC.HP.COM> Date: 6 May 91 16:53:10 GMT References: <3276@enea.se> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 40 > The symbol in at least one of the libraries is not used externally, > so it seems possible to solve the problem by changing all occurences > with a patch program. > >Use the -r and -h options to ld(1). More particularly, if by "not used externally" you mean it isn't used outside of the particular object file within the library, then you can extract that module, run it through "ld -r -h symbolname", and then replace the module in the library: ar x library.a module.o ld -r -h symbol module.o mv a.out module.o ar r library.a module.o This will hide the symbol from other modules, ensuring that it does not conflict with the other symbol of the same name. However, if by "not used externally" you mean that it isn't used outside the library, but is used within the library, this won't work - the other modules within the library won't be able to access the symbol. If there are only a few modules involved, you might consider extracting them, linking them all together with "ld -r -h", putting the new combined file back into the archive, and then deleting the original versions from the library. If that isn't feasible, then you will indeed need some sort of byte editor. You should extract each affected module, patch them, and replace them in the library. You can use "nm" to find which modules within the library define and use the symbol. There is no binrary editor supplied with HP-UX that I am aware of, but Emacs has a binary mode. Also, there is generally only one occurence of the symbol name in the file, at least on the Series 300 and 400; it shouldn't be terribly difficult to write a program to find it, hack it, and write it back out. -------------- Marc Sabatella (marc@hpmonk.fc.hp.com) Disclaimers: 2 + 2 = 3, for suitably small values of 2 Bill and Dave may not always agree with me