This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Assembler in C


Daniel,

it seems your gcc command line is missing a 'compile only' - or 'assemble only'- switch. That '-s', for your assembler file, would let gcc just call cpp and 'as', and then stop. The linker won't be engaged in that game.
BTW, the GNU gcc is a very smart guy: when I want to have some executable from him - native or cross, it's the same - I just throw all the source code, libraries and switches into it, and it spits a file. Have a look at http://gcc.gnu.org/onlinedocs/, they have a lot of pretty docs there.

HTH
Michael

Daniel Lidsten wrote:

Hi again,

The example you provide for AnyFunction() won't work with gcc. The syntax just doesn't work like that. If you're trying to do that much in assembly, it probably belongs in a .S file anyway--- with a few lines of inline assembly code to glue it to the C environment (again, using operand constraints).

I followed your advice and created a new .S file where i put my new
function. I have attached a small portion of the code below:

.type MyFnc,@function; .globl MyFnc; MyFnc:
//Set the MSR to zero. It is the reset configuration. lwi r0,0
mtmsr r0

// Mask interrupt sources in the SIU
lis r2,0
lwi r3,CYGARC_REG_IMM_SIMASK
stw r2,0(r3)


But when i tried to assemble the file i got the following error:

--------------- Standard ERROR from assembling various_asm_fnc.S.
---------------
/tools/powerpc-eabi/bin/ld: warning: cannot find entry symbol _start;
defaulting to 01800074

Since _start is located within another .S file i tried to fix it by
adding a .extern _start but it didn't help.

I don't get it, why do i get an error from ld when assembling? Why do
the file need to know where _start is, all that stuff should be done
later on while linking.

Regards, Daniel

------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]