Questions tagged [data-segment]

51 questions
8
votes
4 answers

bss segment in C

In one of the answers to the question "Regarding the bss segment and data segment in Unix", I see the explanation on bss as follows: Bss is special: .bss objects don't take any space in the object file, and by grouping all the symbols that are not…
Vivek Maran
  • 2,423
  • 4
  • 32
  • 48
6
votes
3 answers

What is c/c++ data segment and stack size?

I read that it depends on the compiler and operating system architecture. How do I find out the data segment and stack max size on a Linux system using GCC as compiler?
WhatIf
  • 601
  • 2
  • 7
  • 16
5
votes
2 answers

NASM compiling x86_64 ASM label addresses off by 256 bytes in Mach-O when using multiple db declarations?

In short, when I have multiple db sections in my .data section, the compiled addresses/labels are off when compiled by NASM. In my testing they are off by 256 bytes in the resulting Mach-O binary. Software I am using: OS X 10.10.5 nasm NASM version…
Alexander O'Mara
  • 52,993
  • 16
  • 139
  • 151
5
votes
2 answers

why linux set the data-segment to __USER_DS at the prologue of exception handler

I'm trying to read Linux source code(2.6.11) In the exception handler, at entry.s, error_code: movl $(__USER_DS), %ecx movl %ecx, %ds movl %ecx, %es I don't know why loading user data segment here. Since it is supposed to be entering the exception…
Holmes
  • 63
  • 4
4
votes
1 answer

Strange behaviour of size utility

1st case: #include int main(void) { return 0; } Size output: text data bss dec hex filename 1115 552 8 1675 68b ./a.out 2nd case: #include int global; // new line compared to…
Patrick
  • 2,046
  • 3
  • 21
  • 42
4
votes
3 answers

Executable Ada code on the stack

I've just watched a talk on security considerations for railway systems from last year's 32C3. At minute 25 the speaker briefly talks about Ada. Specifically he says: Typical Ada implementations have a mechanism called "(tramp / trunk / ?)…
morido
  • 1,023
  • 7
  • 24
4
votes
2 answers

Are template variables thread safe? they're placed on data segment?

I'm playing with the new template variables feature from C++14 in order to get used to it (maybe is soon to do this 'cause it seems that some compilers didn't implement it completely). Now I'm wondering where lies each instance of a template…
PaperBirdMaster
  • 11,602
  • 9
  • 41
  • 84
4
votes
1 answer

Is there a C++ equivalent (or equivalent technique) of Perl's __DATA__ segment?

is anyone aware of a C++ equivalent of Perl's __DATA__ segment? For anyone not familiar with Perl, the __DATA__ segment is an (optional) annotation towards the end of a Perl file; whatever comes after is considered the content of a (virtual) file…
tunnuz
  • 21,380
  • 29
  • 86
  • 124
3
votes
0 answers

Get string length at declaration in assembly x86_64 in Linux

See the statements of string1 and string2 as well as their len1 and len2. The code is Assembly for x86_64 using GNU Assembler, passing parameters to invoke Linux x86_64 system calls. When I mov len1, %rdx it oddly generates a nonsense value…
Lourenco
  • 1,920
  • 1
  • 12
  • 19
3
votes
1 answer

Storing a vector in a DLL data segment

Information The following warning: LINK : warning LNK4039: section '.SHARED' specified with /SECTION option does not exist always occur whenever I try to store a vector in a data segment of a dynamic link library in C++. For an example: #include…
XOR Bit
  • 31
  • 3
2
votes
1 answer

What does `Var2 DW Var1` mean in TurboShell/TurboAsm?

why does the following code compile perfectly? Data Segment Var1 Dw (any 4 digit hex value) Var2 Dw Var1 Data Ends what does the line "Var2 Dw Var1" even mean? I thought that only an immediate value can go after the type defining .
2
votes
4 answers

Can static storage (mostly data segment) cause segmentation fault?

static storage is decided at compilation time. However, consider the scenario where we have lot of lazy initialization in functions: void foo () { static int a[1000]; } I am not discussing the coding practice here, but the technical aspect. As…
iammilind
  • 62,239
  • 27
  • 150
  • 297
2
votes
2 answers

Data segment vs stack

A global variable is allocated in the data segment, while a local one stays in the stack. I know that accessing a variable stored in the heap is slower than accessing a local variable, but I don't know if accessing a local variable is faster than…
2
votes
1 answer

Legal data segement constructions

I would like to get some help with this questions: what is correct and legal in following definition of the data segment: data segment x db -23, 3 or 4, not -3, 9 xor 15, 129, $+x, SEG x, -128 LT 80h db -129, x+1, b2h, 256, 7852h, byte…
Bogdan M.
  • 2,033
  • 6
  • 29
  • 48
1
vote
1 answer

Matplotlib: How can i use a column as data segmentation on matplotlib?

i've a question about matplotlib. I have a table just like this. data = pd.Dataframe(alldata) print(data) index | id | type | date | value | --------------------------------------- 0 | 1 | apples | 01-01-15| 100.00| 0 | 1 | apples …
1
2 3 4