Skip to content

Commit

Permalink
build: always update *.a symbol table (re: 57f51b6)
Browse files Browse the repository at this point in the history
POSIX specifies that the act of adding or deleting *.o object files
to *.a library archives automatically updates the symbol table. But
on some older systems (particularly Mac OS X 10.3.7 on my
museum-grade PowerMac G5), this still needs to be done manually.

src/cmd/INIT/include/link_ar.mam:
- Invoke 'ar -s' after making any changes to a library archive;
  this is the equivalent of the obsolete 'ranlib' invocation to
  force updating the symbol table.

src/*/*/Mamfile:
- Remove obsolete ranlib invocations when installing. These should
  not be needed when copying an archive whose symbol table is known
  to be up to date.
  • Loading branch information
McDutchie committed Dec 4, 2024
1 parent 231f059 commit 2ad0f54
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
9 changes: 7 additions & 2 deletions src/cmd/INIT/include/link_ar.mam
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ exec - esac
exec - ;;
exec - esac
exec - done
exec - set -x
exec - case ${to_delete:+y} in
exec - y) set -x
exec - %{AR} -d %{@} $to_delete
exec - y) %{AR} -d %{@} $to_delete
exec - ;;
exec - esac

note * Some old systems do not automatically update the symbol table upon ad
note * adding or deleting object files (contra POSIX), so update it manually

exec - %{AR} -s %{@}
3 changes: 1 addition & 2 deletions src/cmd/ksh93/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,7 @@ make install virtual
done
make %{INSTALLROOT}/lib/libshell.a
prev libshell.a
exec - cp -f %{<} %{@} || exit
exec - ranlib %{@} >/dev/null 2>&1 || true
exec - cp -f %{<} %{@}
done
loop MAN3PG shell nval
make %{INSTALLROOT}/man/man3/%{MAN3PG}.3
Expand Down
3 changes: 1 addition & 2 deletions src/lib/libast/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -4497,8 +4497,7 @@ make install virtual
note * the library and dependency information
make %{INSTALLROOT}/lib/libast.a
prev libast.a
exec - cp -f %{<} %{@} || exit
exec - ranlib %{@} >/dev/null 2>&1 || true
exec - cp -f %{<} %{@}
done
make %{INSTALLROOT}/lib/lib/ast
prev ast.req
Expand Down
3 changes: 1 addition & 2 deletions src/lib/libcmd/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,7 @@ make install virtual
done
make %{INSTALLROOT}/lib/libcmd.a
prev libcmd.a
exec - cp -f %{<} %{@} || exit
exec - ranlib %{@} >/dev/null 2>&1 || true
exec - cp -f %{<} %{@}
done
make %{INSTALLROOT}/lib/lib/cmd
prev cmd.req
Expand Down
3 changes: 1 addition & 2 deletions src/lib/libdll/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ make install virtual
done
make %{INSTALLROOT}/lib/libdll.a
prev libdll.a
exec - cp -f %{<} %{@} || exit
exec - ranlib %{@} >/dev/null 2>&1 || true
exec - cp -f %{<} %{@}
done
make %{INSTALLROOT}/lib/lib/dll
prev dll.req
Expand Down
3 changes: 1 addition & 2 deletions src/lib/libsum/Mamfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ make install virtual
done
make %{INSTALLROOT}/lib/libsum.a
prev libsum.a
exec - cp -f %{<} %{@} || exit
exec - ranlib %{@} >/dev/null 2>&1 || true
exec - cp -f %{<} %{@}
done
make %{INSTALLROOT}/lib/lib/sum
prev sum.req
Expand Down

0 comments on commit 2ad0f54

Please sign in to comment.