core-bundle/src/Util/SymlinkUtil.php
public static function symlink(string $target, string $link, string $rootDir): void
    {
        static::validateSymlink($target, $link, $rootDir);

        $fs = new Filesystem();

        if (!$fs->isAbsolutePath($target)) {
            $target = $rootDir.'/'.$target;
        }

        if (!$fs->isAbsolutePath($link)) {
            $link = $rootDir.'/'.$link;
        }

        if ('\\' === \DIRECTORY_SEPARATOR) {
            $fs->symlink($target, $link);
        } else {
            $fs->symlink(rtrim($fs->makePathRelative($target, \dirname($link)), '/'), $link);
        }
    }
public static function symlink(string $target, string $link, string $rootDir): void
    {
        static::validateSymlink($target, $link, $rootDir);

        $fs = new Filesystem();

        if (!$fs->isAbsolutePath($target)) {
            $target = $rootDir.'/'.$target;
        }

        if (!$fs->isAbsolutePath($link)) {
            $link = $rootDir.'/'.$link;
        }

        if ('\\' === \DIRECTORY_SEPARATOR) {
            $fs->symlink($target, $link);
        } else {
            $fs->symlink(rtrim($fs->makePathRelative($target, \dirname($link)), '/'), $link);
        }
    }
Generates a symlink.

The method will try to generate relative symlinks and fall back to generating
absolute symlinks if relative symlinks are not supported (see #208).