https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577
--- Comment #191 from dave.anglin at bell dot net --- On 2020-02-19 9:50 p.m., peter.bisroev at groundlabs dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61577 > > --- Comment #190 from Peter Bisroev <peter.bisroev at groundlabs dot com> --- > (In reply to dave.anglin from comment #189) >> On 2020-02-16 4:21 p.m., John David Anglin wrote: >>> On 2020-02-15 3:32 p.m., peter.bisroev at groundlabs dot com wrote: >>>> I have not had a chance to look through these in great detail, will do this >>>> later today, but some things I've noticed (not sure how important they are >>>> yet): >>>> - aCC seems to use PCREL21BI relocations while GCC PCREL21B. >>> That may be the clue. With GNU ld, only PCREL21BI goes through PLT. Need >>> to look at when >>> GNU as uses PCREL21BI instead of PCREL21B. I believe this selection is >>> done in assembler. >> Sorry, only PCREL21B goes through PLT. PCREL21BI is for local (internal) >> calls. > Hi Dave, I apologize for the delay in response, been a busy week so far. > However I should be able to take a look at this further tomorrow. > > As per your recommendation I will try and find out when GNU as generates > PCREL21BI relocations instead of PCREL21B. I am assuming this is what we want > in order to match aCC behavior, right? I Peter, no problem. I've been busy... The problem seems to be that HP ld doesn't handle the PCREL21B relocation correctly when it refers to a weak function (i.e., it doesn't direct the call through the PLT). At the same time, weak references don't seem to work with aCC. As far as I can tell, the PCREL21B is generated by gas in gas/config/tc-ia64.c at line 5919. You could try changing it to PCREL21BI to see if that helps (run binutils testsuite before installing) but the change doesn't seem correct. We might need to generate a 32-bit branch to weak functions in gcc. It would be useful to find out why weak doesn't work with aCC.