These are needed for .ctors/.dtors and .jcr handling. The former needs
all the function pointers to be called in the correct order from the
.init/.fini section. The latter just needs to call a gcj specific function
if it exists with a pointer to the start of the .jcr section.
This is currently disabled until __dso_handle support is added.
Reviewed by: emaste
MFC after: 1 month
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D17587
This makes statically linked binaries with ifuncs operational.
Reported and tested by: mjg
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
Approved by: re (rgrimes)
Differential revision: https://reviews.freebsd.org/D17363
On most architectures crt objects are compiled in a multiple-step process
so that sed can be run on the generated assembly. As the final step,
the C compiler generates an object file from the modified assembly output.
Currently this last step uses $CC with only $ACFLAGS. However, for other
uses in the tree, $ACFLAGS is meant to include assembly-specific compiler
flags that are in addition to $CFLAGS (see default .S.o rules
bsd.suffixes.mk). In particular, external toolchains may require
additional flags to select a non-default target which will be present
in CFLAGS but not ACFLAGS. To support this while still mitigating the
issue with CFLAGS described in r234502, include a modified CFLAGS that
excludes "-g" when assembling the modified assembly files.
Note that normally an assembler ($AS) is used to assemble .s flags to
object files (see bsd.suffixes.mk). However, llvm-based toolchains do
not currently have a stand-alone assembler.
Reviewed by: imp
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D10085
The requirement is for a GCC-compatible compiler and not necessarily
GCC itself. However, we currently expect any compiler used for building
the whole of FreeBSD to be GCC-compatible and many things will break if
not; there's no longer a need to have an explicit test for this in csu.
Sponsored by: The FreeBSD Foundation
FILES is not used when LIBRARIES_ONLY is set, which is used to build and
install the lib32 sysroot. All of the csu files do quality as "libraries"
for this case so just undefine LIBRARIES_ONLY.
This is still better than the previous realinstall handling as it does
not hook into META_MODE properly.
Sponsored by: EMC / Isilon Storage Division
This partially reverts r270170 for lib/csu/i386 while retaining the
change for using bsd.lib.mk.
These FILES groups could go into lib/csu/Makefile.inc but I've kept them
in the Makefiles for clarity.
Sponsored by: EMC / Isilon Storage Division
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.
Still need to add real targets under targets/ to build packages.
Differential Revision: D2796
Reviewed by: brooks imp
This was a leftover from when we had both i386 a.out and ELF.
Reviewed by: kib, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2591
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
Move a.out libraries to /usr/lib/aout to make space for ELF libs.
Make rtld usr /usr/lib/aout as default library path.
Make ldconfig reject /usr/lib as an a.out library path.
Fix various Makefiles for LIBDIR!=/usr/lib breakage.
This will after a make world & reboot give a system that no
longer uses /usr/lib/*, infact one could remove all the old
libraries there, they are not used anymore.
We are getting close to an ELF make world, but I'll let this
all settle for a week or two...
into libc. This reduces the size of every dynamically linked
executable by 248 bytes, and it reduces the size of static executables
by a lesser amount. It also eliminates some global namespace
pollution.
With this change in place, the source for dlfcn.h should probably
be moved to "/usr/src/include". I'll save that for another day.
Compatibility note: Programs which use dlopen, if compiled on
systems with this change, will not run on systems with a libc from
prior to this change. Very few programs use dlopen, so I think
that is OK.
common. Add one do-nothing element to each set. This ensures that
the linker realizes that they are linker sets rather than simple
commons, and makes it possible to link c++rt0.o into every shared
library regardless of whether it is a C++ library or not. Without
this change, the constructors and destructors in the main program
could be executed multiple times.
This change is going to make it possible to get rid of the
CPLUSPLUSLIB makefile variable once and for all. It is a piece of
the solution to PR gnu/3505 (gcc -shared). Finally, it fixes a
heretofore unreported bug: If CPLUSPLUSLIB was set in a makefile
for a C++ shared library that had no static constructors or
destructors in it, then the main program's constructors and
destructors would be executed multiple times.
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
Add descriptions of RTLD_LAZY and RTLD_NOW.
Correct the synopsis to agree with the actual function prototypes.
Add clarifications of a few things.
Clean up the wording in a few places.
was apparently overlooked at the time the member was added. Its absence
causes some error messages from the dynamic linker to begin with
"(null):" instead of with the pathname of the dynamic linker as they
should.
I am also adding a work-around to the dynamic linker, to cope with
legacy binaries that were built with older versions of crt0.
just return errors. This removes the need for awful hacks like that in
our build of libtcl which would get link errors when linked static.
John Polstra once mentioned that this was on his "todo" list.
Note that one can use:
cc -Wl,-Bstatic -o foo foo.o
and get an executable that has it's libraries statically linked, but has
a fully functional runtime linker so the executable can call dlopen() and
have it work. (I've tested this)
and forwards compatable with version 3. This is needed to enable storing
a run-time library path in the dynamic linking headers. The crt startup
tries version 4 first, and falls back to version 3, so an executable that
is linked on -current will work with the ld.so on 2.1.x and less.
Reviewed by: nate, jdp
Obtained from: NetBSD
to 2. This makes them agree with the declarations in libgcc, and
clears the way once again for linking c++rt0.o into all libraries,
and eliminating CPLUSPLUSLIB from <bsd.lib.mk>. (I have not made
that change yet, because there is still a bootstrapping problem
for "make world".)
Also, removed a check which ensured that the constructor count in
the first word of __CTOR_LIST__ was greater than zero before
traversing the list. I had added that check earlier, but it is no
longer necessary, now that there is guaranteed to be at least 2
words in __CTOR_LIST__.
the loop that invokes the static constructors. That makes it safe
to link c++rt0.o into any shared library, even one that does not
have any static constructors. Formerly, doing that would cause a
bus error. If the library has no static constructors, __CTOR_LIST__
comes out as a simple 4-byte COMMON region, and it does not have
the usual NULL word that terminates the list of constructors. This
caused the old code to "call" a garbage address via the non-existent
entry __CTOR_LIST__[1].
The analogous code that invokes the static destructors was already safe.
This change is fully backward-compatible.
Reviewed by: dfr@render.com (Doug Rabson)