https://sourceware.org/bugzilla/show_bug.cgi?id=32772

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nelsonc1225 at sourceware dot 
org

--- Comment #3 from Sam James <sam at gentoo dot org> ---
Started with:

commit 4295841be4392fcff33a1efee6d4345063021e6b
Author: Nelson Chu <nel...@rivosinc.com>
Date:   Sat Feb 8 16:33:37 2025 +0800

    RISC-V: Go PLT for CALL/JUMP/RVC_JUMP if `h->plt.offset' isn't -1

    I got an request about the undefined behaviors, considering the following
case,

    $ cat test.c
    void main ()
    {
      foo();
    }
    $ cat lib.h
    void foo(void);
    $ riscv64-unknown-linux-gnu-gcc test.c
    riscv64-unknown-linux-gnu/bin/ld: /tmp/ccRO8fJl.o: in function `main':
    test.c:(.text+0x8): undefined reference to `foo'
    collect2: error: ld returned 1 exit status
    $ riscv64-unknown-linux-gnu-gcc test.c
-Wl,--unresolved-symbols=ignore-in-object-files
    $ qemu-riscv64 a.out
    Segmentation fault (core dumped)

    Testing with x86 and aarch64, they won't get the segfault since they go plt
    for the undefined foo symbol.  So, after applying this patch, I can get the
    following too,

    $ qemu-riscv64 a.out
    a.out: symbol lookup error: a.out: undefined symbol: foo

    The change of this patch should only affect the call behavior, which refer
    to an undefined (weak) symbol, when building an dynamic executable.  I
think
    the pic/pie behavior won't be affected as usual.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to