[lld] r296448 - Add a comment.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 11:20:13 PST 2017


> +    // Note that for an ordinary symbol we do not perform this
> +    // adjustment and thus effectively assume that the addend cannot
> +    // cross the boundaries of mergeable objects.

That is not the assumption. The issue is that ".rodata + 42" and ".Lbar
+ 42" have different meanings. The first one means the data that starts
42 bytes after the start of .rodata. The second one means 42 bytes after
the data that starts at .Lbar.

An example that shows the difference


	.section	.rodata.str1.1,"aMS", at progbits,1
.Lbar:
	.asciz	"abc"
        .asciz	"def"

        .data
        .quad .Lbar + 4
        .quad .rodata.str1.1 + 4

The first relocation points to 4 bytes after "abc". The second
relocation points to "def".

Cheers,
Rafael


More information about the llvm-commits mailing list