[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/27755] New: [powerpc] fails to link binary which does not fit wi
From: |
rin at NetBSD dot org |
Subject: |
[Bug ld/27755] New: [powerpc] fails to link binary which does not fit within R_PPC_REL24 |
Date: |
Tue, 20 Apr 2021 00:42:12 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=27755
Bug ID: 27755
Summary: [powerpc] fails to link binary which does not fit
within R_PPC_REL24
Product: binutils
Version: 2.36
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: ld
Assignee: unassigned at sourceware dot org
Reporter: rin at NetBSD dot org
Target Milestone: ---
Created attachment 13386
--> https://sourceware.org/bugzilla/attachment.cgi?id=13386&action=edit
Fix for this bug
Try to link binary whose text segment does not fit within R_PPC_REL24
results in infinite recursion in ppc_elf_inline_plt():
% cat test.c
#include <stdio.h>
int main(void) {
printf("Hello, ");
__asm volatile(".rept 16777216; nop; .endr"); /* 2^24 nop's */
printf("World!\n");
return 0;
}
% cc -mlongcall test.c
... freeze in ld(1) ...
This is due to missing of increment of loop variable in ppc_elf_inline_plt().
See the attached patch for more details.
This bug exists also for HEAD as of today, and was introduced to commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=3e04d7655bf63f4e5a0d0354c21aa3fa2ece3681
i.e., first revision where ppc_elf_inline_plt() was added.
With the attached patch, the above test.c successfully links for powerpc.
I've never tested for powerpc64, but it should work also.
----
% ld --version
GNU ld (NetBSD Binutils nb1) 2.34
Copyright (C) 2020 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
----
% cc --version
powerpc--netbsd-gcc (NetBSD nb1 20210411) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/27755] New: [powerpc] fails to link binary which does not fit within R_PPC_REL24,
rin at NetBSD dot org <=