Files
clang-p2996/lld/test/elf/linkerscript/phdrs-different.test
Denis Protivensky cdc1246750 [ELF] Apply segments from linker scripts
Put sections to segments according to linker scripts if available.
Rework the code of TargetLayout::assignSectionsToSegments so it operates
on the given list of segments, which can be either read from linker scripts
or constructed as before.
Handle NONE segments defined in linker scripts by putting corresponding sections
to PT_NULL segment.
Consider flags set for segments through linker scripts.

Differential Revision: http://reviews.llvm.org/D10918

llvm-svn: 243002
2015-07-23 10:34:30 +00:00

46 lines
1.0 KiB
Plaintext

/*
Test sections put to different segments.
RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o
RUN: lld -flavor gnu -target x86_64 -T %s %t.o -static -o %t1
RUN: llvm-objdump -section-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-SECS %s
RUN: llvm-readobj -program-headers %t1 | FileCheck -check-prefix DIFF-PHDRS-HDRS %s
*/
ENTRY(_start)
PHDRS
{
text PT_LOAD;
data PT_LOAD;
}
SECTIONS
{
.text : { *(.text) } :text
.data : { *(.data) } :data
}
/*
DIFF-PHDRS-SECS: .text {{[0-9a-f]+}} 00000000004000e8
DIFF-PHDRS-SECS: .data {{[0-9a-f]+}} 0000000000401000
DIFF-PHDRS-HDRS: ProgramHeader {
DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1)
DIFF-PHDRS-HDRS: VirtualAddress: 0x400000
DIFF-PHDRS-HDRS: Flags [ (0x5)
DIFF-PHDRS-HDRS: PF_R (0x4)
DIFF-PHDRS-HDRS: PF_X (0x1)
DIFF-PHDRS-HDRS: ]
DIFF-PHDRS-HDRS: }
DIFF-PHDRS-HDRS: ProgramHeader {
DIFF-PHDRS-HDRS: Type: PT_LOAD (0x1)
DIFF-PHDRS-HDRS: VirtualAddress: 0x401000
DIFF-PHDRS-HDRS: Flags [ (0x6)
DIFF-PHDRS-HDRS: PF_R (0x4)
DIFF-PHDRS-HDRS: PF_W (0x2)
DIFF-PHDRS-HDRS: ]
DIFF-PHDRS-HDRS: }
*/