how can I get assembly code from C program I used this recommendation
and I use something like this -c -fmessage-length=0 -O2 -S
in Eclipse, but I've got an error, thanks in advance for any help
now I have this error
atam.c:11: error: conflicting types for 'select'
/usr/include/sys/select.h:112: error: previous declaration of 'select' was here
atam.c:11: error: conflicting types for 'select'
/usr/include/sys/select.h:112: error: previous declaration of 'select' was here
this my function
int select(int board[],int length,int search){
int left=0, right=length-1;
while(1){
int pivot_index=(right+left)/2;
int ordered_pivot=partition(board,left,right,pivot_index);
if(ordered_pivot==search){
return board[ordered_pivot];
}
else if(search<ordered_pivot){
right=ordered_pivot-1;
}
else{
left=ordered_pivot+1;
}
}
}
Eclipse is still treating the output as an object file
gcc -O0 -g3 -Wall -c -fmessage-length=0 -O2 -S -oatam.o ..\atam.c
is generating assembly like you want, but confusingly storing it in atam.o
because of the -oatam.o
passed to GCC (normally you would store assembly in atam.s
). The next command:
gcc -oatam.exe atam.o
Attempts to link atam.o
and generate an executable, but atam.o
is an assembly source, not an object file, so the linker fails. You need to tell eclipse not to run the second command (and you probably want to change the output filename of the first)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With