Compiling busybox to .s assembly file
Eric Schulte
eschulte at cs.unm.edu
Fri Feb 25 15:22:05 UTC 2011
walter harms <wharms at bfs.de> writes:
> Am 24.02.2011 19:42, schrieb Eric Schulte:
>> walter harms <wharms at bfs.de> writes:
>>
>>> Am 24.02.2011 18:17, schrieb Eric Schulte:
>>>> Hello,
>>>>
>>>> I'm hoping to generate a compiled text asm file (gcc -S) of the busybox
>>>> executable. I've looked at scripts/showasm, but it uses objdump the
>>>> output of which could not (easily) then be edited and linked to generate
>>>> an executable.
>>>>
>>>> I've spend a good deal of time mucking around in the Makefile, but
>>>> having never fully felt comfortable with Makefiles even in relatively
>>>> simple cases, the busybox Makefile is largely opaque to me.
>>>>
>>>> If anyone can offer a suggestion, or point me in the right direction I
>>>> will be very appreciative. Once I get this working if there is any
>>>> interest I would be happy to wrap it up in a script which could be
>>>> included in scripts/ -- although I'm not sure that such functionality
>>>> would be generally useful.
>>>>
>>>> Thanks -- Eric
>>>>
>>>
>>> hi Eric,
>>> i am not sure what you want to archive but --save-temps will keep all
>>> tmp files including asm. (see: man 1 gcc)
>>>
>>> re,
>>> wh
>>>
>>
>> Hi Walter,
>>
>> Adding "--save-temps" to the "CFLAGS := $(CFLAGS)" line in the Makefile
>> has indeed left me with *many* .s files. Now I just have to figure out
>> how to link these .s files into an executable.
>>
>> As for the purpose, I'm hoping to use evolutionary computation over the
>> assembly code to automatically make changes to the busybox executable.
>> This technique has been used successfully to fix bugs in a number of
>> programs [1], I'd like to see if it can be used to do the same with
>> busybox, or possibly to shrink the size of the busybox executable.
>>
>> Thanks -- Eric
>>
>> Footnotes:
>> [1] http://epr.adaptive.cs.unm.edu/
>>
>
> sound very interessting, i did this 20 year ago (not with programms but parameters).
> an yes --save-temps will generate a lot of files but this is due to the build process
> but it should give you a good starting point.
>
> IMHO it should work to cat all *.c together and call gcc directly. I have to admit
> that i never tried that.
>
Hi Walter,
This would be an appealing option. I tried consolidating all .c files
into a single file, and collecting this file with all .h files into a
single directory. Unfortunately calls to gcc would routinely fail --
apparently due to missing dependencies most likely files expected to
live at certain places in the file system relative to the original
location of the .c files.
Thanks -- Eric
>
>
> re,
> wh
>
>
>
>
>
>
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
More information about the busybox
mailing list