Index: test/ELF/aarch64-copy.s =================================================================== --- test/ELF/aarch64-copy.s +++ test/ELF/aarch64-copy.s @@ -90,4 +90,8 @@ // RODATA: Contents of section .rodata: // S(z) = 0x40014 -// RODATA-NEXT: 10282 14000400 + +// Caution: do not use absolute address below, .rodata is after .dynstr, which +// contains absolute path to aarch64-copy.s.tmp2.so, so .rodata may start +// at different address on different systems. +// RODATA-NEXT: {{.*}} 14000400 Index: test/ELF/arm-copy.s =================================================================== --- test/ELF/arm-copy.s +++ test/ELF/arm-copy.s @@ -78,4 +78,8 @@ // RODATA: Contents of section .rodata: // S(z) = 0x13004 -// RODATA-NEXT: 10198 04300100 + +// Caution: do not use absolute address below, .rodata is after .dynstr, which +// contains absolute path to arm-copy.s.tmp2.so, so .rodata may start +// at different address on different systems. +// RODATA-NEXT: {{.*}} 04300100 Index: test/ELF/relocation.s =================================================================== --- test/ELF/relocation.s +++ test/ELF/relocation.s @@ -110,20 +110,26 @@ .section .R_X86_64_64,"a",@progbits .global R_X86_64_64 R_X86_64_64: - .quad R_X86_64_64 + .quad 4022250974 // CHECK: Contents of section .R_X86_64_64: -// CHECK-NEXT: 200287 87022000 00000000 +// CHECK-NEXT: {{.*}} deadbeef 00000000 .section .R_X86_64_GOTPCREL,"a",@progbits .global R_X86_64_GOTPCREL R_X86_64_GOTPCREL: .long zed@gotpcrel - -// 0x2020F8 - 0x2001D8 = 7952 -// 7952 = 0x101f0000 in little endian -// CHECK: Contents of section .R_X86_64_GOTPCREL -// CHECK-NEXT: 20028f 612e0000 +// ^^^^^^^^^^^^ +// Note: the above value of .R_X86_64_GOTPCREL is not always a fixed value. +// The value is calculated by: .got - (.R_X86_64_GOTPCREL+0) +// When linker arranges sections into below segments: +// 01 .dynsym .dynstr .R_X86_64_64 .R_X86_64_GOTPCREL ... +// 02 .text .text2 .R_X86_64_32S .R_X86_64_PC32 .R_X86_64_32S_2 .plt +// 03 .got.plt .dynamic .got +// We see that the size of .dynstr (which contains the absolute path of +// "relocation.s.tmp2.so") affects the address of .R_X86_64_GOTPCREL. +// However, the start addresses of segment 02 and 03 might not be affected, +// because of huge alignment (usually 0x1000). .section .R_X86_64_GOT32,"a",@progbits .global R_X86_64_GOT32 Index: test/ELF/version-script-extern.s =================================================================== --- test/ELF/version-script-extern.s +++ test/ELF/version-script-extern.s @@ -68,8 +68,11 @@ # DSO-NEXT: ] # DSO-NEXT: Version symbols { # DSO-NEXT: Section Name: .gnu.version -# DSO-NEXT: Address: 0x300 -# DSO-NEXT: Offset: 0x300 +// Caution: do not use absolute address below, .gnu.version is placed after +// .dynstr, which contains absolute path to "version-script-extern.s.tmp.so", +// so .rodata may start at different address on different systems. +# DSO-NEXT: Address: {{.*}} +# DSO-NEXT: Offset: {{.*}} # DSO-NEXT: Link: 1 # DSO-NEXT: Symbols [ # DSO-NEXT: Symbol {