Closed th-otto closed 1 year ago
Seems to be caused by missing
#undef SUBTARGET_OVERRIDE_OPTIONS
#define SUBTARGET_OVERRIDE_OPTIONS \
do { \
if (flag_pic && !TARGET_PCREL) \
error ("%<-f%s%> is not supported on this target", \
(flag_pic > 1) ? "PIC" : "pic"); \
} while (0)
in mint.h. Those flags must still be rejected for elf, because the runtime does not support it. Without this, autoconf tests thinks that -fPIC works, and uses it.
Regarding to pic/PIC stuff, I wondered if that could be useful for us, considering current lack of shared libraries. I had no idea about that, so I just kept the default config. This hadn't caused trouble until now. I wonder why there was a link error about _GLOBAL_OFFSET_TABLE_
. Probably something missing from the linker script. But as we don't want to support pic/PIC for now, the current fix is fine.
Note that demomakers often like pc-relative code, as they can move the programs anywhere in memory without caring about relocations. The option -mpcrel
is limited. I wonder if pic/PIC could help them, still without support of shared libraries.
This hadn't caused trouble until now. I wonder why there was a link error about
_GLOBAL_OFFSET_TABLE_
. Probably something missing from the linker script.
Sometimes it is explicitly disabled, either in config.guess, or by small patches i already used for the packages. But in this case the configure script just compiled using -fPIC and if that works, those flags are also used to compile (sometimes even if you just build a static library)
I wondered if that could be useful for us,
Not until now. It could be useful even without real shared libs, if you want to produce PIE code. But for that you need a lot of support from mintlib, startup code, and kernel, to set up a dedicated register at all relevant places that loads the address of the GOT. Linker of course also has to be changed (for now, only a script for executables is available, and that has to be changed too to include the relevant sections). And i think it also adds quite some overhead at runtime.
I wonder if pic/PIC could help them
Not the way it is implemented. It way even have the opposite effect: the addresses in the GOT have to be relocated by the loader, before the code is executed.
While trying to compile the FLAC library https://tho-otto.de/crossmint.php#flac i get
This only seems to happen with Vincents toolchain, but not with mine (although they should be almost identical now)