[klibc] [PATCH klibc 1/2] i386: Use -Ttext-segment to avoid address collision

Ben Hutchings ben at decadent.org.uk
Sun Jan 6 11:30:11 PST 2019

Building klibc for i386 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 0000000000600000 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, similarly to x86_64.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
 usr/klibc/arch/i386/MCONFIG | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usr/klibc/arch/i386/MCONFIG b/usr/klibc/arch/i386/MCONFIG
index 1150ecedf799..bfec004a3c8b 100644
--- a/usr/klibc/arch/i386/MCONFIG
+++ b/usr/klibc/arch/i386/MCONFIG
@@ -30,7 +30,7 @@ KLIBCBITSIZE  = 32
 # This address needs to be reachable using normal inter-module
 # calls, and work on the memory models for this architecture
 # 96 MB - normal binaries start at 128 MB
-KLIBCSHAREDFLAGS	= -Ttext 0x06000200
+KLIBCSHAREDFLAGS	= -Ttext-segment 0x06000000
 # Asm includes for i386 are in the merged x86 tree

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.zytor.com/pipermail/klibc/attachments/20190106/20782905/attachment.sig>

More information about the klibc mailing list