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
is generating assembly like you want, but confusingly storing it in
atam.obecause of the-oatam.opassed to GCC (normally you would store assembly inatam.s). The next command:Attempts to link
atam.oand generate an executable, butatam.ois 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)