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

Zheng Bao <fishbaoz at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fishbaoz at hotmail dot com

--- Comment #9 from Zheng Bao <fishbaoz at hotmail dot com> ---
Test based on latest binutils. No segmentation fault.

$ cat main.c
extern void foo (void);
extern void bar (void);

int
main ()
{
  foo ();
  bar ();
  return 0;
}

$ cat foo.c
#include <stdio.h>

void
foo (void)
{
          printf ("hello\n");
}

$ cat gap.s
        .text
        .p2align 4,,15
        .globl  bar
        .type   bar, @function
bar:
        jmp .L0
        .space 0x40000000, 0x90
.L0:
        jmp .L2
        .space 0x3fdffe14, 0x90
.L2:
        leaq    .L2(%rip), %rcx
        movabsq $_GLOBAL_OFFSET_TABLE_-.L2, %r11
        movabsq $foo@PLTOFF, %rax
        addq    %r11, %rcx
        addq    %rcx, %rax
        jmp     *%rax
        .size   bar, .-bar
        .section .note.GNU-stack,"",@progbits

$ gcc -O2   -c -o main.o main.c
$ gcc -O2 -c -o gap.o gap.s
$ gcc -O2 -mcmodel=large -fpic   -c -o foo.o foo.c
$./ld-new -shared -o libfoo.so gap.o foo.o
$ gcc -O2 -o foo main.o libfoo.so -Wl,-R,.
$ ./foo
hello
hello

$ ./ld-new  --version
GNU ld (GNU Binutils) 2.45.50.20260109
Copyright (C) 2026 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.

$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04.2) 11.4.0
Copyright (C) 2021 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.

Reply via email to