On 08.03.2018 00:11, Eric Blake wrote:
> On 03/06/2018 12:18 AM, Thomas Huth wrote:
>> bootmap.h can currently only be included once - otherwise the linker
>> complains about multiple definitions of the "magic" strings.
> My first thought when reading that was "Huh? bootmap.h has a proper[*]
> double-inclusion header guard, and therefore a second #include
> "bootmap.h" is a no-op - so how can including the header more than once
> cause a linker complaint?"

Sorry if the description was not precise enough ... but I think it's
clear if you think about it twice ;-)

> [*] Well, proper if you overlook the fact that the name
> _PC_BIOS_S390_CCW_BOOTMAP_H starts with a leading underscore followed by
> uppercase, and is therefore violating namespace safety rules, as it
> could collide with a symbol reserved for the implementation

Yeah, we've got a couple of these left. I recently added a task to the
BiteSizedTasks page to clean those up.

> Your change is fine (moving the declaration into the one .c file that
> needs them), so no need to change this, but...
>> +++ b/pc-bios/s390-ccw/bootmap.h
>> @@ -375,9 +375,6 @@ static inline void read_iso_boot_image(uint32_t
>> block_offset, void *load_addr,
>>                  "Failed to read boot image!");
>>   }
>>   -const uint8_t el_torito_magic[] = "EL TORITO SPECIFICATION"
>> -                                  "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
> ...would adding 'static' here also solved the linker error (at the risk
> of possibly causing a compiler warning/error about unused variable)?

Yes, we would likely get a warning about unused variable instead, so
that's not a real option.


Reply via email to