https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577
--- Comment #196 from dave.anglin at bell dot net --- On 2020-02-21 10:55 p.m., peter.bisroev at groundlabs dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577 > > --- Comment #194 from Peter Bisroev <peter.bisroev at groundlabs dot com> --- > (In reply to dave.anglin from comment #193) >> I presume that if you compile main.cc with g++, hello() becomes weak. You >> could test with a second instance of hello. > Yes, sorry forgot to mention that. When I compile with gcc hello() becomes > weak > as expected. One question though, what do you mean with the second instance of > hello? If you create a second object file with a second instance of hello, the linker should not complain about the second definition of hello since it is weak. It would complain about two global instances. One major difference between GNU weak definitions and HP sdef definitions is that the HP linker and dynamic loader don't like undefined sdef symbols. In PA-RISC, there's no way to override this in the dynamic loader. > The comdat testing that I have performed in comment 181 and comment 185 by > forcing the use of comdat with --enable-comdat definitely made things better > as > we got a significant reduction in PCREL21B linking errors. However some still > remained. Is it because the use of --enable-comdat did not apply to all the > code (such as libraries), or even when usage of comdat is forced, HP's ld > still > keeps unnecessary instances around? I don't know whether HP's ld removes unecessary comdat instances. Even with comdat groups enabled, I think we still have some use of weak because of how MAKE_DECL_ONE_ONLY is defined. Could you test whether the "brl" branch works? Simply take your main.s file and edit the branch to hello. This should show whether the assembler can handle it. If it assembles, look at relocation and see if program will link.