mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 03:56:41 +00:00

(This application-specific option is probably not appropriate as a linker option (.o file offers more flexibility and decouples JSON verification from linkers). However, the option has gained some traction in Linux distributions, with support in GNU ld, gold, and mold.) GNU ld has supported percent-encoded bytes and extensions like `%[comma]` since November 2024. mold supports just percent-encoded bytes. To prepare for potential adoption by Ubuntu, let's support percent-encoded bytes. Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32003 Link: https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/2071468 Pull Request: https://github.com/llvm/llvm-project/pull/126396 (cherry picked from commit 0a470a926481d370251731cb2dd897531756335f)
30 lines
1.1 KiB
ArmAsm
30 lines
1.1 KiB
ArmAsm
# REQUIRES: x86
|
|
# RUN: rm -rf %t && split-file %s %t && cd %t
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
|
|
|
|
# RUN: ld.lld a.o --package-metadata='{}'
|
|
# RUN: llvm-readelf -n a.out | FileCheck %s --check-prefixes=NOTE,FIRST
|
|
|
|
# RUN: ld.lld a.o --package-metadata='{"abc":123}'
|
|
# RUN: llvm-readelf -n a.out | FileCheck %s --check-prefixes=NOTE,SECOND
|
|
|
|
# RUN: ld.lld a.o --package-metadata='%7b%22abc%22:123%7D'
|
|
# RUN: llvm-readelf -n a.out | FileCheck %s --check-prefixes=NOTE,SECOND
|
|
|
|
# NOTE: .note.package
|
|
# NOTE-NEXT: Owner
|
|
# NOTE-NEXT: FDO 0x{{.*}} Unknown note type: (0xcafe1a7e)
|
|
# FIRST-NEXT: description data: 7b 7d 00
|
|
# SECOND-NEXT: description data: 7b 22 61 62 63 22 3a 31 32 33 7d 00
|
|
|
|
# RUN: not ld.lld a.o --package-metadata='%7b%' 2>&1 | FileCheck %s --check-prefix=ERR
|
|
# RUN: not ld.lld a.o --package-metadata='%7b%7' 2>&1 | FileCheck %s --check-prefix=ERR
|
|
# RUN: not ld.lld a.o --package-metadata='%7b%7g' 2>&1 | FileCheck %s --check-prefix=ERR
|
|
|
|
# ERR: error: --package-metadata=: invalid % escape at byte 3; supports only %[0-9a-fA-F][0-9a-fA-F]
|
|
|
|
#--- a.s
|
|
.globl _start
|
|
_start:
|
|
ret
|