Bug 26173 - powerpc64*: Add @notoc to calls to functions that do not preserve r2
Summary: powerpc64*: Add @notoc to calls to functions that do not preserve r2
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.32
: P2 normal
Target Milestone: 2.32
Assignee: Tulio Magno Quites Machado Filho
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-25 19:55 UTC by Tulio Magno Quites Machado Filho
Modified: 2020-07-10 23:11 UTC (History)
1 user (show)

See Also:
Host: powerpc64*
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tulio Magno Quites Machado Filho 2020-06-25 19:55:36 UTC
The latest linker version started to report calls from functions that are expected to preserve r2 to functions that do not preserve r2, causing build failures in glibc, e.g.:

sysdeps/unix/sysv/linux/powerpc/powerpc64/makecontext.S:163:(.text+0xfc): call to `__GI_exit' lacks nop, can't restore toc; (toc save/adjust stub)

More details are available in Binutils bug #26164.
Comment 1 Tulio Magno Quites Machado Filho 2020-06-26 15:17:32 UTC
A patch to fix this has been proposed at: https://patchwork.sourceware.org/project/glibc/patch/20200625230224.301671-1-tuliom@linux.ibm.com/
Comment 2 Tulio Magno Quites Machado Filho 2020-07-10 23:11:43 UTC
Fixed in 2.32 with:

commit 7c7bcf3634e44cf7e001aaa302138c1ee0e58f8c
Author: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Date:   Fri Jul 10 19:41:06 2020 -0300

    powerpc64: Fix calls when r2 is not used [BZ #26173]
    
    Teach the linker that __mcount_internal, __sigjmp_save_symbol,
    __syscall_error and __GI_exit do not use r2, so that it does not need to
    recover r2 after the call.
    
    Test at configure time if the assembler supports @notoc and define
    USE_PPC64_NOTOC.