[klibc] [klibc:master] x86_64: Use -Ttext-segment to avoid address collision

klibc-bot for Ben Hutchings ben at decadent.org.uk
Fri Jan 18 08:42:14 PST 2019

Commit-ID:  2a705525e0816f9d708d7c41688f6bcb127374fe
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=2a705525e0816f9d708d7c41688f6bcb127374fe
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Sat, 5 Jan 2019 20:59:33 +0000
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Fri, 18 Jan 2019 03:10:14 +0000

[klibc] x86_64: Use -Ttext-segment to avoid address collision

Building klibc for x86_64 with binutils 2.31 adds an extra
.note.gnu.property section to klibc.so, the address of which is not
affected by the -Ttext option.  Loading a klibc executable then
fails with the following kernel log message:

9409 (sh.shared): Uhuuh, elf segment at 0000000000200000 requested but the memory is mapped already

I don't exactly see why this is happening, but it is triggered by the
new section and the collision can be avoided by passing -Ttext-segment
instead of -Ttext.  A similar change was applied to MIPS recently.

Link: https://www.zytor.com/pipermail/klibc/2019-January/004024.html
Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

 usr/klibc/arch/x86_64/MCONFIG | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/klibc/arch/x86_64/MCONFIG b/usr/klibc/arch/x86_64/MCONFIG
index fbb6b94..606f041 100644
--- a/usr/klibc/arch/x86_64/MCONFIG
+++ b/usr/klibc/arch/x86_64/MCONFIG
@@ -35,7 +35,7 @@ KLIBCLDFLAGS      = -m elf_x86_64
 # The old default was max-page-size=0x100000, but that also results
 # in a broken layout with binutils 2.30.  Since there's no
 # architectural page size betwen 4 KB and 2MB, set it to 4 KB.
-KLIBCSHAREDFLAGS     = -Ttext 0x00200200 -z max-page-size=0x1000
+KLIBCSHAREDFLAGS     = -Ttext-segment 0x00200000 -z max-page-size=0x1000
 # Asm includes for x86_64 are in the merged x86 tree

More information about the klibc mailing list