1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Object/X86/obj2yaml-dup-section-name.s
Rafael Espindola 0b8bd66167 obj2yaml: Print unique section names.
Without this patch passing a .o file with multiple sections with the
same name to obj2yaml produces a yaml file that yaml2obj cannot
handle. This is pr34162.

The problem is that when specifying, for example, the section of a
symbol, we get only

Section: foo

and don't know which of the sections whose name is foo we have to use.

One alternative would be to use section numbers. This would work, but
the output from obj2yaml would be very inconvenient to edit as
deleting a section would invalidate all indexes.

Another alternative would be to invent a unique section id that would
exist only on yaml. This would work, but seems a bit heavy handed. We
could make the id optional and default it to the section name.

Since in the last alternative the id is basically what this patch uses
as a name, it can be implemented as a followup patch if needed.

llvm-svn: 312585
2017-09-05 22:30:00 +00:00

29 lines
978 B
ArmAsm

# RUN: llvm-mc %s -o %t.o -filetype=obj -triple=x86_64-pc-linux
# RUN: obj2yaml %t.o | FileCheck %s
# CHECK: Sections:
# CHECK: - Name: .group{{$}}
# CHECK: Members:
# CHECK: - SectionOrType: .text.foo{{$}}
# CHECK: - SectionOrType: .rela.text.foo{{$}}
# CHECK: - Name: .text.foo{{$}}
# CHECK: - Name: .rela.text.foo{{$}}
# CHECK: Info: .text.foo{{$}}
# CHECK: - Name: .group1{{$}}
# CHECK: Members:
# CHECK: - SectionOrType: .text.foo2{{$}}
# CHECK: - SectionOrType: .rela.text.foo3{{$}}
# CHECK: - Name: .text.foo2{{$}}
# CHECK: - Name: .rela.text.foo3{{$}}
# CHECK: Info: .text.foo2{{$}}
# CHECK: Symbols:
# CHECK: Section: .group{{$}}
# CHECK: Section: .group1{{$}}
.section .text.foo,"axG",@progbits,sym1,comdat
.quad undef
.section .text.foo,"axG",@progbits,sym2,comdat
.quad undef