Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust resistor-color difficulty #241

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"uuid": "39e8a36c-bbcb-4b47-ae05-f376f74fa4a8",
"practices": [],
"prerequisites": [],
"difficulty": 1,
"difficulty": 3,
"topics": [
"arrays"
]
Expand Down
4 changes: 4 additions & 0 deletions exercises/practice/resistor-color/resistor_color.asm
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
default rel
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we omit this line from the example solution, we see

/usr/bin/ld: resistor_color.o: relocation R_X86_64_32S against `.data' can not be used when making a PIE object; recompile with -fPIE                                     
/usr/bin/ld: failed to set dynamic section sizes: bad value                          
collect2: error: ld returned 1 exit status                                           
make: *** [Makefile:32: tests] Error 1

That error does not guide people to add default rel


section .data
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we omit this line from the example solution, so the array is in section .rodata, we see

/usr/bin/ld: resistor_color.o: warning: relocation in read-only section `.rodata'    
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE                                   
collect2: error: ld returned 1 exit status                                           
make: *** [Makefile:32: tests] Error 1

We can guide students away from experiencing this error.


section .text
global color_code
color_code:
Expand Down