0

Sees linux memory management is page-based only, not having the concept of "segment".

But still, the at&t assembly has the concept of "section", like code section, data section, just like intel assmebly's "segment", and they look very similar.

So my question is, is "section" having the same meaning like "segment" in intel assembly?

Troskyvs
  • 7,537
  • 7
  • 47
  • 115
  • 1
    See [**The Art of Assembly -- Memory Segments**](https://courses.engr.illinois.edu/ece390/books/artofasm/CH04/CH04-1.html#HEADING1-64). (the rest of the book is very good as well) – David C. Rankin Jan 02 '17 at 03:16
  • 1
    It's not "at&t assembly" that has sections, but ELF (and PE) and it doesn't matter whether you use intel or at&t syntax assembler. – Jester Jan 02 '17 at 11:52

1 Answers1

2

Linkers collect pages with the same attributes into "sections" or "program sections" or "psects." Usually is the default is to create one section for each memory attribute. Typically:

  1. Readonly
  2. Read/write
  3. Demand Zero
  4. Executable

However, most linkers have advanced settings that allow the programmer to set up the psects differently.

Some assemblers have psect directives to place data in a particular section.

Sometimes psects are called "segments." E.g., the "code segment"

There are also hardware segments that, as you suggest, are pretty much a brain damaged aspect of many Intel processors (although some other processors use[d] them). In 64-bit mode, Intel has finally dumped segments. A segment in this uses is accessed by segment registers.

Thus, these are two different concepts.

user3344003
  • 20,574
  • 3
  • 26
  • 62
  • 1
    It's not Intel who dumped them, it's AMD. – fuz Jan 02 '17 at 14:51
  • Microsoft classic assembler directives are .text (code). .data (initialized data), .data? or .bss (uninitialized data, may be zeroed in some cases), .stack, ... . Microsoft / Intel mostly went to a flat model starting with 32 bit code (Watcom C /C++ 10.0 supported this with Windows 3.1x winmem32 mode). Windows still uses either FS or GS in 64 bit mode for "per thread" variables (such as the seed for rand()), but the code I've seen for "per thread" maps this area into the 64 bit virtual address space. – rcgldr Jan 03 '17 at 02:59