#
✕ nick:yrlf
#asahi-dev · 2021-01-20 22:05
yrlfit's pure luck that GCC doesn't use them as well
#asahi-dev · 2021-01-20 22:04
yrlfthe -mgeneral-regs-only is also pretty much a hack, that I preemptively added since I noticed that printf writes to the q registers that aren't saved on interrupt.
#asahi-dev · 2021-01-20 22:04
yrlfthe question is if clang has an equivalent to -mabi=lp64
#asahi-dev · 2021-01-20 22:03
yrlfso the LD stuff is probably not that hard to figure out
#asahi-dev · 2021-01-20 22:03
yrlfyeah, verbose might be enough to get clang to tell us
#asahi-dev · 2021-01-20 22:02
yrlffor clang, there's nothing like -dumpspecs, so we have to find out ourselves what the equivalent ld.lld args are (probably the same as for GNU ld, but there might be slight quirks)
#asahi-dev · 2021-01-20 22:01
yrlfso you have to look into the gcc -dumpspecs to see how it invokes LD then
#asahi-dev · 2021-01-20 22:00
yrlf-static-pie is actually a GCC flag, not an LD flag
#asahi-dev · 2021-01-20 22:00
yrlfm1n1 needs to be relocatable, and m1n1 doesn't have a dynamic loader that loads it
#asahi-dev · 2021-01-20 22:00
yrlfeffectively, what m1n1 needs is -static-pie behaviour
#asahi-dev · 2021-01-20 21:59
yrlfso, effectively, the topic was: what linker flags are _actually_ needed for m1n1, right?
#asahi-dev · 2021-01-20 21:58
yrlfI think I'm slipping a bit into off-topic territory now I think
#asahi-dev · 2021-01-20 21:58
yrlffor a dynamically linked binary that is not -static-pie, the loader takes care of the relocating
#asahi-dev · 2021-01-20 21:54
yrlfso it's not _that_ minimal
#asahi-dev · 2021-01-20 21:53
yrlfokay, that also contains some random "am I the dynamic loader" code, but apart from that
#asahi-dev · 2021-01-20 21:52
yrlfminimal linux x86_64 PIE entry: https://github.com/Ferdi265/dynamic-loader/blob/master/crt/static-pie-crt.c
#asahi-dev · 2021-01-20 21:52
yrlfthat's apply_rela()
#asahi-dev · 2021-01-20 21:51
yrlfthat code needs to be dynamic relocation free, and will relocate the rest of the ELF
#asahi-dev · 2021-01-20 21:51
yrlfthe address in e_entry in the ELF header is relative to the base where the ELF is loaded
#asahi-dev · 2021-01-20 21:51
yrlfyeah, the hardcoded address thing is wrong
#asahi-dev · 2021-01-20 21:49
yrlfmodwizcode: where have you seen that PIE has a fixed entry point?
#asahi-dev · 2021-01-20 21:47
yrlfbut that doesn't apply here, since these NONE relocations don't contain a symbol
#asahi-dev · 2021-01-20 21:47
yrlfmodwizcode: apparently, NONE relocations are sometimes used to tell the linker that a section references another to not --gc-sections the other one away
#asahi-dev · 2021-01-20 21:46
yrlfso maybe the goal was to replicate what GCC would do?
#asahi-dev · 2021-01-20 21:45
yrlfmodwizcode: at least according to `gcc -dumpspecs`, -shared already implies -Bsymbolic for the linker call
#asahi-dev · 2021-01-20 21:33
yrlfI don't know why they are put in the ELF anyway, since they literally encode no information
#asahi-dev · 2021-01-20 21:33
yrlfoh yeah, that's a single NONE relocation
#asahi-dev · 2021-01-20 21:32
yrlfso e.g. in the large code model it must support offsets in the full 4GB range
#asahi-dev · 2021-01-20 21:32
yrlfmodwizcode: that small/large stuff is about -mcmodel, the code size model
#asahi-dev · 2021-01-20 21:30
yrlfjix: what difference are you getting when removing the shared? for my GCC toolchain removing -shared literally has no effect when -pie also exists
#asahi-dev · 2021-01-20 18:47
yrlfmarcan: your apple_serial code is still using some S3C... macros, don't know if that is deliberate
#asahi-dev · 2021-01-20 12:47
yrlflet's see what LKML says about the patch
#asahi-dev · 2021-01-20 11:56
yrlfso many quirks on that machine, oof
#asahi-dev · 2021-01-19 18:11
yrlfor IRC
#asahi-dev · 2021-01-19 18:11
yrlf"YouTube plays sleep schedule"
#asahi-dev · 2021-01-19 17:45
yrlfj`ey: of course there's vendor specific config. oh boy, this is gonna be """fun"""
#asahi-dev · 2021-01-19 17:33
yrlfso "early acknowledge" is pretty much "dev null all register writes" on the M1?
#asahi-dev · 2021-01-19 17:28
yrlfkind of reminds me of HBC boot on 3DS
#asahi-dev · 2021-01-19 17:26
yrlf*worse
#asahi-dev · 2021-01-19 17:26
yrlfwithout that that would have been even wore
#asahi-dev · 2021-01-19 17:26
yrlfat least you had framebuffer debug
#asahi-dev · 2021-01-19 17:13
yrlfwait, so if I understand that code correctly you added some putc code into the regster_earlycon, and it doesn't show up, right?
#asahi-dev · 2021-01-19 17:11
yrlfoh, then that's really wierd
#asahi-dev · 2021-01-19 17:11
yrlfmarcan: Graham Sutherland in the YT chat says according to some docs "Options are not yet supported." on the Samsung uart drivers
#asahi-dev · 2021-01-19 11:10
yrlfdon't know if that actually is needed, but let me check that
#asahi-dev · 2021-01-19 11:09
yrlfmarcan: you sometimes need to do .buffer.flush() on python3 IIRC
#asahi-dev · 2021-01-17 17:17
yrlfwoohoo! clang-built m1n1 works!
#asahi-dev · 2021-01-17 16:43
yrlfno problem :) Thanks a lot for the testing assistance with the crash logs as well :)
#asahi-dev · 2021-01-17 15:15
yrlfthe relocation resolves correctly in binaryninja now, for both GCC and clang
#asahi-dev · 2021-01-17 15:06
yrlfit seems LLD thinks all symbols in the linker script defined outside of the SECTIONS block are absolute apparently

plus ›