https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60465

--- Comment #37 from Sergei Trofimovich <slyfox at inbox dot ru> ---
The patch also fixes this old bug:
    https://bugzilla.redhat.com/show_bug.cgi?id=33354

Despite being marked as fixed it fails on modern toolchain with slight
overflow.
Address of local constant was done over .got as well:

.c source:
    static char *s90;
    void f() { s90 = "string 90"; }

Compiled as gcc -fpic -S.

before:

        .sbss
    s90:
        .skip   8

        .section        .rodata
    .LC0:
        stringz "string 90"

        .text
    f:
        ...
        addl r14 = @gprel(s90#), gp
        addl r15 = @ltoffx(.LC0), r1
        ld8.mov r15 = [r15], .LC0
        st8 [r14] = r15
        ...

 after:

        .sbss
    s90:
        .skip   8

        .section        .rodata
    .LC0:
        stringz "string 90"

        .text
    f:
        ...
        addl r14 = @gprel(s90#), gp
        movl r15 = @gprel(.LC0)
        add r15 = r1, r15
        st8 [r14] = r15

Reply via email to