flat assembler
Message board for the users of flat assembler.

Index > Linux > Extrn, segments and sections

Author
Thread Post new topic Reply to topic
jorido



Joined: 23 Jan 2017
Posts: 53
jorido 12 Feb 2017, 04:17
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: 670
system error 12 Feb 2017, 05:43
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
jorido 12 Feb 2017, 11:23
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: 670
system error 12 Feb 2017, 11:46
@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
jorido 13 Feb 2017, 05:31
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: 20340
Location: In your JS exploiting you and your system
revolution 15 Feb 2017, 00:49
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


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.