the meaning of "LDFLAGS =-m elf_i386 -Ttext 0 -e st

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

the meaning of "LDFLAGS =-m elf_i386 -Ttext 0 -e st

Post by micro »

hi to all....... :D
what's mean of LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32

i think it is the parameter or option of the GUN( ld)

but i do not know what it uesd for....?

thanks ..... any answers...
Last edited by micro on Mon May 05, 2008 12:51 am, edited 1 time in total.
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

"-m elf_i386": Output 32-bit code for the i386 in elf format.
"-Ttext 0": Code should be loaded\aligned at 0.
"-e startup_32": startup_32 is the entry point.
C8H10N4O2 | #446691 | Trust the nodes.
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

Alboin wrote:"-m elf_i386": Output 32-bit code for the i386 in elf format.
"-Ttext 0": Code should be loaded\aligned at 0.
"-e startup_32": startup_32 is the entry point.

thanks..... very very very ... much
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

hi.
i ... again.... :(

LDFLAGS =-m elf_i386 -Ttext 0 -e startup_32

Image: boot system
dd bs=32 if=boot of=Image skip=1
dd bs=512 if=system of=Image skip=2 seek=1
sync

disk: Image
dd bs=8192 if=Image of=12.img
sync;sync;sync

head.o: head.s
system:head.o
$(LD) $(LDFLAGS) head.o -o system > System.map


i try to write a makefile , above is the code....

and debug it in the bochs... but it can not jmp to the head.s

so i check it ...

System.map is empty..... :cry: :cry:

something wrong , but i do not know where and why ??:?: :?:

i copy someone's code and fixed the above problem...... :D

like this :
nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map[/b
]
but .... i do not know its meaning..... :oops: :oops: :oops:
is there any infomation ?? :oops:


two many color?? i am sorry
Last edited by micro on Mon May 05, 2008 12:52 am, edited 3 times in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

I can't read what you posted. Too many colours.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

Combuster wrote:I can't read what you posted. Too many colours.

i am sorry for that.....

it is all dark.... :roll: :roll:
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Hi,

This line:

Code: Select all

$(LD) $(LDFLAGS) head.o -o system > System.map 
is incorrect. On success, LD will output nothing (so your System.map file contains nothing).

The line of code you copied:

Code: Select all

nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map
Let's go through that bit by bit.

Code: Select all

nm system
'nm' is a binutils command that dumps out a list of symbols from an ELF file. The output from this is then piped into 'grep', which is a regular expression pattern matcher. It's called with a regular expression, and the '-v' flag which means "print all lines that do NOT match the given regular expression".

The expression, when you remove the backslashes put in there to stop the shell expanding them, reads:

Code: Select all

(compiled)|(.o$)|( [aU] )|(..ng$)|(LASH[RL]DI)
Which will match:
* The word 'compiled', anywhere in the output.
* any line ending in any character followed by an 'o'.
* any line where the pattern 'SPACE a SPACE' or 'SPACE U SPACE' is found.
* any line which ends with two of any character followed by 'ng'.
* any line which contains the text 'LASHRDI' or 'LASHLDI'.

Those rules seem fairly strange to me, with the exception of the first three, but I assume they make sense for the binary you're compiling.

So the output of the grep stage will contain every line of the output of 'nm' that does NOT match the above rules.

The output of grep is then piped into 'sort', which takes its input and sorts it alphanumerically. This is then put into the file "System.map". (There's an extraneous '> System.map' in there - typo?)

That is its meaning.

Cheers,

James
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

JamesM wrote:Hi,

This line:

Code: Select all

$(LD) $(LDFLAGS) head.o -o system > System.map 
is incorrect. On success, LD will output nothing (so your System.map file contains nothing).

The line of code you copied:

Code: Select all

nm system | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aU] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)'| sort > System.map > System.map
Let's go through that bit by bit.

Code: Select all

nm system
'nm' is a binutils command that dumps out a list of symbols from an ELF file. The output from this is then piped into 'grep', which is a regular expression pattern matcher. It's called with a regular expression, and the '-v' flag which means "print all lines that do NOT match the given regular expression".

The expression, when you remove the backslashes put in there to stop the shell expanding them, reads:

Code: Select all

(compiled)|(.o$)|( [aU] )|(..ng$)|(LASH[RL]DI)
Which will match:
* The word 'compiled', anywhere in the output.
* any line ending in any character followed by an 'o'.
* any line where the pattern 'SPACE a SPACE' or 'SPACE U SPACE' is found.
* any line which ends with two of any character followed by 'ng'.
* any line which contains the text 'LASHRDI' or 'LASHLDI'.

Those rules seem fairly strange to me, with the exception of the first three, but I assume they make sense for the binary you're compiling.

So the output of the grep stage will contain every line of the output of 'nm' that does NOT match the above rules.

The output of grep is then piped into 'sort', which takes its input and sorts it alphanumerically. This is then put into the file "System.map". (There's an extraneous '> System.map' in there - typo?)

That is its meaning.

Cheers,

James

thank you ... very much


but i have another problem.
i download programming called "linux 0.00"
so i write the MAKEFILE to compile it
it seems works well

but it can not jump from boot to the head

i have uploaded it

system is : FC8 AND bochs 2.1.1

if there is any mistake , please let me know.....
thanks......
Attachments
linux-0.00.rar
linux 0.00 code
(3.2 KiB) Downloaded 156 times
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

I suggest you put your debugging head on, and get debugging.

PROTIP: Linux 0.00 is unlikely to be stable!
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

JamesM wrote:I suggest you put your debugging head on, and get debugging.

PROTIP: Linux 0.00 is unlikely to be stable!
thanks JamesM

i am so fool
that i do not undertand clearly . about your suggest

could you say it more clearly...?

desire it .....
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

micro wrote:i am so fool
that i do not undertand clearly . about your suggest
:roll:

Read the announcement at the top of this subforum.

If you don't know what debugging or stability is, then you're not ready to make an OS. It's that simple.
micro
Member
Member
Posts: 27
Joined: Sun May 04, 2008 5:40 pm

Post by micro »

pcmattman wrote:
micro wrote:i am so fool
that i do not undertand clearly . about your suggest
:roll:

Read the announcement at the top of this subforum.

If you don't know what debugging or stability is, then you're not ready to make an OS. It's that simple.
thanks
Post Reply