flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Linux > Extrn, segments and sections

Author
Thread Post new topic Reply to topic
jorido



Joined: 23 Jan 2017
Posts: 53

Extrn, segments and sections

Do I understand correctly this rule for Linux x86-64:

1) Either I can use this:



Code:


  format elf64 executable 3

  segment writeable
  ;.........

  segment executable

  start:
    ;..............





2) Or this:


Code:

  format elf64

  section '.data' writeable
  ;.........
  extrn some_external_c_function

  section '.text'  executable

  start:
    ;..............






That is:
a. "extrn" can't be used with "format elf64 executable 3"

b. for "format elf64 executable 3" only "segment" can be used, not "section"



If so, why is that?
Post 12 Feb 2017, 04:17
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 671

LOL

"elf64 executable 3" dynamic setup (import, segment etc) is to generate executable file directly. No intermediary .o file. Commonly used in these steps:

(compile) ----------------------------> RUN


"elf64" static setup (extrn, section etc) is to generate object files to be linked with anything later on. Produce .o file. Commonly used in these 3-step like:

(compile) --------> linking (gcc, ld, golink, link, alink) ---------> RUN

In general, you cannot use dynamic setup to create a static source and vice versa. You're not paying attention to your own previous threads.
Post 12 Feb 2017, 05:43
View user's profile Send private message Reply with quote
jorido



Joined: 23 Jan 2017
Posts: 53

SOL

There're 2 yes-no questions. You're not paying attention.

ROL
Post 12 Feb 2017, 11:23
View user's profile Send private message Reply with quote
system error



Joined: 01 Sep 2013
Posts: 671

@jorido

You better just stick to your HTML 5.0 For Dummy book. Easier read.
FASM dynamic linking is just too much for some people.
Post 12 Feb 2017, 11:46
View user's profile Send private message Reply with quote
jorido



Joined: 23 Jan 2017
Posts: 53

Have you read it? Would you recommend?
Post 13 Feb 2017, 05:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15324
Location: Bigweld Industries

a. You can't link to an external symbol with extrn if you are not linking (format executable).

b. See your previous thread about section and segments.
Post 15 Feb 2017, 00:49
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >

Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.