[Bug other/60465] Compiling glibc-2.17,2.18 with gcc-4.8.2 and binutils-2.23.2,2.24 results in segfaults in _start / elf_get_dynamic_info

slyfox at inbox dot ru gcc-bugzilla@gcc.gnu.org
Tue Dec 29 10:35:00 GMT 2015


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


More information about the Gcc-bugs mailing list