The attached patch seems to work.
I am not sure this is the correct fix.

    Herman


On 4/1/21 3:45 PM, Christian Jullien wrote:

Hi maintainers, does someone is looking at it?

C.

*From:*Christian Jullien [mailto:[email protected]]
*Sent:* Saturday, March 27, 2021 09:26
*To:* '[email protected]'
*Subject:* macOS port is broken since "tccelf: use plt-reloc instead of relocplt" commit

Sorry folks I should have detected this error sooner.

Commit “tccelf: use plt-reloc instead of relocplt” by Grischka partially breaks macOS port.

It still works except for tests:

arg_align_test... success

------------ abitest-tcc ------------

make[2]: *** [abitest-tcc] Segmentation fault: 11

make[2]: Target `abitest' not remade because of errors.

------------ asm-c-connect-test ------------

And on test

Test: 114_bound_signal...

--- 114_bound_signal.expect     2021-02-18 14:42:59.000000000 +0100

+++ 114_bound_signal.output     2021-03-27 09:22:50.000000000 +0100

@@ -1,2 +0,0 @@

-start

-end

make[3]: *** [114_bound_signal.test] Error 1

Any program, even an empty main() {} coredumps if –b is passed as with test 114.

Christian


diff --git a/tccelf.c b/tccelf.c
index c7a8022..da675f5 100644
--- a/tccelf.c
+++ b/tccelf.c
@@ -1001,9 +1001,12 @@ ST_FUNC void relocate_sections(TCCState *s1)
         if (sr->sh_type != SHT_RELX)
             continue;
         s = s1->sections[sr->sh_info];
+#ifndef TCC_TARGET_MACHO
         if (s != s1->got
             || s1->static_link
-            || s1->output_type == TCC_OUTPUT_MEMORY) {
+            || s1->output_type == TCC_OUTPUT_MEMORY)
+#endif
+        {
             relocate_section(s1, s, sr);
         }
 #ifndef ELF_OBJ_ONLY
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to