8000 Got further in the linking by k0d · Pull Request #5 · tannewt/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

Got further in the linking #5

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

Closed
wants to merge 6 commits into from
Closed

Got further in the linking #5

wants to merge 6 commits into from

Conversation

k0d
Copy link
@k0d k0d commented Apr 29, 2020

Don't merge this if you don't wish to...it's not 100% clean code. But I wanted to do a PR so you could see the changes.

It still doesn't build yet...but it's progress!

# qstr builds include headers so we need to make sure they are up to date
$(HEADER_BUILD)/qstr.i.last: | $(BUILD)/esp-idf/config/sdkconfig.h

ESP_IDF_COMPONENTS = soc driver log
Copy link

Choose a reason for hiding this comment

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

To save you some iterations on looking for missing functions, recommend using this "minimal" set of components:

app_trace app_update bootloader bootloader_support cxx driver efuse esp32s2 esp_common esp_eth esp_event esp_netif esp_ringbuf esp_rom esp_system esp_timer esp_wifi espcoredump esptool_py freertos heap log lwip mbedtls newlib nvs_flash partition_table perfmon pthread soc spi_flash tcpip_adapter vfs wpa_supplicant xtensa

-Tesp32s2.rom.spiflash.ld \
-Lesp-idf/components/esp32s2/ld \
-Tesp32s2.peripherals.ld \
-ucall_user_start_cpu0 \
Copy link

Choose a reason for hiding this comment

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

answering the question from the livestream: we need to "undefine" functions so that the linker needs to look for them in the static libraries.

If the linker encounters an object file inside a static library, and the object file doesn't resolve any of the undefined references, then the object file is discarded. So we add these -u flags so that linker looks into the archives and includes the object files we want.

@k0d k0d closed this May 6, 2020
tannewt pushed a commit that referenced this pull request May 27, 2020
tannewt pushed a commit that referenced this pull request Feb 13, 2021
tannewt pushed a commit that referenced this pull request Jun 24, 2021
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        #2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        #3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        #4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        #5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        #6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        #7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        #8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0