Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 2 Sep 2018 16:01:25 +0300
From: John Found <johnfound@...32.info>
To: musl@...ts.openwall.com
Subject: Compiling 32bit executables on 64bit system with MUSL

I was able to do it before, although with some hassle and questions in the mailing list.
But today I tried again and it seems the old tricks does not work now.

What I am doing:

1. Compile and install MUSL for i386:

$ sudo ln -s /usr/bin/ar /usr/bin/i386-ar
$ sudo ln -s /usr/bin/ranlib /usr/bin/i386-ranlib
$ ./configure --host=i386 CC="gcc -m32"
$ make
$ sudo make install

2. edit the file /usr/local/musl/bin/musl-gcc (removing double quotes):

exec ${REALGCC:-gcc -m32} "$@" -specs "/usr/local/musl/lib/musl-gcc.specs"

3. Change the file /usr/local/musl/lib/musl-gcc.specs to the attached in this message.

As I said, this procedure happened to work before. 
But now, when trying to compile some file, the compilation failed with linker error message.

Here is some simple test:

$cat ./hello.c 
#include <stdio.h>
int main()
{
   printf("Hello, World!");
   return 0;
}

$musl-gcc -o hello ./hello.c
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/32/crtbegin.o: direct GOT relocation R_386_GOT32X against `_ITM_deregisterTMCloneTable' without base register can not be used when making a shared object
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status

Actually my C programming skills are very low, so I can't even understand what the linker is talking about.

The version of GCC is 8.2.0; 

Any help will be appreciated!
-- 
John Found
https://board.asm32.info

Download attachment "musl-gcc.specs" of type "application/octet-stream" (721 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.