[MacPorts] #67374: gcc10-bootstrap @10.3.0_5+universal: ld: file has external relocation entries in non-writable section (Tiger)

MacPorts noreply at macports.org
Fri May 5 04:21:02 UTC 2023


#67374: gcc10-bootstrap @10.3.0_5+universal: ld: file has external relocation
entries in non-writable section (Tiger)
------------------------+-----------------------------
 Reporter:  Cebtenzzre  |      Owner:  (none)
     Type:  defect      |     Status:  new
 Priority:  Normal      |  Milestone:
Component:  ports       |    Version:  2.8.1
 Keywords:  tiger       |       Port:  gcc10-bootstrap
------------------------+-----------------------------
 Related to #67348, it seems that (when PATH is set correctly)
 gcc10-bootstrap is unable to link executables on OS X Tiger. I'm omitting
 the assembler warnings for brevity.
 This is foo.c:
 {{{
 #include <stdio.h>

 int main(void) {
     puts("Hello, world!");
     return 0;
 }
 }}}
 gcc10-bootstrap cannot link it:
 {{{
 $ export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 $ gcc10=/opt/local/libexec/gcc10-bootstrap/bin/gcc
 $ $gcc10 foo.c -o foo
 /usr/bin/ld: /var/tmp//ccrgah6s.o has external relocation entries in non-
 writable section (__TEXT,__text) for symbols:
 _puts
 collect2: error: ld returned 1 exit status
 }}}
 But it can link the assembly generated by gcc-apple-4.2, and vice-versa:
 {{{
 $ gcc4=/opt/local/bin/gcc-apple-4.2
 $ $gcc4 -S foo.c -o foo-gcc4.S
 $ $gcc10 -S foo.c -o foo-gcc10.S
 $ $gcc4 foo-gcc10.S -o foo  # ok
 $ $gcc10 foo-gcc4.S -o foo  # ok
 }}}

 It looks like the difference is that gcc 10 emits a direct call to _puts,
 whereas gcc-apple-4.2 emits a stub in a special section outside of
 `.text`. And gcc-apple-4.2 calls MacPorts ld64, while gcc10-boostrap calls
 the system's classic ld.

 Why not configure gcc10-bootstrap to use the system ld64 on Tiger?
 {{{
 $ $gcc10 -c foo.c -o foo.o
 $ /usr/bin/ld64 -lcrt1.o foo.o -lSystem -o foo  # ok
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/67374>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list