Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[patch] PIC support in Hermes #48

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

[patch] PIC support in Hermes #48

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: don't know
Reported for operating system, platform: All, x86

Comments on the original bug report:

On 2006-03-08 01:10:32 +0000, Sam Lantinga wrote:

Date: Tue, 7 Mar 2006 02:05:09 -0500
From: Mike Frysinger vapier@gentoo.org
Subject: Re: [SDL] [patch] PIC support in Hermes

On Wednesday 01 March 2006 19:32, Mike Frysinger wrote:

rather than doing all the funky stuff with PIC, just mark all the symbols
hidden ... then you dont have to change anything else ...

you can find my patch to add elf visibility support to nasm here:
http://dev.gentoo.org/~vapier/patches/nasm-elf-visibility.patch

then simply add 'hidden' to the decl:
GLOBAL _mmxreturn:function hidden

and many of the TEXTRELs should magically vanish :)
-mike

On 2006-03-15 18:31:24 +0000, Alex Volkov wrote:

Created attachment 82
libsdl-PIC-hermes-call-dont-jump.patch

I think the proper way to resolve these TEXTREL problems is to apply the libsdl-PIC-hermes-call-dont-jump.patch mentioned on the list. This will get rid of the _mmxreturn and and _x86return labels, period. Using jumps in those cases serves no real purpose from the optimizations' point of view -- saving and reloading the return address from the stack is so cheap compared to other operations inside the loop.

On 2006-03-15 18:56:37 +0000, Mike Frysinger wrote:

maybe, but it's even cheaper to not even touch the stack

On 2006-03-20 01:45:39 +0000, Sam Lantinga wrote:

(In reply to comment # 0)

Date: Tue, 7 Mar 2006 02:05:09 -0500
From: Mike Frysinger vapier@gentoo.org
Subject: Re: [SDL] [patch] PIC support in Hermes

On Wednesday 01 March 2006 19:32, Mike Frysinger wrote:

rather than doing all the funky stuff with PIC, just mark all the symbols
hidden ... then you dont have to change anything else ...

you can find my patch to add elf visibility support to nasm here:
http://dev.gentoo.org/~vapier/patches/nasm-elf-visibility.patch

then simply add 'hidden' to the decl:
GLOBAL _mmxreturn:function hidden

Can you explain to me how this fixes the problem? Doesn't the address still have to be relocated at object load?

On 2006-03-20 19:18:50 +0000, Mike Frysinger wrote:

Doesn't the address still have to be relocated at object load?

it doesnt ... that's the magic part :)

default visibility means the symbol is exported and usuable by any external program ... so currently, people could declare an extern '_mmxreturn' function in their code and then call that location (even though it'd prob crash horribly)

but since the symbol is exported, the actual address wont really be known until load time so all of the absolute references need to be fixed up at runtime

if the symbol is marked as hidden, the linker will know that the symbol is not supposed to be exported and can rewrite all references to it at link time so that it no longer exists ... so all of the 'jmp _mmxreturn' lines get rewritten with relative jump's ... thus there's nothing left to fixup at runtime

the other nice benefit is you shrink the exported symbol table a little bit so there's less symbols to process at runtime ... all such private non-static SDL functions could benefit from being marked hidden

On 2006-05-22 01:24:07 +0000, Mike Frysinger wrote:

Created attachment 132
libsdl-hidden-nasm.patch

here's the patch i posted here:
http://www.libsdl.org/pipermail/sdl/2006-March/073618.html

this will hide the symbols dynamically if the build nasm/yasm supports the hidden stuff ... in other words, this patch should be safe with both older and new versions of nasm/yasm

On 2006-06-21 03:58:16 +0000, Sam Lantinga wrote:

This is in subversion, thanks!
I tweaked the patch slightly to handle older versions of nasm, which don't support :function syntax on Win32.

On 2006-06-21 04:14:28 +0000, Mike Frysinger wrote:

erm, sorry, but i forgot to update the patch here ...

the file "common.asm" needs to be renamed to "common.inc" otherwise the build system will try and compile it into the library:

SOURCES="$SOURCES $srcdir/src/hermes/*.asm"

On 2006-06-21 04:27:42 +0000, Sam Lantinga wrote:

Got it, thanks!

Wohlstand pushed a commit to Wohlstand/SDL that referenced this issue Mar 21, 2024
Since rendering happens on the EFB, we should report its height as the
fullscreen display's height. Failing to do so results in missing part of
the picture and/or in invalid memory accesses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant