bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/32572] -z force-bti + -Ttext-segment produce wrong PLT entries o


From: hjl.tools at gmail dot com
Subject: [Bug ld/32572] -z force-bti + -Ttext-segment produce wrong PLT entries on aarch64
Date: Mon, 20 Jan 2025 01:46:01 +0000

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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-tgl-3 pr32572]$ cat x.s
        .arch armv8-a
        .text
        .global _start
        .type   _start, %function
_start:
        .cfi_startproc
        hint    34 // bti c
        b       foo
        .cfi_endproc
        .size   _start, .-_start
        .section        .note.GNU-stack,"",@progbits
        .section        .note.gnu.property,"a"
        .align  3
        .word   4
        .word   16
        .word   5
        .string "GNU"
        .word   3221225472
        .word   4
        .word   3
        .align  3
[hjl@gnu-tgl-3 pr32572]$ cat foo.s
        .arch armv8-a
        .text
        .global foo
        .type   foo, %function
foo:
        .cfi_startproc
        ret
        .cfi_endproc
        .size   foo, .-foo
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-tgl-3 pr32572]$ make
./as -g -o x.o x.s
./as -g -o foo.o foo.s
./ld -shared -o libfoo.so foo.o
./ld -pie -z force-bti -Ttext-segment=0x0000000000400000 -o x x.o libfoo.so
[hjl@gnu-tgl-3 pr32572]$ ./objdump -dw x

x:     file format elf64-littleaarch64


Disassembly of section .plt:

00000000004002f0 <.plt>:
  4002f0:       d503245f        bti     c
  4002f4:       a9bf7bf0        stp     x16, x30, [sp, #-16]!
  4002f8:       f00000f0        adrp    x16, 41f000 <_start+0x1ece0>
  4002fc:       f947fe11        ldr     x17, [x16, #4088]
  400300:       913fe210        add     x16, x16, #0xff8
  400304:       d61f0220        br      x17
  400308:       d503201f        nop
  40030c:       d503201f        nop

0000000000400310 <foo@plt>:
  400310:       90000010        adrp    x16, 400000 <.plt-0x2f0>
  400314:       99000111        stlur   w17, [x8]
  400318:       91000210        add     x16, x16, #0x0
  40031c:       d6000220        .inst   0xd6000220 ; undefined

Disassembly of section .text:

0000000000400320 <_start>:
  400320:       d503245f        bti     c
  400324:       17fffffb        b       400310 <foo@plt>
[hjl@gnu-tgl-3 pr32572]$

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]