brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · fd8560b Raw
70 lines · plain
1# REQUIRES: mips2## Check that we can link a shared library containing an eh_frame section without3## -z notext. This was not possible LLVM started emitting values using the4## DW_EH_PE_pcrel | DW_EH_PE_sdata4 encoding.5 6## It should not be possible to link code compiled without -fPIC:7# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux %s -o %t-nopic.o8# RUN: llvm-dwarfdump --eh-frame %t-nopic.o | FileCheck %s --check-prefix=ABS64-EH-FRAME9# RUN: llvm-readobj -r %t-nopic.o | FileCheck %s --check-prefixes=RELOCS,ABS64-RELOCS10# RUN: not ld.lld -shared %t-nopic.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=NOPIC-ERR11## Note: ld.bfd can link this file because it rewrites the .eh_frame section to use12## relative addressing.13# NOPIC-ERR: ld.lld: error: relocation R_MIPS_64 cannot be used against local symbol14 15## For -fPIC, .eh_frame should contain DW_EH_PE_pcrel | DW_EH_PE_sdata4 values:16# RUN: llvm-mc -filetype=obj -triple=mips64-unknown-linux --position-independent %s -o %t-pic.o17# RUN: llvm-readobj -r %t-pic.o | FileCheck %s --check-prefixes=RELOCS,PIC64-RELOCS18# RUN: ld.lld -shared %t-pic.o -o %t-pic.so19# RUN: llvm-dwarfdump --eh-frame %t-pic.so | FileCheck %s --check-prefix=PIC64-EH-FRAME20 21## Also check MIPS32:22# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux %s -o %t-nopic32.o23# RUN: llvm-dwarfdump --eh-frame %t-nopic32.o | FileCheck %s --check-prefix=ABS32-EH-FRAME24# RUN: llvm-readobj -r %t-nopic32.o | FileCheck %s --check-prefixes=RELOCS,ABS32-RELOCS25# RUN: not ld.lld -shared %t-nopic32.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=NOPIC32-ERR26## Note: ld.bfd can link this file because it rewrites the .eh_frame section to use27## relative addressing.28# NOPIC32-ERR: ld.lld: error: relocation R_MIPS_32 cannot be used against local symbol29 30## https://github.com/llvm/llvm-project/issues/88852: getFdePc should return a31## 32-bit address.32# RUN: ld.lld --eh-frame-hdr -Ttext=0x80000000 %t-nopic32.o -o %t-nopic3233# RUN: llvm-readelf -x .eh_frame_hdr %t-nopic32 | FileCheck %s --check-prefix=NOPIC32-HDR34 35## For -fPIC, .eh_frame should contain DW_EH_PE_pcrel | DW_EH_PE_sdata4 values:36# RUN: llvm-mc -filetype=obj -triple=mips-unknown-linux --position-independent %s -o %t-pic32.o37# RUN: llvm-readobj -r %t-pic32.o | FileCheck %s --check-prefixes=RELOCS,PIC32-RELOCS38# RUN: ld.lld -shared %t-pic32.o -o %t-pic32.so39# RUN: llvm-dwarfdump --eh-frame %t-pic32.so | FileCheck %s --check-prefix=PIC32-EH-FRAME40 41# RELOCS:            .rel{{a?}}.eh_frame {42# ABS32-RELOCS-NEXT:   0x1C R_MIPS_32 .text43# ABS64-RELOCS-NEXT:   0x1C R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE .text44# PIC64-RELOCS-NEXT:   0x1C R_MIPS_PC32/R_MIPS_NONE/R_MIPS_NONE .L045# PIC32-RELOCS-NEXT:   0x1C R_MIPS_PC32 .L046# RELOCS-NEXT:       }47 48# ABS64-EH-FRAME: Augmentation data: 0C49##                                   ^^ fde pointer encoding: DW_EH_PE_sdata850# ABS32-EH-FRAME: Augmentation data: 0B51##                                   ^^ fde pointer encoding: DW_EH_PE_sdata452# PIC32-EH-FRAME: Augmentation data: 1B53##                                 ^^ fde pointer encoding: DW_EH_PE_pcrel | DW_EH_PE_sdata454# PIC64-EH-FRAME: Augmentation data: 1B55##                                 ^^ fde pointer encoding: DW_EH_PE_pcrel | DW_EH_PE_sdata456## Note: ld.bfd converts the R_MIPS_64 relocs to DW_EH_PE_pcrel | DW_EH_PE_sdata857## for N64 ABI (and DW_EH_PE_pcrel | DW_EH_PE_sdata4 for MIPS32)58 59# NOPIC32-HDR: Hex dump of section '.eh_frame_hdr':60# NOPIC32-HDR: 0x80010038 011b033b 00000010 00000001 fffeffc8 .61# NOPIC32-HDR: 0x80010048 00000028                            .62 63.ent func64.global func65func:66	.cfi_startproc67	nop68	.cfi_endproc69.end func70