Re: [REGRESSION] "efi: efistub: Convert into static library" and preparation patches

From: Ard Biesheuvel
Date: Wed Sep 03 2014 - 11:37:32 EST


On 3 September 2014 17:30, Maarten Lankhorst
<maarten.lankhorst@xxxxxxxxxxxxx> wrote:
> Hey,
>
> Op 03-09-14 om 14:18 schreef Ard Biesheuvel:
>> Could you please try adding the visibility attribute lik this instead?
>>
>> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
>> index 044a2fd3c5fe..8725d85f1903 100644
>> --- a/arch/x86/include/asm/efi.h
>> +++ b/arch/x86/include/asm/efi.h
>> @@ -178,7 +178,7 @@ struct efi_config {
>> bool is64;
>> } __packed;
>>
>> -extern struct efi_config *efi_early;
>> +extern __attribute__((visibility("hidden"))) struct efi_config *efi_early;
>>
>> #define efi_call_early(f, ...) \
>> efi_early->call(efi_early->f, __VA_ARGS__);
>>
>> Before this change, I get 18 R_X86_64_GOTPCREL relocations pointing to
>> efi_early, both in efi-stub-helper.c and eboot.c.
>> After the change, I get 0, using 'readelf -a
>> drivers/firmware/efi/libstub/efi-stub-helper.o
>> arch/x86/boot/compressed/eboot.o|grep GOTPCREL|wc -l'
>>
> Yeah that fixes things!
>
> Feel free to slap on a reported-reviewed-and-tested-by on your patch. :-)
>

Will do, thanks.

@Matt: so there is two ways to fix this, the patch above addressing
this single instance, and alternatively, adding a #pragma GCC
visiblilty push(hidden) to all .c files under libstub/, *before* the
#includes. The latter would catch future problems regarding newly
introduced global variables, but it may be a bit overkill in this
case, as libstub is not expected to be in flux in the foreseeable
future.

Any preferences?

--
Ard.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/