pouët.net

Go to bottom

ld alternatives under GNU/Linux

category: code [glöplog]
 
hello,

if anyone is interested about alternative linker focused on size-coding, there is The Byte Optimized Linker aka bold for 64bit elf and I recently wrote a linker for 32bit elf. The both use same tricks described on http://pouet.net/topic.php?which=5392, import symbols by hash, 3 program header, no section, etc.

Hope to see more 1/4k stuff under GNU/Linux :)
added on the 2012-09-06 04:47:39 by stfsux stfsux
nice work! :D
will try it someday
added on the 2012-09-06 07:28:48 by provod provod
looking forward to crinklux!
Can not try it, like *right now*, but a cheerful "congrats" for the effort. And open-sourced, so can fix & customize if required, one more "congrats" ^^

Question : let's say I've an OpenGL/SDL demo. Your linker is a drop-in replacement of "ld" ? Or do you I have to do some extra work (it would be fine, no pain no gain) ?
Ok, I tried it, the example worked like a champ, 512 bytes hello world ^^ I might suggest to make the path to the libc of the example's Makefile variable, it's highly distrib dependent. I got a few warnings, is that expected ?
Quote:

gcc -m32 -Os -c flow2.c
../bin/rld -L/usr/lib32 -lGL -lSDL -o flow2 ../src/runtime/runtime_x86.o ./flow2.o
rld: cannot find `libGL'.
../bin/rld --compress -L/lib/libc-2.16.so -lGL -lSDL -o flow2-compressed ../src/runtime/runtime_x86.o ./flow2.o
rld: cannot find `libGL'.
gcc -m32 -Os -c helloworld.c
../bin/rld -L/usr/lib32 -lc=/lib/libc-2.16.so -o helloworld ../src/runtime/runtime_x86.o ./helloworld.o
rld:../src/runtime/runtime_x86.o: warning: there is no .rodata section in this file.
rld: warning: relocation on section `.rel.eh_frame' is not supported.
../bin/rld --compress -L/lib/libc-2.16.so -lc=/lib/libc-2.16.so -o helloworld-compressed ../src/runtime/runtime_x86.o ./helloworld.o
rld:../src/runtime/runtime_x86.o: warning: there is no .rodata section in this file.
rld: warning: relocation on section `.rel.eh_frame' is not supported.
-lSDL should come before -lGL at least, I suppose.
added on the 2012-09-06 16:16:54 by Marq Marq
@marmakoide: yes, you right, at beginning i was looking, as the libname convention said, to libNAME.so (which should be a symbolic link exclusively used by GNU/ld) but for the libc, its not a symbolic link but a linker script, that's why you had to specify the symbolic link. Anyways, now i'm looking at the major version symbolic name but i forgot to remove this, ill fix it.
BTW, rld doesn't have any default search path, you have to specify them, so it should be:
Code: ../bin/rld --compress -L/lib -L/usr/lib -lGL -lSDL -o flow2-compressed ../src/runtime/runtime_x86.o ./flow2.o
added on the 2012-09-06 19:53:56 by stfsux stfsux

login

Go to top