aboutsummaryrefslogtreecommitdiff
path: root/Semestr 4/ask/lista9
diff options
context:
space:
mode:
Diffstat (limited to 'Semestr 4/ask/lista9')
-rw-r--r--Semestr 4/ask/lista9/gadget.s16
-rw-r--r--Semestr 4/ask/lista9/lazy.c7
-rw-r--r--Semestr 4/ask/lista9/lista_9.tgzbin0 -> 1278 bytes
-rw-r--r--Semestr 4/ask/lista9/relo3.c15
-rw-r--r--Semestr 4/ask/lista9/ropex.c31
-rw-r--r--Semestr 4/ask/lista9/ropex.in (1).txt7
-rw-r--r--Semestr 4/ask/lista9/ropex.in.txt7
-rw-r--r--Semestr 4/ask/lista9/ropex.map511
-rw-r--r--Semestr 4/ask/lista9/test.c7
-rw-r--r--Semestr 4/ask/lista9/test.s50
10 files changed, 651 insertions, 0 deletions
diff --git a/Semestr 4/ask/lista9/gadget.s b/Semestr 4/ask/lista9/gadget.s
new file mode 100644
index 0000000..6d60a63
--- /dev/null
+++ b/Semestr 4/ask/lista9/gadget.s
@@ -0,0 +1,16 @@
+ .global gadget
+
+ .text
+
+# rax: 0x3c
+# rdi: 0
+# rdx: {NULL, ...}
+# rsi: path + '\n'
+gadget:
+ dec %rax # rax: 0x3c -> 0x3b (sys_execve)
+ mov %rdx, %rsi # rsi: argv = {NULL}
+ mov %rdi, %rdx # rdx: envp = NULL
+ lea 16(%rsp),%rdi # rdi: path
+ ret
+
+# vim: ft=gas
diff --git a/Semestr 4/ask/lista9/lazy.c b/Semestr 4/ask/lista9/lazy.c
new file mode 100644
index 0000000..fb08cf7
--- /dev/null
+++ b/Semestr 4/ask/lista9/lazy.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main(void) {
+ puts("first time");
+ puts("second time");
+ return 0;
+}
diff --git a/Semestr 4/ask/lista9/lista_9.tgz b/Semestr 4/ask/lista9/lista_9.tgz
new file mode 100644
index 0000000..5e5c6f4
--- /dev/null
+++ b/Semestr 4/ask/lista9/lista_9.tgz
Binary files differ
diff --git a/Semestr 4/ask/lista9/relo3.c b/Semestr 4/ask/lista9/relo3.c
new file mode 100644
index 0000000..6aca7b6
--- /dev/null
+++ b/Semestr 4/ask/lista9/relo3.c
@@ -0,0 +1,15 @@
+int relo3(int val) {
+ switch (val) {
+ case 100:
+ return val;
+ case 101:
+ return val + 1;
+ case 103:
+ case 104:
+ return val + 3;
+ case 105:
+ return val + 5;
+ default:
+ return val + 6;
+ }
+}
diff --git a/Semestr 4/ask/lista9/ropex.c b/Semestr 4/ask/lista9/ropex.c
new file mode 100644
index 0000000..dbeae12
--- /dev/null
+++ b/Semestr 4/ask/lista9/ropex.c
@@ -0,0 +1,31 @@
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+
+/* Get string from stdin */
+void readline(FILE *in, char *p) {
+ int c;
+ while (true) {
+ c = fgetc(in);
+ if (c == EOF || c == '\n')
+ break;
+ *p++ = c;
+ }
+ *p = '\0';
+}
+
+void echo(FILE *in) {
+ char buf[48];
+ readline(in, buf);
+ puts(buf);
+}
+
+int main(int argc, char *argv[]) {
+ FILE *in = NULL;
+ if (argc == 2)
+ in = fopen(argv[1], "rb");
+ if (in == NULL)
+ in = stdin;
+ echo(in);
+ return 0;
+}
diff --git a/Semestr 4/ask/lista9/ropex.in (1).txt b/Semestr 4/ask/lista9/ropex.in (1).txt
new file mode 100644
index 0000000..902773e
--- /dev/null
+++ b/Semestr 4/ask/lista9/ropex.in (1).txt
@@ -0,0 +1,7 @@
+00000000: dead c0de dead c0de dead c0de dead c0de ................
+00000010: dead c0de dead c0de dead c0de dead c0de ................
+00000020: dead c0de dead c0de dead c0de dead c0de ................
+00000030: dead c0de dead c0de 731c 4000 0000 0000 ................
+00000040: f422 4000 0000 0000 0000 0000 0000 0000 ................
+00000050: 2f75 7372 2f62 696e 2f70 7974 686f 6e32 /usr/bin/python2
+00000060: 000a ................
diff --git a/Semestr 4/ask/lista9/ropex.in.txt b/Semestr 4/ask/lista9/ropex.in.txt
new file mode 100644
index 0000000..8deabfe
--- /dev/null
+++ b/Semestr 4/ask/lista9/ropex.in.txt
@@ -0,0 +1,7 @@
+00000000: dead c0de dead c0de dead c0de dead c0de ................
+00000010: dead c0de dead c0de dead c0de dead c0de ................
+00000020: dead c0de dead c0de dead c0de dead c0de ................
+00000030: dead c0de dead c0de 671d 4000 0000 0000 ................
+00000040: 8e44 4900 0000 0000 0000 0000 0000 0000 ................
+00000050: 2f75 7372 2f62 696e 2f6e 7961 6e63 6174 /usr/bin/nyancat
+00000060: 000a ................ \ No newline at end of file
diff --git a/Semestr 4/ask/lista9/ropex.map b/Semestr 4/ask/lista9/ropex.map
new file mode 100644
index 0000000..4bd12a5
--- /dev/null
+++ b/Semestr 4/ask/lista9/ropex.map
@@ -0,0 +1,511 @@
+Archive member included to satisfy reference by file (symbol)
+
+/usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o (__libc_csu_init)
+
+Merging program properties
+
+Removed property 0xc0000002 to merge /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o (0x3) and gadget.o (not found)
+Removed property 0xc0000002 to merge /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o (not found) and /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS) (0x3)
+Removed property 0xc0000002 to merge /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o (not found) and /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o (0x3)
+Removed property 0xc0000002 to merge /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o (not found) and /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o (0x3)
+
+As-needed library included to satisfy reference by file (symbol)
+
+libc.so.6 ropex.o (fopen@@GLIBC_2.2.5)
+
+Discarded input sections
+
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 ropex.o
+ .note.gnu.property
+ 0x0000000000000000 0x20 ropex.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ .note.gnu.property
+ 0x0000000000000000 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+ .note.GNU-stack
+ 0x0000000000000000 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+
+Memory Configuration
+
+Name Origin Length Attributes
+*default* 0x0000000000000000 0xffffffffffffffff
+
+Linker script and memory map
+
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+LOAD ropex.o
+LOAD gadget.o
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so
+START GROUP
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgcc_s.so.1
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
+END GROUP
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libc.so
+START GROUP
+LOAD /lib/x86_64-linux-gnu/libc.so.6
+LOAD /usr/lib/x86_64-linux-gnu/libc_nonshared.a
+LOAD /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
+END GROUP
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc_s.so
+START GROUP
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libgcc_s.so.1
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a
+END GROUP
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+LOAD /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+ [!provide] PROVIDE (__executable_start = SEGMENT_START ("text-segment", 0x0))
+ 0x00000000000002a8 . = (SEGMENT_START ("text-segment", 0x0) + SIZEOF_HEADERS)
+
+.interp 0x00000000000002a8 0x1c
+ *(.interp)
+ .interp 0x00000000000002a8 0x1c /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.note.gnu.build-id
+ 0x00000000000002c4 0x24
+ *(.note.gnu.build-id)
+ .note.gnu.build-id
+ 0x00000000000002c4 0x24 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.note.ABI-tag 0x00000000000002e8 0x20
+ .note.ABI-tag 0x00000000000002e8 0x20 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.hash
+ *(.hash)
+
+.gnu.hash 0x0000000000000308 0x28
+ *(.gnu.hash)
+ .gnu.hash 0x0000000000000308 0x28 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.dynsym 0x0000000000000330 0x108
+ *(.dynsym)
+ .dynsym 0x0000000000000330 0x108 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.dynstr 0x0000000000000438 0xaf
+ *(.dynstr)
+ .dynstr 0x0000000000000438 0xaf /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.gnu.version 0x00000000000004e8 0x16
+ *(.gnu.version)
+ .gnu.version 0x00000000000004e8 0x16 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.gnu.version_d 0x0000000000000500 0x0
+ *(.gnu.version_d)
+ .gnu.version_d
+ 0x0000000000000500 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.gnu.version_r 0x0000000000000500 0x30
+ *(.gnu.version_r)
+ .gnu.version_r
+ 0x0000000000000500 0x30 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.rela.dyn 0x0000000000000530 0xd8
+ *(.rela.init)
+ *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
+ .rela.text 0x0000000000000530 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.rela.fini)
+ *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
+ *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
+ .rela.data.rel.ro
+ 0x0000000000000530 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .rela.data.rel.local
+ 0x0000000000000530 0x18 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
+ *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
+ *(.rela.ctors)
+ *(.rela.dtors)
+ *(.rela.got)
+ .rela.got 0x0000000000000548 0x78 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
+ .rela.bss 0x00000000000005c0 0x18 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.rela.ldata .rela.ldata.* .rela.gnu.linkonce.l.*)
+ *(.rela.lbss .rela.lbss.* .rela.gnu.linkonce.lb.*)
+ *(.rela.lrodata .rela.lrodata.* .rela.gnu.linkonce.lr.*)
+ *(.rela.ifunc)
+ .rela.ifunc 0x00000000000005d8 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .rela.fini_array
+ 0x00000000000005d8 0x18 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .rela.init_array
+ 0x00000000000005f0 0x18 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.rela.plt 0x0000000000000608 0x60
+ *(.rela.plt)
+ .rela.plt 0x0000000000000608 0x60 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.rela.iplt)
+ 0x0000000000001000 . = ALIGN (CONSTANT (MAXPAGESIZE))
+
+.init 0x0000000000001000 0x1b
+ *(SORT_NONE(.init))
+ .init 0x0000000000001000 0x16 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ 0x0000000000001000 _init
+ .init 0x0000000000001016 0x5 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+
+.plt 0x0000000000001020 0x50
+ *(.plt)
+ .plt 0x0000000000001020 0x50 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000001030 puts@@GLIBC_2.2.5
+ 0x0000000000001040 __stack_chk_fail@@GLIBC_2.4
+ 0x0000000000001050 fgetc@@GLIBC_2.2.5
+ 0x0000000000001060 fopen@@GLIBC_2.2.5
+ *(.iplt)
+
+.plt.got 0x0000000000001070 0x8
+ *(.plt.got)
+ .plt.got 0x0000000000001070 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000001070 __cxa_finalize@@GLIBC_2.2.5
+
+.plt.sec
+ *(.plt.sec)
+
+.text 0x0000000000001080 0x235
+ *(.text.unlikely .text.*_unlikely .text.unlikely.*)
+ *(.text.exit .text.exit.*)
+ *(.text.startup .text.startup.*)
+ *(.text.hot .text.hot.*)
+ *(SORT_BY_NAME(.text.sorted.*))
+ *(.text .stub .text.* .gnu.linkonce.t.*)
+ .text 0x0000000000001080 0x2f /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000001080 _start
+ .text 0x00000000000010af 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ *fill* 0x00000000000010af 0x1
+ .text 0x00000000000010b0 0xb9 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ .text 0x0000000000001169 0xbb ropex.o
+ 0x0000000000001169 readline
+ 0x00000000000011a3 echo
+ 0x00000000000011e7 main
+ .text 0x0000000000001224 0xf gadget.o
+ 0x0000000000001224 gadget
+ *fill* 0x0000000000001233 0xd
+ .text 0x0000000000001240 0x75 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ 0x0000000000001240 __libc_csu_init
+ 0x00000000000012b0 __libc_csu_fini
+ .text 0x00000000000012b5 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ .text 0x00000000000012b5 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+ *(.gnu.warning)
+
+.fini 0x00000000000012b8 0xd
+ *(SORT_NONE(.fini))
+ .fini 0x00000000000012b8 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ 0x00000000000012b8 _fini
+ .fini 0x00000000000012c0 0x5 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+ [!provide] PROVIDE (__etext = .)
+ [!provide] PROVIDE (_etext = .)
+ [!provide] PROVIDE (etext = .)
+ 0x0000000000002000 . = ALIGN (CONSTANT (MAXPAGESIZE))
+ 0x0000000000002000 . = SEGMENT_START ("rodata-segment", (ALIGN (CONSTANT (MAXPAGESIZE)) + (. & (CONSTANT (MAXPAGESIZE) - 0x1))))
+
+.rodata 0x0000000000002000 0x7
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ .rodata.cst4 0x0000000000002000 0x4 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000002000 _IO_stdin_used
+ .rodata.str1.1
+ 0x0000000000002004 0x3 ropex.o
+
+.rodata1
+ *(.rodata1)
+
+.eh_frame_hdr 0x0000000000002008 0x34
+ *(.eh_frame_hdr)
+ .eh_frame_hdr 0x0000000000002008 0x34 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000002008 __GNU_EH_FRAME_HDR
+ *(.eh_frame_entry .eh_frame_entry.*)
+
+.eh_frame 0x0000000000002040 0xd0
+ *(.eh_frame)
+ .eh_frame 0x0000000000002040 0x30 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x2c (size before relaxing)
+ *fill* 0x0000000000002070 0x0
+ .eh_frame 0x0000000000002070 0x28 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x40 (size before relaxing)
+ .eh_frame 0x0000000000002098 0x18 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x30 (size before relaxing)
+ .eh_frame 0x00000000000020b0 0x5c /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ 0x78 (size before relaxing)
+ .eh_frame 0x000000000000210c 0x4 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ *(.eh_frame.*)
+
+.gcc_except_table
+ *(.gcc_except_table .gcc_except_table.*)
+
+.gnu_extab
+ *(.gnu_extab*)
+
+.exception_ranges
+ *(.exception_ranges*)
+ 0x0000000000003da0 . = DATA_SEGMENT_ALIGN (CONSTANT (MAXPAGESIZE), CONSTANT (COMMONPAGESIZE))
+
+.eh_frame
+ *(.eh_frame)
+ *(.eh_frame.*)
+
+.gnu_extab
+ *(.gnu_extab)
+
+.gcc_except_table
+ *(.gcc_except_table .gcc_except_table.*)
+
+.exception_ranges
+ *(.exception_ranges*)
+
+.tdata 0x0000000000003da0 0x0
+ [!provide] PROVIDE (__tdata_start = .)
+ *(.tdata .tdata.* .gnu.linkonce.td.*)
+
+.tbss
+ *(.tbss .tbss.* .gnu.linkonce.tb.*)
+ *(.tcommon)
+
+.preinit_array 0x0000000000003da0 0x0
+ [!provide] PROVIDE (__preinit_array_start = .)
+ *(.preinit_array)
+ [!provide] PROVIDE (__preinit_array_end = .)
+
+.init_array 0x0000000000003da0 0x8
+ 0x0000000000003da0 PROVIDE (__init_array_start = .)
+ *(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))
+ *(.init_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .ctors)
+ .init_array 0x0000000000003da0 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ 0x0000000000003da8 PROVIDE (__init_array_end = .)
+
+.fini_array 0x0000000000003da8 0x8
+ [!provide] PROVIDE (__fini_array_start = .)
+ *(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))
+ *(.fini_array EXCLUDE_FILE(*crtend?.o *crtend.o *crtbegin?.o *crtbegin.o) .dtors)
+ .fini_array 0x0000000000003da8 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ [!provide] PROVIDE (__fini_array_end = .)
+
+.ctors
+ *crtbegin.o(.ctors)
+ *crtbegin?.o(.ctors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+ *(SORT_BY_NAME(.ctors.*))
+ *(.ctors)
+
+.dtors
+ *crtbegin.o(.dtors)
+ *crtbegin?.o(.dtors)
+ *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+ *(SORT_BY_NAME(.dtors.*))
+ *(.dtors)
+
+.jcr
+ *(.jcr)
+
+.data.rel.ro 0x0000000000003db0 0x0
+ *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*)
+ *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*)
+ .data.rel.ro 0x0000000000003db0 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+
+.dynamic 0x0000000000003db0 0x1f0
+ *(.dynamic)
+ .dynamic 0x0000000000003db0 0x1f0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000003db0 _DYNAMIC
+
+.got 0x0000000000003fa0 0x60
+ *(.got.plt)
+ .got.plt 0x0000000000003fa0 0x38 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000003fa0 _GLOBAL_OFFSET_TABLE_
+ *(.igot.plt)
+ *(.got)
+ .got 0x0000000000003fd8 0x28 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ *(.igot)
+ 0x0000000000004000 . = DATA_SEGMENT_RELRO_END (., 0x0)
+
+.data 0x0000000000004000 0x10
+ *(.data .data.* .gnu.linkonce.d.*)
+ .data 0x0000000000004000 0x4 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000004000 data_start
+ 0x0000000000004000 __data_start
+ .data 0x0000000000004004 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ .data 0x0000000000004004 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ *fill* 0x0000000000004004 0x4
+ .data.rel.local
+ 0x0000000000004008 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ 0x0000000000004008 __dso_handle
+ .data 0x0000000000004010 0x0 ropex.o
+ .data 0x0000000000004010 0x0 gadget.o
+ .data 0x0000000000004010 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ .data 0x0000000000004010 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ .data 0x0000000000004010 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+
+.tm_clone_table
+ 0x0000000000004010 0x0
+ .tm_clone_table
+ 0x0000000000004010 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ .tm_clone_table
+ 0x0000000000004010 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+
+.data1
+ *(.data1)
+ 0x0000000000004010 _edata = .
+ [!provide] PROVIDE (edata = .)
+ 0x0000000000004010 . = .
+ 0x0000000000004010 __bss_start = .
+
+.bss 0x0000000000004010 0x10
+ *(.dynbss)
+ *fill* 0x0000000000004010 0x0
+ .dynbss 0x0000000000004010 0x8 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ 0x0000000000004010 stdin@@GLIBC_2.2.5
+ *(.bss .bss.* .gnu.linkonce.b.*)
+ .bss 0x0000000000004018 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o
+ .bss 0x0000000000004018 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crti.o
+ .bss 0x0000000000004018 0x1 /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ .bss 0x0000000000004019 0x0 ropex.o
+ .bss 0x0000000000004019 0x0 gadget.o
+ .bss 0x0000000000004019 0x0 /usr/lib/x86_64-linux-gnu/libc_nonshared.a(elf-init.oS)
+ .bss 0x0000000000004019 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+ .bss 0x0000000000004019 0x0 /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crtn.o
+ *(COMMON)
+ 0x0000000000004020 . = ALIGN ((. != 0x0)?0x8:0x1)
+ *fill* 0x0000000000004019 0x7
+
+.lbss
+ *(.dynlbss)
+ *(.lbss .lbss.* .gnu.linkonce.lb.*)
+ *(LARGE_COMMON)
+ 0x0000000000004020 . = ALIGN (0x8)
+ 0x0000000000004020 . = SEGMENT_START ("ldata-segment", .)
+
+.lrodata
+ *(.lrodata .lrodata.* .gnu.linkonce.lr.*)
+
+.ldata 0x0000000000006020 0x0
+ *(.ldata .ldata.* .gnu.linkonce.l.*)
+ 0x0000000000006020 . = ALIGN ((. != 0x0)?0x8:0x1)
+ 0x0000000000006020 . = ALIGN (0x8)
+ 0x0000000000004020 _end = .
+ [!provide] PROVIDE (end = .)
+ 0x0000000000006020 . = DATA_SEGMENT_END (.)
+
+.stab
+ *(.stab)
+
+.stabstr
+ *(.stabstr)
+
+.stab.excl
+ *(.stab.excl)
+
+.stab.exclstr
+ *(.stab.exclstr)
+
+.stab.index
+ *(.stab.index)
+
+.stab.indexstr
+ *(.stab.indexstr)
+
+.comment 0x0000000000000000 0x2a
+ *(.comment)
+ .comment 0x0000000000000000 0x2a /usr/lib/gcc/x86_64-linux-gnu/9/crtbeginS.o
+ 0x2b (size before relaxing)
+ .comment 0x000000000000002a 0x2b ropex.o
+ .comment 0x000000000000002a 0x2b /usr/lib/gcc/x86_64-linux-gnu/9/crtendS.o
+
+.gnu.build.attributes
+ *(.gnu.build.attributes .gnu.build.attributes.*)
+
+.debug
+ *(.debug)
+
+.line
+ *(.line)
+
+.debug_srcinfo
+ *(.debug_srcinfo)
+
+.debug_sfnames
+ *(.debug_sfnames)
+
+.debug_aranges 0x0000000000000000 0x30
+ *(.debug_aranges)
+ .debug_aranges
+ 0x0000000000000000 0x30 ropex.o
+
+.debug_pubnames
+ *(.debug_pubnames)
+
+.debug_info 0x0000000000000000 0x49e
+ *(.debug_info .gnu.linkonce.wi.*)
+ .debug_info 0x0000000000000000 0x49e ropex.o
+
+.debug_abbrev 0x0000000000000000 0x19b
+ *(.debug_abbrev)
+ .debug_abbrev 0x0000000000000000 0x19b ropex.o
+
+.debug_line 0x0000000000000000 0x188
+ *(.debug_line .debug_line.* .debug_line_end)
+ .debug_line 0x0000000000000000 0x188 ropex.o
+
+.debug_frame 0x0000000000000000 0xa8
+ *(.debug_frame)
+ .debug_frame 0x0000000000000000 0xa8 ropex.o
+
+.debug_str 0x0000000000000000 0x2f4
+ *(.debug_str)
+ .debug_str 0x0000000000000000 0x2f4 ropex.o
+ 0x333 (size before relaxing)
+
+.debug_loc 0x0000000000000000 0x254
+ *(.debug_loc)
+ .debug_loc 0x0000000000000000 0x254 ropex.o
+
+.debug_macinfo
+ *(.debug_macinfo)
+
+.debug_weaknames
+ *(.debug_weaknames)
+
+.debug_funcnames
+ *(.debug_funcnames)
+
+.debug_typenames
+ *(.debug_typenames)
+
+.debug_varnames
+ *(.debug_varnames)
+
+.debug_pubtypes
+ *(.debug_pubtypes)
+
+.debug_ranges
+ *(.debug_ranges)
+
+.debug_macro
+ *(.debug_macro)
+
+.debug_addr
+ *(.debug_addr)
+
+.gnu.attributes
+ *(.gnu.attributes)
+
+/DISCARD/
+ *(.note.GNU-stack)
+ *(.gnu_debuglink)
+ *(.gnu.lto_*)
+OUTPUT(ropex elf64-x86-64)
diff --git a/Semestr 4/ask/lista9/test.c b/Semestr 4/ask/lista9/test.c
new file mode 100644
index 0000000..1dae111
--- /dev/null
+++ b/Semestr 4/ask/lista9/test.c
@@ -0,0 +1,7 @@
+void foobar() {}
+
+static const struct {
+ char a[3]; int b; long c; float pi;
+} baz = { "abc", 42, -3, 1.4142 };
+
+long array[100]; \ No newline at end of file
diff --git a/Semestr 4/ask/lista9/test.s b/Semestr 4/ask/lista9/test.s
new file mode 100644
index 0000000..5e60585
--- /dev/null
+++ b/Semestr 4/ask/lista9/test.s
@@ -0,0 +1,50 @@
+ .file "test.c"
+ .text
+ .globl foobar
+ .type foobar, @function
+foobar:
+.LFB0:
+ .cfi_startproc
+ endbr64
+ pushq %rbp
+ .cfi_def_cfa_offset 16
+ .cfi_offset 6, -16
+ movq %rsp, %rbp
+ .cfi_def_cfa_register 6
+ nop
+ popq %rbp
+ .cfi_def_cfa 7, 8
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foobar, .-foobar
+ .section .rodata
+ .align 16
+ .type baz, @object
+ .size baz, 24
+baz:
+ .ascii "abc"
+ .zero 1
+ .long 42
+ .quad -3
+ .long 1068827777
+ .zero 4
+ .comm array,800,32
+ .ident "GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
+ .section .note.GNU-stack,"",@progbits
+ .section .note.gnu.property,"a"
+ .align 8
+ .long 1f - 0f
+ .long 4f - 1f
+ .long 5
+0:
+ .string "GNU"
+1:
+ .align 8
+ .long 0xc0000002
+ .long 3f - 2f
+2:
+ .long 0x3
+3:
+ .align 8
+4: