2014-04-16 12:15:32 +08:00
|
|
|
// RUN: llvm-mc -triple i686-windows -filetype obj %s -o - | llvm-objdump -t - \
|
2014-04-28 00:10:57 +08:00
|
|
|
// RUN: | FileCheck %s
|
2014-04-16 12:15:32 +08:00
|
|
|
|
[MC] Enable .file support on COFF and diagnose it on unsupported targets
Summary:
The "single parameter" .file directive appears to be an ELF-only feature
that is intended to insert the main source filename into the string
table table.
I noticed that if you assemble an ELF .s file for COFF, typically it
will assert right away on a .file directive near the top of the file. My
first change was to make this emit a proper error in the asm parser so
that we don't assert so easily.
However, COFF actually does have some support for this directive, and if
you emit an object file, llvm-mc does not assert. When emitting a COFF
object, MC will take those file names and create "debug" symbol table
entries for them. I'm not familiar with these kinds of symbol table
entries, and I'm not aware of any users of them, but @compnerd added
them a while ago. They don't introduce absolute paths, and most main
source file paths are short enough that this extra entry shouldn't cause
any problems, so I enabled the flag in MCAsmInfoCOFF that indicates that
it's supported.
This has the side effect of adding an extra debug symbol to every object
produced by clang, which is a pretty big functional change. My question
is, should we keep the functionality or remove it in the name of symbol
table minimalism?
Reviewers: mstorsjo, compnerd
Subscribers: hiraditya, compnerd, llvm-commits
Differential Revision: https://reviews.llvm.org/D55900
llvm-svn: 349976
2018-12-22 07:35:48 +08:00
|
|
|
// Round trip through .s output to exercise MCAsmStreamer.
|
|
|
|
// RUN: llvm-mc -triple i686-windows %s -o - \
|
|
|
|
// RUN: | llvm-mc -triple i686-windows - -filetype=obj -o - | llvm-objdump -t - \
|
|
|
|
// RUN: | FileCheck %s
|
|
|
|
|
2014-05-03 01:45:24 +08:00
|
|
|
// RUN: llvm-mc -triple i686-windows -filetype obj %s -o - \
|
2019-05-01 13:27:20 +08:00
|
|
|
// RUN: | llvm-readobj --symbols | FileCheck %s -check-prefix CHECK-SCN
|
2014-05-03 01:45:24 +08:00
|
|
|
|
2014-04-16 12:15:32 +08:00
|
|
|
.file "null-padded.asm"
|
2014-04-28 00:10:57 +08:00
|
|
|
// CHECK: (nx 1) {{0x[0-9]+}} .file
|
|
|
|
// CHECK-NEXT: AUX null-padded.asm{{$}}
|
2014-04-16 12:15:32 +08:00
|
|
|
|
|
|
|
.file "eighteen-chars.asm"
|
|
|
|
|
2014-04-28 00:10:57 +08:00
|
|
|
// CHECK: (nx 1) {{0x[0-9]+}} .file
|
|
|
|
// CHECK-NEXT: AUX eighteen-chars.asm{{$}}
|
2014-04-16 12:15:32 +08:00
|
|
|
|
|
|
|
.file "multiple-auxiliary-entries.asm"
|
|
|
|
|
2014-04-28 00:10:57 +08:00
|
|
|
// CHECK: (nx 2) {{0x[0-9]+}} .file
|
|
|
|
// CHECK-NEXT: AUX multiple-auxiliary-entries.asm{{$}}
|
2014-04-16 12:15:32 +08:00
|
|
|
|
2014-05-03 01:45:24 +08:00
|
|
|
// CHECK-SCN: Symbols [
|
|
|
|
// CHECK-SCN: Symbol {
|
|
|
|
// CHECK-SCN: Name: .file
|
2014-09-20 08:25:06 +08:00
|
|
|
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
2014-05-03 01:45:24 +08:00
|
|
|
// CHECK-SCN: StorageClass: File
|
|
|
|
// CHECK-SCN: AuxFileRecord {
|
|
|
|
// CHECK-SCN: FileName: null-padded.asm
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: Symbol {
|
|
|
|
// CHECK-SCN: Name: .file
|
2014-09-20 08:25:06 +08:00
|
|
|
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
2014-05-03 01:45:24 +08:00
|
|
|
// CHECK-SCN: StorageClass: File
|
|
|
|
// CHECK-SCN: AuxFileRecord {
|
|
|
|
// CHECK-SCN: FileName: eighteen-chars.asm
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: Symbol {
|
|
|
|
// CHECK-SCN: Name: .file
|
2014-09-20 08:25:06 +08:00
|
|
|
// CHECK-SCN: Section: IMAGE_SYM_DEBUG (-2)
|
2014-05-03 01:45:24 +08:00
|
|
|
// CHECK-SCN: StorageClass: File
|
|
|
|
// CHECK-SCN: AuxFileRecord {
|
|
|
|
// CHECK-SCN: FileName: multiple-auxiliary-entries.asm
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: }
|
|
|
|
// CHECK-SCN: ]
|
|
|
|
|