1. Homepage
  2. Programming
  3. [2021] UIC - CS 361: Systems Programming - Homework1 The ELF Format

[2021] UIC - CS 361: Systems Programming - Homework1 The ELF Format

Engage in a Conversation
CS361Systems ProgrammingUniversity of Illinois at ChicagoUICELF Format

Homework 1 The ELF format#

This homework is meant to get you familiarized with the concept of symbols and how they relate to compiling and linking executables. CourseNana.COM


CourseNana.COM

We covered using git in the week 1 video and discussion section, but if you're still not that familiar with it, this assignment is a second chance to get up to speed. Remember: git gives you warnings and errors for good reason, if it complains at the command line when you run a command, don't just assume it's completed correctly! CourseNana.COM


CourseNana.COM

The skeleton code for this assignment is available through this GitHub Classroom assignment. You must use GitHub classroom to write your code and keep a commit log on GitHub. You can submit the code via Gradescope.

Now that you have the skeleton code, you can start coding. You should commit early and often, and push to your remote repository whenever is convenient to back up your work! CourseNana.COM


Programming environment#

This assignment was created in an Ubuntu 18.04 based environment. The skeleton code comes with a devcontainer setup script so that running it in a remote container through Visual Studio Code will put you in the same environment. This assignment is simple enough that any Linux environment with an up to date gcc should be sufficient, including systems1.cs.uic.edu. If you aren't/can't/don't want to complete this assignment using vscode remote containers, feel free to complete this on a lab machine, a local Linux VM, or elsewhere. CourseNana.COM


CourseNana.COM

The Programming Part!#

This part will give you a quick introduction to using readelf to better understand the linking process. CourseNana.COM

In this assignment, you must fill hw1.c with code which will: CourseNana.COM


CourseNana.COM

  1. cause your UIC netID (and nothing else) to be printed on the first line of output when the program is run.
  2. cause gcc -c -Wall hw1.c and gcc -Wall -o hw1 *.c to issue zero warnings (and zero errors).
  3. cause Type, Bind, and Ndx of each Symbol to be the same as in the example below. E.g. important must have Type FUNC, Bind LOCAL, and Ndx 1.


CourseNana.COM

Running readelf -sW hw1.o on the solution results in: CourseNana.COM

Num:ValueSizeTypeBindVisNdxName
0:00000000000000000NOTYPELOCALDEFAULTUND
1:00000000000000000FILELOCALDEFAULTABShw1.c
2:00000000000000000SECTIONLOCALDEFAULT1
3:00000000000000000SECTIONLOCALDEFAULT3
4:00000000000000000SECTIONLOCALDEFAULT4
5:00000000000000000SECTIONLOCALDEFAULT5
6:00000000000000000SECTIONLOCALDEFAULT6
7:00000000000000000SECTIONLOCALDEFAULT8
8:00000000000000084OBJECTLOCALDEFAULT3order
9:00000000000000004OBJECTLOCALDEFAULT4isnt
10:000000000000000058FUNCLOCALDEFAULT1important
11:00000000000000108OBJECTLOCALDEFAULT3for_these.3824
12:00000000000000088OBJECTLOCALDEFAULT4symbols.3825
13:00000000000000000SECTIONLOCALDEFAULT11
14:00000000000000000SECTIONLOCALDEFAULT12
15:00000000000000000SECTIONLOCALDEFAULT10
16:0000000000000020100OBJECTGLOBALDEFAULTCOMbut_the
17:00000000000000008OBJECTGLOBALDEFAULT3types
18:000000000000000015OBJECTGLOBALDEFAULT5scopes
19:00000000000000008OBJECTGLOBALDEFAULT6and_the
20:00000000000000008OBJECTGLOBALDEFAULT8indices
21:00000000000000000NOTYPEGLOBALDEFAULTUNDdefinitely
22:000000000000003a32FUNCGLOBALDEFAULT1matter
23:000000000000005a44FUNCGLOBALDEFAULT1main
24:00000000000000000NOTYPEGLOBALDEFAULTUNDGLOBAL_OFFSET_TABLE
25:00000000000000000NOTYPEGLOBALDEFAULTUNDputs

As a further hint, here's the mapping between the Section Index and the Section Names: CourseNana.COM

Section Headers:
[Nr] Name
[ 0]
[ 1] .text
[ 2] .rela.text
[ 3] .data
[ 4] .bss
[ 5] .rodata
[ 6] .data.rel.local
[ 7] .rela.data.rel.local
[ 8] .data.rel
[ 9] .rela.data.rel
[10] .comment
[11] .note.GNU-stack
[12] .eh_frame
[13] .rela.eh_frame
[14] .symtab
[15] .strtab
[16] .shstrtab

Hints: CourseNana.COM

  • The four digit numbers do not need to made identical, but you do need to make them show up. Keep experimenting with different variable types until you find how to create variables with periods and numbers on them.

  • Order for the symbols does not matter. Take a close look at Chapter 7 and think about what properties of a variable put it in a different section, or would give it a different Binding or Type. Everything you need to know to solve this puzzle is in the book.

Template#

There is a very bare bones skeleton and a Makefile provided for this assignment. The skeleton file is worth two points because it compiles with no warnings and no errors. CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
CS361代写,Systems Programming代写,University of Illinois at Chicago代写,UIC代写,ELF Format代写,CS361代编,Systems Programming代编,University of Illinois at Chicago代编,UIC代编,ELF Format代编,CS361代考,Systems Programming代考,University of Illinois at Chicago代考,UIC代考,ELF Format代考,CS361help,Systems Programminghelp,University of Illinois at Chicagohelp,UIChelp,ELF Formathelp,CS361作业代写,Systems Programming作业代写,University of Illinois at Chicago作业代写,UIC作业代写,ELF Format作业代写,CS361编程代写,Systems Programming编程代写,University of Illinois at Chicago编程代写,UIC编程代写,ELF Format编程代写,CS361programming help,Systems Programmingprogramming help,University of Illinois at Chicagoprogramming help,UICprogramming help,ELF Formatprogramming help,CS361assignment help,Systems Programmingassignment help,University of Illinois at Chicagoassignment help,UICassignment help,ELF Formatassignment help,CS361solution,Systems Programmingsolution,University of Illinois at Chicagosolution,UICsolution,ELF Formatsolution,